Bug 800057

Summary: aeolus-cleanup doesn't clean up /var/tmp and /var/lib/iwhd/*
Product: [Retired] CloudForms Cloud Engine Reporter: Martin Kočí <mkoci>
Component: aeolus-configureAssignee: Richard Su <rwsu>
Status: CLOSED ERRATA QA Contact: Giulio Fidente <gfidente>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0.0CC: akarol, asettle, cpelland, deltacloud-maint, dmacpher, gfidente, juwu, mfojtik, morazi, mzatko, ssachdev, sseago, zaitcev
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: aeolus-configure-2.8.7-1.el6cf Doc Type: Bug Fix
Doc Text:
Running aeolus-cleanup did not clean up /var/tmp and /var/lib/iwhd/* properly. This bug fix updates Conductor to remove imagefactory-mock and deltacloud-mock* from /var/tmp when running aeolus-cleanup and ensures /var/lib/iwhd/* only contains empty sub-directories.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-04 14:57:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Martin Kočí 2012-03-05 16:53:59 UTC
Description of problem:
After the upgrade to aeolus-conductor-0.8.0-40.el6.noarch (aeolus-configure-2.5.0-17.el6.noarch) it seems that aeolus-cleanup doesn't clean up these directories /var/tmp and /var/lib/iwhd/*. Based on the bug 693514. 

Version-Release number of selected component (if applicable):
# rpm -qa | grep "aeolus\|imagefactory-\|oz-\|iwhd"
rubygem-aeolus-cli-0.3.0-12.el6.noarch
imagefactory-jeosconf-ec2-fedora-1.0.0rc8-1.el6.noarch
aeolus-conductor-0.8.0-40.el6.noarch
iwhd-1.2-3.el6.x86_64
imagefactory-jeosconf-ec2-rhel-1.0.0rc8-1.el6.noarch
aeolus-conductor-doc-0.8.0-40.el6.noarch
rubygem-imagefactory-console-0.4.0-1.el6.noarch
aeolus-configure-2.5.0-17.el6.noarch
aeolus-conductor-daemons-0.8.0-40.el6.noarch
oz-0.8.0-5.el6.noarch
aeolus-all-0.8.0-40.el6.noarch
imagefactory-1.0.0rc8-1.el6.noarch
rubygem-aeolus-image-0.3.0-12.el6.noarch


How reproducible:
always

Steps to Reproduce:
1. have some content in /var/lib/iwhd /var/tmp from aeolus
2. run aeolus-cleanup
  
Actual results:
aeolus-cleanup doesn't clean up /var/tmp and /var/lib/iwhd/*

Expected results:
It cleans up /var/lib/iwhd directory and /var/tmp content

Additional info:
it looks like a regression. see: https://bugzilla.redhat.com/show_bug.cgi?id=693514

Comment 1 Scott Seago 2012-03-07 00:55:58 UTC
Hmm. It's not supposed to remove /var/lib/iwhd/* though -- the directories should remain there. So the regular files under /var/lib/iwhd should be removed, but the top level dirs (i.e. /var/lib/iwhd/images, etc) should not be deleted -- otherwise  object creation in iwhd starts failing.

Comment 2 Martin Kočí 2012-03-07 08:59:36 UTC
(In reply to comment #1)
> Hmm. It's not supposed to remove /var/lib/iwhd/* though -- the directories
> should remain there. So the regular files under /var/lib/iwhd should be
> removed, but the top level dirs (i.e. /var/lib/iwhd/images, etc) should not be
> deleted -- otherwise  object creation in iwhd starts failing.

OK, in any case the regular files under /var/lib/iwhd are not removed in this version. In previous version directories /var/lib/iwhd/* were removed though. Moreover if you do fresh install of aeolus-all then directory /var/lib/iwhd is empty so I assume that these dirs (/var/lib/iwhd/images) will be created when needed.

Comment 3 Pete Zaitcev 2012-03-07 16:18:21 UTC
I do not know what the aeolus-cleanup script is supposed to accomplish,
but I advise against going around iwhd's back and into the store
with just one practical exception: blowing everything away. The biggest
issue is the consistency. If you 1. remove Mongo DB, 2. remove /var/lib/iwhd/*,
then you reset everything to post-install state and there is no problem
with consistency. Otherwise, something will break eventually and I cannot
help it.

Comment 4 Mike Orazi 2012-03-07 16:28:03 UTC
I believe based on a late night debug session with Richard Su and Pete that the present behavior is correct (and aeolus-cleanup only cleans up via the iwhd rest api to boot).  In addition to Pete's confirmation above, I'd like to get Richard to confirm present behavior and mark this as NOT_A_BUG.

Bonus points if we are able to dig up the original BZ that caused us to stop removing those directories.

Comment 5 Martin Kočí 2012-03-07 16:47:20 UTC
My 2 cents: This can lead to filling up the filesystem. Like the database, these directories should be purged of the data as it is ultimately orphaned with a purge of the database. I assume aeolus-cleanup purifies the db.

Comment 6 Richard Su 2012-03-08 05:45:42 UTC
Currently, aeolus-cleanup removes the objects in iwhd and mongodb except buckets. There isn't a mechanism to remove the buckets at the moment. Because each bucket corresponds to a subdirectory under /var/lib/iwhd, purging /var/lib/iwhd will cause iwhd to get into an inconsistent state. This was causing another bug: https://bugzilla.redhat.com/show_bug.cgi?id=788397 And this is the reason we disabled purging of /var/lib/iwhd.

For after 1.0, we'd like to have iwhd creates its own database in mongodb. This will allow us to drop the database and to purge /var/lib/iwhd without repercussions. Martin Taylor has also found a way to remove the buckets from mongodb through the mongo utility. That's also something to consider after 1.0.

For /var/tmp. I see deltacloud has written some files that can be cleaned up. I just need to confirm with mfojtik that is something we want to do. lutter mentioned that these temporary files are actually being relocated to /var/lib in another BZ.

cc'ing mfojtik to get his opinion on this matter.

Comment 7 Scott Seago 2012-03-08 17:08:20 UTC
I think the main issue I ran into was removing the bucket subdirectories. If we purge the files under them but _not_ the subdirectories themselves we won't have filesystem filling-up issues. However, are there other reasons that removing the data files as part of cleanup would cause inconsistency issues (assuming the subdirs are retained?)

Comment 8 Pete Zaitcev 2012-03-08 17:25:35 UTC
It's all kinds of insane that we do not implement deletion of buckets,
at least when they're empty. It needs to be done. Let's file a new RedMine
task or whatever.

Comment 9 Michal Fojtik 2012-03-09 14:30:58 UTC
We have special rake task in Deltacloud to clean all mock-fixtures copied to /var/tmp over time for given user.

firefly ~/code/core/server $ rake mock:fixtures:clean
rm -rf /var/tmp/deltacloud-mock-mfojtik

This rake task should be part of aeolus-cleanup.

Comment 11 Richard Su 2012-03-10 00:38:26 UTC
(In reply to comment #9)
> We have special rake task in Deltacloud to clean all mock-fixtures copied to
> /var/tmp over time for given user.
> 
> firefly ~/code/core/server $ rake mock:fixtures:clean
> rm -rf /var/tmp/deltacloud-mock-mfojtik
> 
> This rake task should be part of aeolus-cleanup.

Michal,

I don't see the Rakefile in the deltacloud-core rpm distribution. Does the task do anything additional than the rm -rf command?

Comment 12 Richard Su 2012-03-14 01:02:17 UTC
Pushed to aeolus-configure
commit 6f936542dc3373587f4be9b358114efd2564abba

Comment 16 Giulio Fidente 2012-09-25 16:54:51 UTC
cleanup is working fine with aeolus-configure-2.8.7-1.el6cf , the actual results are:

[root@qeblade22 ~]# find /var/tmp/
/var/tmp/
[root@qeblade22 ~]# find /var/lib/iwhd/
/var/lib/iwhd/
/var/lib/iwhd/templates
/var/lib/iwhd/icicles
/var/lib/iwhd/images
/var/lib/iwhd/target_images
/var/lib/iwhd/builds
/var/lib/iwhd/provider_images

Comment 19 errata-xmlrpc 2012-12-04 14:57:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2012-1516.html