[virt-tools-list] how to reboot virtual machine / guest OS??

Phil Meyer pmeyer at themeyerfarm.com
Wed Nov 10 15:41:50 UTC 2010


On 11/10/2010 07:22 AM, Santanu Das wrote:
> Hi there,
>
> How can I reboot the virtual guest after creating it? I'm gonna use 
> PXE/Kickstart method to install the OS, os a reboot is needed for the 
> PXE to pick up the information. I I try to reboot the virtual machine 
> from the virt-manager interface, I get this error:
>
>     Error shutting down domain: this function is not supported by the hypervisor: virDomainReboot
>
>     Traceback (most recent call last):
>        File "/usr/share/virt-manager/virtManager/engine.py", line 531, in reboot_domain
>          vm.reboot()
>        File "/usr/share/virt-manager/virtManager/domain.py", line 565, in reboot
>          self.vm.reboot(0)
>        File "/usr/lib64/python2.4/site-packages/libvirt.py", line 392, in reboot
>          if ret == -1: raise libvirtError ('virDomainReboot() failed', dom=self)
>     libvirtError: this function is not supported by the hypervisor: virDomainReboot
>
>        
>
> So, is it not possible?

Not really possible from libvirt.

Please consider that there is not, and has never been, a reboot button 
on any intel based hardware I have ever seen.  There is no reboot method 
described by the ATX motherboard (nor any others that I am aware of) nor 
does (or can) APIC.

There is no way for libvirt to send a 'reboot' to a VM that could 
possibly be reliable since there is no hardware support for it.

Also consider that Windows (XP, 2k3) does not even respond to the 
APIC/ATX 'power' button press unless a user is logged in.  Windows 2k8r2 
does see the signal, but ignores it unless a user is logged in, or 
unless a second press is received within a few seconds.

Therefore, there cannot be a reliable way for libvirt to gracefully 
shutdown a VM.

However, virsh destroy is reasonably reliable as it simply kills the VM 
process on the host.  But this is obviously not a recommended way of 
shutting down systems.

VM users need to be responsible for 'rebooting' their systems, or you 
need to force a user login on Widows VMs (not recommended)

A great deal of work has gone into the libvirt tools such as 
virt-install to allow reboots during installs.  There are many 
'definitions' for various flavors of operating systems that describe to 
virt-install how to handle things.  For instance:  Windows 2k8r2 needs 
TWO reboots to complete the install.  Thus, you must pass 
--os-type=win2k8 to virt-install so it knows to allow that.

The discussion of libvirt reboots is not over, but for now, its not 
really possible.

Good Luck!




More information about the virt-tools-list mailing list