[virt-tools-list] Scripting virt-install to automate image building

Cole Robinson crobinso at redhat.com
Sun Jan 19 13:32:19 UTC 2014


On 01/19/2014 02:59 AM, Anthony Shortland wrote:
> We're running version 0.600.0 of virt-install with version 0.10.2 of libvert and version 0.12.1.2 of qemu-kvm on RHEL 6.3.
> 
> We're trying to script an automated image build process and want virt-install to exit when Kickstart completes and halts the guest virtual machine (using the "shutdown" option).
> 
> The thing is that virt-install hangs indefinitely staying connected to the text console (on ttyS0 with --graphics=none) and only exits on timeout if the --wait option is specified.
> 
> Is there any way virt-install can simply wait for the Kickstart to complete and halt the guest and then exit gracefully? 
> 

That's what it should be doing already: when anaconda finishes, it runs
'shutdown' in the guest. My guess is that the shutdown request isn't working here.

Also, if you are doing an automated kickstart install, you don't necessarily
need to connect to the serial console: virt-install --noautoconsole --wait -1
will do that.

Though a crazier option: if you can't find out why the guest OS isn't shutting
down properly, you could wrap virt-install with a shell script, watch the
output on the serial console, and when you see some string like 'requesting
shutdown' or whatever anaconda/init prints, do 'virsh destroy $vmname'

- Cole




More information about the virt-tools-list mailing list