[libvirt] How do I import an old VM image to a new Install

First, I am a casual VM user. I have been using Fedora Core 7 on my Dell laptop for a couple of years with a single QEMU/KVM guest running Windoze XP. I recently installed Fedora 12 on a new hard disk and would like to use my old Windows VM image on the new install. Is there an easy way to do this? I tried copying the image itself (WindozeXpDisk.raw) to the new install and then (naively) looked for an import on the Virtual Machine Manager GUI. The closest that I found was the File->Restore saved machine. I tried that on my WindozeXpDisk.raw image and it failed as follows: Traceback (most recent call last): File "/usr/share/virt-manager/virtManager/manager.py", line 461, in restore_saved_callback newconn.restore(file_to_load) File "/usr/share/virt-manager/virtManager/connection.py", line 649, in restore self.vmm.restore(frm) File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1420, in restore if ret == -1: raise libvirtError ('virDomainRestore() failed', conn=self) libvirtError: operation failed: image magic is incorrect I *can* mount the image using kpartx et. al like this; sudo kpartx -av /var/virt/WindozeXpDisk.raw add map loop1p1 (253:2): 0 31101777 linear /dev/loop1 63 sudo mount -t ntfs /dev/mapper/loop0p1 ./mnt Any clues would be helpful. thank you, mike

On 11/25/2009 11:36 AM, Michael N. Moran wrote:
First, I am a casual VM user. I have been using Fedora Core 7 on my Dell laptop for a couple of years with a single QEMU/KVM guest running Windoze XP.
I recently installed Fedora 12 on a new hard disk and would like to use my old Windows VM image on the new install.
Is there an easy way to do this?
I tried copying the image itself (WindozeXpDisk.raw) to the new install and then (naively) looked for an import on the Virtual Machine Manager GUI. The closest that I found was the File->Restore saved machine. I tried that on my WindozeXpDisk.raw image and it failed as follows:
Traceback (most recent call last): File "/usr/share/virt-manager/virtManager/manager.py", line 461, in restore_saved_callback newconn.restore(file_to_load) File "/usr/share/virt-manager/virtManager/connection.py", line 649, in restore self.vmm.restore(frm) File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1420, in restore if ret == -1: raise libvirtError ('virDomainRestore() failed', conn=self) libvirtError: operation failed: image magic is incorrect
Restore isn't what you want here, and though the above error sounds scary it is actually correct. Restore starts a VM that was previously 'saved', which is kind of like suspend to ram on a physical machine. You should be able to use virt-install --import to get what you want, something like virt-install --name foo --ram 1024 --os-variant winxp --import --disk path=/path/to/your/disk/image ... - Cole

On 11/25/2009 12:53 PM, Cole Robinson wrote:
On 11/25/2009 11:36 AM, Michael N. Moran wrote:
First, I am a casual VM user. I have been using Fedora Core 7 on my Dell laptop for a couple of years with a single QEMU/KVM guest running Windoze XP.
I recently installed Fedora 12 on a new hard disk and would like to use my old Windows VM image on the new install.
Is there an easy way to do this?
libvirtError: operation failed: image magic is incorrect
Restore isn't what you want here, and though the above error sounds scary it is actually correct. Restore starts a VM that was previously 'saved', which is kind of like suspend to ram on a physical machine.
You should be able to use virt-install --import to get what you want, something like
virt-install --name foo --ram 1024 --os-variant winxp --import --disk path=/path/to/your/disk/image ...
Thanks Cole, that's what I was looking for. I used the following line: virt-install --name WindozeXP --ram 512 --os-variant winxp \ --import --disk path=/var/virt/WindozeXpDisk.raw Virt Viewer came up and the XP boot screen was shown for about a minute and then the I experienced a BSOD with an UNMOUNTABLE_BOOT_VOLUME error. I assume that the problem is that I need to specify a VM that has the same virtual hardware characteristics as my previous environment. I suppose that can be gleaned from /etc/libvirt/qemu/WindozeXP.xml or similar. I've attached that old WindozeXP.xml file in an attempt to be complete. If there is an easy way to import that information or if I'm on the wrong track, please let me know.

On 11/25/2009 01:27 PM, Michael N. Moran wrote:
On 11/25/2009 12:53 PM, Cole Robinson wrote:
On 11/25/2009 11:36 AM, Michael N. Moran wrote:
First, I am a casual VM user. I have been using Fedora Core 7 on my Dell laptop for a couple of years with a single QEMU/KVM guest running Windoze XP.
I recently installed Fedora 12 on a new hard disk and would like to use my old Windows VM image on the new install.
Is there an easy way to do this?
libvirtError: operation failed: image magic is incorrect
Restore isn't what you want here, and though the above error sounds scary it is actually correct. Restore starts a VM that was previously 'saved', which is kind of like suspend to ram on a physical machine.
You should be able to use virt-install --import to get what you want, something like
virt-install --name foo --ram 1024 --os-variant winxp --import --disk path=/path/to/your/disk/image ...
Thanks Cole, that's what I was looking for. I used the following line:
virt-install --name WindozeXP --ram 512 --os-variant winxp \ --import --disk path=/var/virt/WindozeXpDisk.raw
Virt Viewer came up and the XP boot screen was shown for about a minute and then the I experienced a BSOD with an UNMOUNTABLE_BOOT_VOLUME error.
I assume that the problem is that I need to specify a VM that has the same virtual hardware characteristics as my previous environment. I suppose that can be gleaned from /etc/libvirt/qemu/WindozeXP.xml or similar.
I've attached that old WindozeXP.xml file in an attempt to be complete.
If there is an easy way to import that information or if I'm on the wrong track, please let me know.
You can use 'virsh edit <vmname>' on the new VM and try to make it match the old XML as best as possible. A few things to try: - Sync the mac addresses - Add <model type='rtl8139'/> to the <interface> block - Make sure acpi + apic, memory, vcpu settings are the same It could also be that the jump from f7 to f12 is just too drastic, and behavior has changed enough at the qemu/kvm level to upset the guest. Not really sure though. - Cole
participants (2)
-
Cole Robinson
-
Michael N. Moran