I have a bit of a problem getting my guests to reboot after the OS installation using virt-install.
For whatever reason, virt-install insists on inserting "--no-reboot" when you create a VM:
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel6.2.0 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -name centos62test -uuid f4938758-98f1-cda3-5ec9-d91d6cc40596 -nodefconfig -nodefaults
-chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/centos62test.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-reboot* -no-shutdown -kernel /var/lib/libvirt/boot/virtinst-vmlinuz.HzY2RZ -initrd
Even though you did not specify --no-reboot:
virt-install --name centos62test --disk path=/home/vms/centos62test,size=50,bus=virtio --vnc --noautoconsole --vcpus=1 --ram=512 --network bridge=virbr0,mac=52:54:00:75:80:12 --location=http://192.168.15.100/mirrors/centos/6.2/os/x86_64/ -x "ks=http://192.168.15.100/mirrors/ks/6.2/kvm/x86_64.cfg"
It seems to be unique a virt-install "problem" because when you create a VM using virt-manager, --no-reboot option does not get inserted.
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel6.2.0 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -name centos62test -uuid f4938758-98f1-cda3-5ec9-d91d6cc40596 -nodefconfig -nodefaults
-chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/centos62test.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -drive file=/home/vms/centos62test,if=none,id=drive-virtio-disk0,format=
And it seems to occur on both CentOS 6.2 (which is the output I put up above this) and Ubuntu 10.04:
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin QEMU_AUDIO_DRV=none /usr/bin/kvm -S -M pc-0.12 -enable-kvm -m 512 -smp 1 -name opensuseks -uuid 05ed4424-08ba-e724-a14f-50b76017609c -chardev socket,id=monitor,path=/v
ar/lib/libvirt/qemu/opensuseks.monitor,server,nowait -monitor chardev:monitor -no-reboot -boot c -kernel /var/lib/libvirt/boot/virtinst-linux.SZsBVy
I am at a bit of a loss here. How do I get virt-install to not add --no-reboot, so that my guests can reboot after the initial OS installation.
If you are using "--noautoconsole" option, you also need to specify "--wait". From virt-install man page:
So, virt-install with "--noautoconsole --wait=-1" options will wait (forever) until guest OS installation process will be completed, and after that the VM will be restarted.
If you don't want to wait for the domain to exit you can add --events on_poweroff=preserve to the virt-install cmdline and it won't add -no-reboot to the qemu cmdline.