Sam Varshavchik
2017-Jul-30 01:08 UTC
[libvirt-users] Changing <on_reboot> in the domain XML file
Using virsh edit, I made the following change to the domain XML file: <on_reboot>destroy</on_reboot> But this appears to do nothing. The VM guest is Windows 10, and when directing it to reboot, it still reboots, instead of shutting off the VM. I was trying to work around some kind of a bug, somewhere, that started happening after updating to Fedora 26 and qemu 2.9, where a reboot throws my Windows 10 guests into some kind of a bizarre automatic recovery mode, which then claims that the hard drive is hosed. It's not, and a forced shutdown followed by a cold start boots everything back up like nothing has happened (which I didn't figure out until reinstalling one of the guests, sigh...), and everything is peachy once again. So, anyway, I was trying to figure out a way around it, and <on_reboot>destroy</on-reboot> seemed to be exactly what I was looking for. Perusing qemu's man page, it seems that this option should result in a -no- reboot option getting added to qemu's command line. But, looking at the actual command line, after starting the VM, it's nowhere to be seen. A bit more Google-fu found this: http://blog.vmsplice.net/2011/04/how-to-pass-qemu-command-line-options.html And I manually added a -no-reboot option to the domain XML file that way. And you know what? After doing that, telling Windows 10 to reboot simply shuts off the VM. Wonderful. But that still leaves me wondering: what's up with the <on_reboot> tag? Why didn't it work? Is this a PEBCAK, or something worth throwing a ticket for?
Michal Privoznik
2017-Jul-31 12:58 UTC
Re: [libvirt-users] Changing <on_reboot> in the domain XML file
On 07/30/2017 03:08 AM, Sam Varshavchik wrote:> Using virsh edit, I made the following change to the domain XML file: > > <on_reboot>destroy</on_reboot> > > But this appears to do nothing. The VM guest is Windows 10, and when > directing it to reboot, it still reboots, instead of shutting off the VM. > > I was trying to work around some kind of a bug, somewhere, that started > happening after updating to Fedora 26 and qemu 2.9, where a reboot > throws my Windows 10 guests into some kind of a bizarre automatic > recovery mode, which then claims that the hard drive is hosed. It's not, > and a forced shutdown followed by a cold start boots everything back up > like nothing has happened (which I didn't figure out until reinstalling > one of the guests, sigh...), and everything is peachy once again. > > So, anyway, I was trying to figure out a way around it, and > <on_reboot>destroy</on-reboot> seemed to be exactly what I was looking for. > > Perusing qemu's man page, it seems that this option should result in a > -no-reboot option getting added to qemu's command line. But, looking at > the actual command line, after starting the VM, it's nowhere to be seen. > > A bit more Google-fu found this: > > http://blog.vmsplice.net/2011/04/how-to-pass-qemu-command-line-options.html > > And I manually added a -no-reboot option to the domain XML file that way. > > And you know what? After doing that, telling Windows 10 to reboot simply > shuts off the VM. Wonderful.Libvirt doesn't append -no-reboot because of this commit: libvirt.org/git/?p=libvirt.git;a=commitdiff;h=0e034efaf9 Having said that, I believe libvirt puts -no-shutdown on your command line. Then, libvirt has a handler for various guest events - e.g. when the guest reboots (well, when it calls 'reset'). But when looking at its implementation it looks like there is something missing: http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/qemu/qemu_process.c;h=a11d75b80fb018da777fa013a1c5c0762568ac19;hb=HEAD#l478 Compare it to say SHUTDOWN event: http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/qemu/qemu_process.c;h=a11d75b80fb018da777fa013a1c5c0762568ac19;hb=HEAD#l631 Therefore I think this is a bug. Let me see if I can propose a fix for it. Meanwhile - you can report a bug if you want. Michal
Sam Varshavchik
2017-Jul-31 16:27 UTC
Re: [libvirt-users] Changing <on_reboot> in the domain XML file
Michal Privoznik writes:> Libvirt doesn't append -no-reboot because of this commit: > > libvirt.org/git/?p=libvirt.git;a=commitdiff;h=0e034efaf9 > > Having said that, I believe libvirt puts -no-shutdown on your commandYes, I see that option getting passed in.> line. Then, libvirt has a handler for various guest events - e.g. when > the guest reboots (well, when it calls 'reset'). But when looking at its > implementation it looks like there is something missing:The end result is that left to its own devices, the guest still reboots, with -no-shutdown.> Therefore I think this is a bug. Let me see if I can propose a fix for > it. Meanwhile - you can report a bug if you want.Ok, it's bug 1476866
Apparently Analagous Threads
- Changing <on_reboot> in the domain XML file
- Re: kvm/libvirt on CentOS7 w/Windows 10 Pro guest
- Re: kvm/libvirt on CentOS7 w/Windows 10 Pro guest
- Re: libvirtd segfault when using oVirt 4.1 with graphic console - CentOS7.3
- Re: [libvirt] Quantifying libvirt errors in launching the libguestfs appliance