[virt-tools-list] Scripting virt-install to automate image building
Cole Robinson
crobinso at redhat.com
Mon Jan 20 14:45:28 UTC 2014
On 01/19/2014 05:05 PM, Anthony Shortland wrote:
> Hi Cole,
>
> Thanks for the suggestions. Here's where I'm at now:
>
> [root at oel63-virt tmp]# virt-install --name=minimal --ram=512 --vcpus=1
> --accelerate --hvm --network network:default
> --disk=/var/lib/libvirt/images/minimal.img,size=3
> --location=http://192.168.122.1/OracleLinux-R6-U3-Server-x86_64-dvd --graphics=none
> --noautoconsole --wait=-1 --serial=file,path=/tmp/minimal.log
> '--extra-args=ks=http://192.168.122.1/kickstart/minimal-ks.cfg console=ttyS0'
>
> Starting install...
> Retrieving file .treeinfo...
> |
> 3.0 kB 00:00 <x-apple-data-detectors://5> ...
> Retrieving file vmlinuz...
> |
> 7.6 MB 00:00 <x-apple-data-detectors://7> ...
> Retrieving file initrd.img...
> |
> 58 MB 00:00 <x-apple-data-detectors://8> ...
> Allocating 'minimal.img'
> |
> 3.0 GB 00:00 <x-apple-data-detectors://10>
> Creating domain...
> |
> 0 B 00:00 <x-apple-data-detectors://11>
> Domain installation still in progress. Waiting for installation to complete.
>
> ... I added "--serial=file,..." in order to log in the install, which ends as
> follows:
>
> .
> ,
> .
> 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...
> halting system
> System halted.
>
> ... the new Linux system is halted since I included the "shutdown"
> (http://fedoraproject.org/wiki/Anaconda/Kickstart#shutdown) option in the
> Kickstart file, but virt-install still does not exit.
>
> What event signals completion of domain installation? How can it be triggered
> from within the guest (which has the thread of execution with Kickstart)? Or
> do I need to wrap all this in a script, set wait=0, track the logged output
> and use some sort of virsh command to signal domain installation completion?
>
Maybe it's some halt vs poweroff issue? Not sure.
https://stackoverflow.com/questions/15460754/halt-and-poweroff
Try sticking a 'shutdown' at the end of your kickstart?
Whatever the issue is, it's unlikely a virt-install or libvirt issue, since
they aren't in play if the VM tries to shut itself down.
Watching the serial output was only a suggestion if you can't get the VM to
shutdown on its own, typically that shouldn't be required.
- Cole
More information about the virt-tools-list
mailing list