Bug 802682 - Temporary files left in /var/lib/libvirt/boot when using --location
Temporary files left in /var/lib/libvirt/boot when using --location
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python-virtinst (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Cole Robinson
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2012-03-13 05:38 EDT by Marian Csontos
Modified: 2012-07-08 19:17 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-07-08 19:17:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
debug info of installing one guest (9.29 KB, text/plain)
2012-03-16 03:00 EDT, Daisy Wu
no flags Details
debug info of installing rheldemo (79.14 KB, text/plain)
2012-03-22 23:30 EDT, Daisy Wu
no flags Details
kickstart file (707 bytes, text/plain)
2012-03-22 23:33 EDT, Daisy Wu
no flags Details

  None (edit)
Description Marian Csontos 2012-03-13 05:38:34 EDT
Description of problem:
kernel+initrd files are always left behind in /var/lib/libvirt/boot when using --location.

Suggesting these files belong to /var/cache instead of /var/lib, and should be removed when install done.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. run virt-install with --location
[optionally repeat many times]
Actual results:
- files are left in /var/lib/*

Expected results:
- no trash left on file system.

Additional info:
Comment 2 Daisy Wu 2012-03-16 02:57:31 EDT
Hi Matian,

   I am the QE in Beijing, I can not reproduce this bug on python-virtinst-0.600.0-7.el6.noarch. The kernel+initrd files are always removed behind in /var/lib/libvirt/boot when install done. Do you have some special setting or related option about this bug? Please give more info to help me reproduce it, thanks a lot.

my env:
# uname -a
Linux daisy.redhat.com 2.6.32-244.el6.x86_64 #1 SMP Tue Feb 28 12:58:47 EST 2012 x86_64 x86_64 x86_64 GNU/Linux

my steps:
1. install guest RHEL6.3 with --location
# virt-install -n rhel6.3 -r 1024 -f /var/lib/libvirt/images/rhel6.3.img -s 5 --location http://download.englab.nay.redhat.com/pub/rhel/nightly/RHEL6.3-20120315.n.0/6.3/Server/x86_64/os/ --debug

2. choose your guest setting follow anaconda until installation done, reboot guest or close the virt-viewer. 

3. repeat step1-2 to create 20 guests from rhel6.3-1,rhel6.3-2...rhel6.3-20.

4. check the debug info when install done of each guest, all the kernel+initrd files are removed behind in /var/lib/libvirt/boot. 
Fri, 16 Mar 2012 02:19:59 DEBUG    Removing /var/lib/libvirt/boot/virtinst-vmlinuz.gBws0x
Fri, 16 Mar 2012 02:19:59 DEBUG    Removing /var/lib/libvirt/boot/virtinst-initrd.img.Qv5_aK

5. #cd /var/lib/libvirt/boot, there is no kernel+initrd files left.
Comment 3 Daisy Wu 2012-03-16 03:00:17 EDT
Created attachment 570509 [details]
debug info of installing one guest
Comment 4 Marian Csontos 2012-03-20 10:56:22 EDT
Still the same with python-virtinst-0.600.0-7.el6.noarch .

Looking at the command line options used likely it is --noreboot what affects us:

Tue, 20 Mar 2012 13:12:10 DEBUG    Launched with command line:^M

> /usr/sbin/virt-install \
>   --name node01 \
>   --ram=1024 \
>   --vcpus=1 \
>   --disk path=/var/lib/libvirt/images/node01.img,size=10,sparse=true,cache=writeback \
>   --disk path=/var/lib/libvirt/images/shared-0001.img,size=6,sparse=true,cache=writethrough,perms=sh,serial=STS-SHARED-0001 \
>   --disk path=/var/lib/libvirt/images/shared-0002.img,size=6,sparse=true,cache=writethrough,perms=sh,serial=STS-SHARED-0002 \
>   --disk path=/var/lib/libvirt/images/shared-0003.img,size=6,sparse=true,cache=writethrough,perms=sh,serial=STS-SHARED-0003 \
>   --disk path=/var/lib/libvirt/images/shared-0004.img,size=6,sparse=true,cache=writethrough,perms=sh,serial=STS-SHARED-0004 \
>   --disk path=/var/lib/libvirt/images/shared-0005.img,size=6,sparse=true,cache=writethrough,perms=sh,serial=STS-SHARED-0005 \
>   --disk path=/var/lib/libvirt/images/shared-0006.img,size=6,sparse=true,cache=writethrough,perms=sh,serial=STS-SHARED-0006 \
>   --disk path=/var/lib/libvirt/images/shared-0007.img,size=6,sparse=true,cache=writethrough,perms=sh,serial=STS-SHARED-0007 \
>   --disk path=/var/lib/libvirt/images/shared-0008.img,size=6,sparse=true,cache=writethrough,perms=sh,serial=STS-SHARED-0008 \
>   --hvm \
>   --debug \
>   --nographics \
>   --accelerate \
>   --os-variant=virtio26 \
>   --noreboot \
>   --location http://download.eng.brq.redhat.com/pub/rhel/rel-eng/RHEL6.3-20120313.2/6.3/Server/x86_64/os \
>   -x console=ttyS0,115200 ks=^M

After installation it is just going on without any clean-up:

> waiting for mdraid sets to become clean...^M
> rebooting system^M
> Restarting system.^M

And next commands in caller script are executed now...
Comment 5 Daisy Wu 2012-03-22 23:25:39 EDT
Hi Matian,

   Thanks for your comment. I have retried it many times according to your steps, but still can not reproduce. I will upload my log and kickstart file. I think if you can upload your log and kickstart file will be better.

My steps:
Thu, 22 Mar 2012 22:41:47 DEBUG    Launched with command line:
/usr/sbin/virt-install -n rheldemo -r 1024 --disk path=/var/lib/libvirt/images/rheldemo.img,size=5,sparse=true,cache=writeback --disk path=/var/lib/libvirt/images/shared-0001.img,size=2,sparse=true,cache=writethrough,perms=sh,serial=STS-SHARED-0001 -l http://download.englab.nay.redhat.com/pub/rhel/nightly/RHEL6.3-20120315.n.0/6.3/Server/x86_64/os/ --nographics --noreboot -x console=ttyS0,115200 ks= --debug

After installation, all the kernel+initrd files are removed behind in /var/lib/libvirt/boot.
The end of the log just like:
Packages completed: 406 of 406
Performing post-installation configuration
Installing bootloader.
terminating anaconda...done
sending termination signals...done
sending kill signals...done
disabling swap...
unmounting filesystems...
        /mnt/runtime done
        disabling /dev/loop0
        /dev/pts done
        /selinux done
        /mnt/sysimage/boot done
        /mnt/sysimage/dev/pts done
        /mnt/sysimage/dev/shm done
        /mnt/sysimage/dev done
        /mnt/sysimage/proc/bus/usb done
        /mnt/sysimage/proc done
        /mnt/sysimage/sys done
        /mnt/sysimage/selinux done
        /mnt/sysimage done
waiting for mdraid sets to become clean...
rebooting system
Restarting system.

Thu, 22 Mar 2012 22:50:16 DEBUG    Removing /var/lib/libvirt/boot/virtinst-vmlinuz.4Pq4aG
Thu, 22 Mar 2012 22:50:16 DEBUG    Removing /var/lib/libvirt/boot/virtinst-initrd.img.1RFgUX
Domain creation completed. You can restart your domain by running:
  virsh --connect qemu:///system start rheldemo
Comment 6 Daisy Wu 2012-03-22 23:30:59 EDT
Created attachment 572137 [details]
debug info of installing rheldemo
Comment 7 Daisy Wu 2012-03-22 23:33:39 EDT
Created attachment 572139 [details]
kickstart file
Comment 9 Marian Csontos 2012-05-29 09:35:30 EDT
After some experiments, this is likely caused by third party script where virt-install is running inside except script, which exits before virt-install once the installation is complete and sending SIGHUP to virt-install.

Is virt-install handling SIGHUP? And shall it do so?

Also I was unable to reporoduce without the except wrapper.
Comment 11 Cole Robinson 2012-07-08 19:17:29 EDT
I don't think virt-install should handle SIGHUP, when we get SIGHUP we should exit immediately as apps are expected.

What you want to do here is add the option --wait -1 to virt-install, so that it only exits when the guest install has completed. You really need to wait for virt-install to complete so that you know it took care of everything. Either that or find a way to decouple it from the expect script, so expect can exit but virt-install keeps running.

Note You need to log in before you can comment on or make changes to this bug.