Andre Goree
2015-Feb-09 20:24 UTC
[libvirt-users] Possible to change 'machine type' attribute while vm is running?
Hello. I'd like to determine if it's possible to change the 'machine type' attribute while a vm is running. For example, I have: <os> <type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type> <boot dev='hd'/> </os> I'd like to change that to "machine='pc-i440fx-1.7'" due to an error[1] I'm seeing while migrated similar images to another host. The only way I've been able to change the machine is by first shutting down the vm, making the change, then starting the vm back up. I'd like to avoid that if at all possible. I did find the tool "libvirt-migrate-qemu-machinetype", but it doesn't seem to do what I think it's intended to do -- i.e., it does NOT change the machine type, even after reboot. Perhaps I'm just using it wrong? I performed the following: root:~# libvirt-migrate-qemu-machinetype -t pc-i440fx-1.7 <domain> Waiting up to 10 seconds for libvirtd to start... Waiting up to 30 seconds for libvirtd to respond to requests... Checking domains defined in /etc/libvirt/qemu... Migration complete But the machine type remains the same after the above command has been run. Thanks in advance for any insight you can provide. [1] - error: internal error: process exited while connecting to monitor: Supported machines are: -- Andre Goree -=-=-=-=-=- Email - andre at drenet.net Website - http://www.drenet.net PGP key - http://www.drenet.net/pubkey.txt -=-=-=-=-=-
Eric Blake
2015-Feb-09 21:41 UTC
Re: [libvirt-users] Possible to change 'machine type' attribute while vm is running?
On 02/09/2015 01:24 PM, Andre Goree wrote:> Hello. I'd like to determine if it's possible to change the 'machine > type' attribute while a vm is running.In general, no, because it would be a guest-visible change, and guests don't react well to hardware ABI changing in the middle of a running system.> > For example, I have: > > <os> > <type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type> > <boot dev='hd'/> > </os> > > I'd like to change that to "machine='pc-i440fx-1.7'" due to an error[1] > I'm seeing while migrated similar images to another host. > > The only way I've been able to change the machine is by first shutting > down the vm, making the change, then starting the vm back up. I'd like > to avoid that if at all possible.Sadly, I think a shutdown is the only working approach. Specifying a different machine type tells qemu to present different hardware to the guest, which really only works on fresh guest boots (and even then, Windows guests tend to want revalidation of the license key). On the rare case that the different spellings of the machine type do NOT change the hardware, it might be possible to take a saved guest image, edit that file to swap out the machine type, and then restore from the saved image; at least that way you won't lose guest state and the downtime can be shorter than a full reboot cycle. But I'm not familiar enough with pc-i440fx-trusty vs. pc-i440fx-1.7 (both are downstream-only machine names from Debian, not in upstream qemu) to know if that is the case.> > I did find the tool "libvirt-migrate-qemu-machinetype", but it doesn't > seem to do what I think it's intended to do -- i.e., it does NOT change > the machine type, even after reboot. Perhaps I'm just using it wrong?That tool is not provided by upstream; maybe it is a downstream Debian tool? And from the name, that may indeed be the tool that does what you want? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org