Bug 802682

Summary: Temporary files left in /var/lib/libvirt/boot when using --location
Product: Red Hat Enterprise Linux 6 Reporter: Marian Csontos <mcsontos>
Component: python-virtinstAssignee: Cole Robinson <crobinso>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: dallan, jwu, mzhan, rwu, yupzhang, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-08 23:17:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
debug info of installing one guest
none
debug info of installing rheldemo
none
kickstart file none

Description Marian Csontos 2012-03-13 09:38:34 UTC
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):
python-virtinst-0.600.0-5.el6.noarch

How reproducible:
100%

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 06:57:31 UTC
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:
python-virtinst-0.600.0-7.el6.noarch
libvirt-0.9.10-5.el6.x86_64
virt-viewer-0.5.1-1.el6.x86_64
# 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 07:00:17 UTC
Created attachment 570509 [details]
debug info of installing one guest

Comment 4 Marian Csontos 2012-03-20 14:56:22 UTC
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=http://192.168.122.1/clusternode.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-23 03:25:39 UTC
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=http://10.66.6.23/rhel6u3-x86_64.cfg --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...
        /dev/dm-1
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-23 03:30:59 UTC
Created attachment 572137 [details]
debug info of installing rheldemo

Comment 7 Daisy Wu 2012-03-23 03:33:39 UTC
Created attachment 572139 [details]
kickstart file

Comment 9 Marian Csontos 2012-05-29 13:35:30 UTC
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 23:17:29 UTC
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.