Importing KVM guests to oVirt or RHEV

One of the tools I maintain is virt-v2v. It’s a program to import guests from foreign hypervisors like VMware and Xen, to KVM. It only does conversions to KVM, not the other way. And a feature I intentionally removed in RHEL 7 was importing KVM → KVM.

Why would you want to “import” KVM → KVM? Well, no reason actually. In fact it’s one of those really bad ideas for V2V. However it used to have a useful purpose: oVirt/RHEV can’t import a plain disk image, but virt-v2v knows how to import things to oVirt, so people used virt-v2v as backdoor for this missing feature.

Removing this virt-v2v feature has caused a lot of moaning, but I’m adamant it’s a very bad idea to use virt-v2v as a way to import disk images. Virt-v2v does all sorts of complex filesystem and Windows Registry manipulations, which you don’t want and don’t need if your guest already runs on KVM. Worst case, you could even end up breaking your guest.

However I have now written a replacement script that does the job:

If your guest is a disk image that already runs on KVM, then you can use this script to import the guest. You’ll need to clone the git repo, read the README file, and then read the tool’s man page. It’s pretty straightforward.

There are a few shortcomings with this script to be aware of:

  1. The guest must have virtio drivers installed already, and must be able to boot off virtio-blk (default) or virtio-scsi. For virtio-scsi, you’ll need to flip the checkbox in the ‘Advanced’ section of the guest parameters in the oVirt UI.
  2. It should be possible to import guests that don’t have virtio drivers installed, but can use IDE. This is a missing feature (patches welcome).
  3. No network card is added to the guest, so it probably won’t have network when it boots. It should be possible to add a network card through the UI, but really this is something that needs to be fixed in the script (patches welcome).
  4. It doesn’t handle all the random packaging formats that guests come in, like OVA. You’ll have to extract these first and import just the disk image.
  5. It’s not in any way supported or endorsed by Red Hat.


Filed under Uncategorized

6 responses to “Importing KVM guests to oVirt or RHEV

  1. Adrian

    When attempting to use this tool from a CentOS7.1 host I get:

    libvirt needs authentication to connect to libvirt URI qemu:///system
    libvirt: XML-RPC error : authentication failed: authentication failed
    could not connect to libvirt (URI = qemu:///system): authentication failed: authentication failed at ./ line 230.

    It doesn’t matter what credentials I use. Can you shed any light on what exactly this is looking for?

      • Adrian

        I’ve figured this out. The code below worked:
        LIBGUESTFS_BACKEND=direct ./ /opt/images/mu_import_image.img 10.1.X.X:/mnt/my_pool/ovirt_vm_exports
        For whatever reason, not setting the “direct” variable prompted me to provide credentials to log in to libvirt when using this script. Even after applying the correct credentials (thanks Ovirt Users list!) the process would fail with a different error afterward.

        The import worked as expected after setting the backend=direct variable. Thanks!

  2. Pingback: How to import qcow2 images to ovirt | gfnork

  3. We migrated CentOS 6.x VM from KVM/QEMU to oVirt.
    Two problems we encountered.
    The old KVM, we used serial console, the linux boot command line had console=ttyS0,115200n8 … removed this parameter so the SPICE/KVM console is available.

    Two disks on old VM, one is /dev/vda, second is /dev/sdb.
    Once imported to oVirt, booted single user, edit /etc/fstab to make /dev/sdb be /dev/vdb.
    Reboot, all good.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s