Ovirt 4.2.x Backup/Restore/Migrate

Migrate Citrix 7.2 Xen VM to oVIRT 4.2 VM (vhd to qcow2)

1227 views March 31, 2018 September 21, 2018 zipadmin 0

I would recommend using oVirt Simple Backup for this as it is the quickest way to migrate from XENSERVER to oVIRT.

Here is the process I found to work when migrating VMs from Citrix 7.2 Xen (ovf/ova) over to oVirt 4.2 (qcow2)

Note: My VMs are all Debian OS, so with other VM types you will likely run into some issues that I have not covered below.

 

You will require the following ISO image for this:

 

You will also want to make sure that you are physically connected to your XEN/oVIRT environments with the best connection possible as import/export will be done using your workstation computer.

 

On XenServer

  • shutdown VM that you will be migrating
  • export the VM using XenCenter as a ova/ovf package
    • DONT CHECK “Create OVA Package”
    • DONT CHECK “Compress OVA files”
  • Once done, you will get a folder with 1 or more vhd files in it.
  • For EACH vhd, do the following:
    • Upload the vhd file to a storage domain on oVIRT with lots of space
    • ssh into one of your oVirt hosts and run
      qemu-image convert -O qcow2 input.vhd /path/to/your/storage/output.qcow2

       

    • once complete, download the qcow2 file to your computer

In oVirt WebGUI

  • Make sure you have a working oVirtWebGUI Proxy – (Tutorial)
  • WebGUI – Storage – Disks – Upload
    • Choose file – qcow2 file you downloaded above
    • Size – full size of Disk from VM from Xen (Not Actual File Size)
    • Alias – call it what you will (example: VM1Disk)
    • Select your final target for the storage, disk, host, etc.
    • Click OK to upload
  • After the file is fully uploaded and the disk is created
    • Compute – Machines – New
      • Attach new Image (bootable/os) – select your image that you uploaded
      • System – select memory, CPUs, NICs, etc to suit
      • Boot Options – CD – rescue.iso (http://www.system-rescue-cd.org/Download/)
      • Boot VM and use CONSOLE to configure
        • choose either rescue64 or rescue32
        • choose first option (default)
        • once at command line:
          fsarchiver probe simple #(to retrieve your partition list)
          mkdir /mnt/linux
          mount /dev/vda1 /mnt/linux
          mount -o bind /proc /mnt/linux/proc
          mount -o bind /dev /mnt/linux/dev
          mount -o bind /sys /mnt/linux/sys
          chroot /mnt/linux /bin/bash
          vi /etc/default/grub #change "console=hvc0" to ""
          update-grub
          update-initramfs -u
          grub-install /dev/vda
          exit
          umount /mnt/linux/dev/
          umount /mnt/linux/proc/
          umount /mnt/linux/sys/
          umount /mnt/linux/
          shutdown 0 -h

           

  • remove CD from VM
  • start VM
  • On command line of VM enter:
    apt-get remove xe-guest-utilities
    apt-get install ovirt-guest-agent
    shutdown 0 -h

     

In oVirt WebGUI

  • Navigate to the VM -> Disks
    • Make sure the VM is Not Running
    • Click your main disk
    • Scan Alignment
      • If Alignment is okay, then all should be good
      • If Alignment is Misaligned, then do the following:
        • Boot the VM to the command line
          • using fdisk, delete the partition for your swap
          • using fdisk, create a new primary partition for your swap
          • using fdisk, “type” the new partition to 82
          • using fdisk, write the changes and then reboot the VM
        • After reboot to the command line
          mkswap /dev/sdXX #(example: mkswap /dev/vda2)
          swapon /dev/sdXX
          vi /etc/fstab  #change the UUID for SWAP to the new UUID for /dev/vda2)
          free -m #(should show active swap)
          reboot

           

 

Was this helpful?