X

A Bridge to the Cloud...

How to Migrate Oracle VM to Oracle Linux KVM

Simon Coter
Senior Manager, Oracle Linux and Virtualization Product Management

Introduction

Target of this document it to automate the migration from other hypeviror solutions to Oracle Linux KVM managed by Oracle Linux Virtualization Manager.

The document actually covers the semi-automated migration process from:

  • Oracle VM 3.4

Screen Shot 2020-04-07 at 11.53.40 AM.png

Migration from Oracle VM 3.4

The semi-automated migration procedure relies on following components:

  • libvirt, qemu and virt-v2v correctly installed and configured on KVM host
  • Network access (ssh or https) to Oracle VM Server(s)

Requirements and Assumptions

  • Oracle VM Server (source) and KVM/OLVM (destination) hosts are network reachable each other
  • Oracle VM Server is based on 3.4 release
    • Older releases could work but the same had never been tested
  • OLVM/VDSM releases are >= 4.3
    • ovirt-engine-4.3.6.6-1.0.9 RPM or higher is installed on the Oracle Linux Virtualization Manager Server
    • vdsm-4.30.33-1.0.3 RPM or higher is installed on the Oracle Linux KVM Server
  • virt-v2v1.40.2-5.0.1 or higher is installed on the Oracle Linux KVM Server
  • At least one KVM host and a Storage Domain have already been configured on OLVM and are up and running
    • Fiber Channel / iSCSI storage domains are not suitable for direct VM import/migration
    • Local on Host, Posix-Compliant FS and NFS are suitable options for direct VM import/migration
    • Once imported VMs can be migrated to further storage domain options, like Fiber Channel / iSCSI
  • This procedure works for OVM Virtual Machines that are configured with virtual disks only.

Setup

With proper OLVM/OL-KVM setup up&running proceed with following steps:

·       Install "qemu-block-curl" RPM on the desired OL-KVM Server (the server where the migration will be managed/executed)

# yum install oraclelinux-developer-release-el7 yum-utils -y

# yum-config-manager --enable ol7_developer_kvm_utils

# yum install qemu-block-curl

NB: the only RPM that has to be installed from "ol7_developer_kvm_utils" Yum channel is "qemu-block-curl"

So, to keep the entire system supported, other packages do not have to be updated from "ol7_developer_kvm_utils" Yum channel.

To accomplish this requirement, execute following steps:

  • ·       Edit "/etc/yum.repos.d/oraclelinux-developer-ol7.repo" and add following line:

[ol7_developer_kvm_utils]

name=Oracle Linux $releasever KVM Utilities for Development and test ($basearch)

baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/developer/kvm/utils/$basearch/

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle

gpgcheck=1

enabled=1

includepkgs=qemu-block-curl*

 

Prepare an OVM/Xen host (dom0)

  • Edit "xend" configuration to enable http listening port (8000)

# vi /etc/xen/xend-config.sxp  ## Uncomment specified lines

(xend-http-server yes)

(xend-unix-path /var/lib/xend/xend-socket)

(xend-port 8000)

 

  • Restart “xend” service on OVM Server

# service xend restart

 

  • Start and enable "libvirtd" service on OVM/Xen host

# service libvirtd start

# service libvirtd enable

 

Test connectivity to OVM/Xen Host from KVM host

  • From KVM host run

# virsh -c xen+ssh://root@<ovm-host> list --all

 

Get OL-KVM VDSM daemon self-authenticated to Xen/OVM host

# sudo -u vdsm ssh-keygen

# sudo -u vdsm ssh-copy-id root@<ovm-host>

# sudo -u vdsm ssh root@<ovm-host>

 

Copy the "Oracle Linux Virtualization Manager" certificate on the KVM host

  • On KVM host we need the OLVM certificate, required to get access to the OLVM web-server during the migration process; the same can be easily copied with the following command on KVM host

# scp root@<OLVM-FQDN>:/etc/pki/ovirt-engine/ca.pem /root/ca.pem

 

Create a "Passord File" for KVM-host access to "Oracle Linux Virtualization Manager" API

  • On KVM host we need the OLVM password to access as "admin" to "Oracle Linux Virtualization Manager". This file can be created with following command/step

# echo "Welcome1" > /tmp/ovirt-admin-password

 

Create "Repository Export" for all OVM Repositories involved on the migration (required for FC/iSCSI/Local repositories) by Oracle VM Manager

NB: if your Oracle VM Virtual Machines reside on NFS Repositories, you just need to mount the same repositories, with the same path, on the Oracle Linux KVM target server.

NB: those steps are required for each OVM Repository involved on the Virtual Machine migration.

Repository Exports allow to get one Oracle VM Repository shared by NFS protocol; if your Oracle VM Server already relies on NFS storage this step is not required.

Here one step-by-step "Repository Export" example:

  • Click on the OVM Server (on the left) and select "Repository Exports" perspective

Screen Shot 2020-04-06 at 3.43.57 PM.png

  • Click on "+" button near "Repository Exports" to create a new export and supply "Client/IP Hostname" as the KVM host that will interact during the migration

Screen Shot 2020-04-06 at 3.44.09 PM.png

  • Save the list of "Repository Path" into a text file

Screen Shot 2020-04-06 at 3.44.23 PM.png

Create OVM Repository Path(s) on KVM host dedicated to the migration

  • On KVM host involved on the migration process, create the same "OVM" Repository Path(s), where, the OVM Repositories will be mounted as NFS Share(s)

# mkdir /OVS/Repositories/<repository-id>

Example:

[root@kvm: ~]# mkdir -p /OVS/Repositories/0004fb0000030000db921ab5b9d4c751/

[root@kvm: ~]# mkdir -p /OVS/Repositories/0004fb0000030000e90f73dcfeb5ed68/

Getting the same path will get the migration process easier, just because XML configuration file won't have to be edited due to "virtual-disk" path change.

Mount OVM Repository(ies) on KVM Host

Thanks to the "Repository Exports" created above and the directory created on the KVM Host, we can now mount those NFS share(s) on the same path even on the KVM host.

  • On KVM Host, for each OVM repository, proceed with following step

# mount -t nfs <ovm-host>:/OVS/Repositories/<repo-id> /OVS/Repositories/<repo-id>

Example:

[root@kvm: ~]# mount -t nfs ovs34:/OVS/Repositories/0004fb0000030000db921ab5b9d4c751 /OVS/Repositories/0004fb0000030000db921ab5b9d4c751

[root@kvm: ~]# mount -t nfs ovs34:/OVS/Repositories/0004fb0000030000e90f73dcfeb5ed68 /OVS/Repositories/0004fb0000030000e90f73dcfeb5ed68

 

Migration and Physical Disks management

If the source Virtual Machine on Oracle VM is also leveraging physical-disks and you want the migration process managing them, you need to get the same LUN visible (read-only suggested) to the Oracle Linux KVM Server.

In fact, the migration process will rely on an XML file defining the Virtual Machine that needs to be migrated and physical-disks will be reported into the same as in the following example:

<disk type='block' device='disk'>

      <driver name='phy'/>

      <source dev='/dev/mapper/3600144f09704bb2d00005e4d374e0007'/>

      <backingStore/>

      <target dev='xvdb' bus='xen'/>

    </disk>

So what reported on <source dev> has to be also available on the target Oracle Linux KVM host; read-only mode is suggested to avoid possible corruptions.

Migration Process

Once the "Setup" phase above has been completed we can proceed to the Virtual Machine Migration.

If the Virtual Machine that needs to be migrated is not started, start the same (by Oracle VM Manager or OVM-CLI) before proceeding.

Check the list of Virtual Machine running on OVM/Xen host

  • To check the list of Virtual Machine(s) running, execute the following step from the KVM Host

# virsh -c xen+ssh://root@<ovm-host> list --all

Example:

[root@kvm: ~]# virsh -c xen+ssh://root@ovs34 list --all

Id Name State

--------------------------------------------------

0 Domain-0 running

20 0004fb00000600003c9f5f86767de27a idle

With the output, identify the Virtual Machine UUID; the same can be easily recognized/associated by Oracle VM Manager:

Screen Shot 2020-04-06 at 4.03.19 PM.png

NB: if you have a huge list of VMs, using the OVM-CLI can be faster.

 

Create "libvirt" XML configuration file for the OVM Virtual Machine

This XML file will be used by the "virt-v2v" process that will import the Virtual Machine on Oracle Linux Virtualization Manager and Oracle Linux KVM.

  • To generate the file, execute the following step on the KVM Host

# virsh -c xen+ssh://root@<ovm-host> dumpxml <vm-uuid> > <vm-name>.xml

Example:

[root@kvm: ~]# virsh -c xen+ssh://root@ovs34 dumpxml 0004fb00000600003c9f5f86767de27a > win2k-server.xml

 

Shutdown the Virtual Machine on Oracle VM

  • By Oracle VM Manager or OVM-CLI, stop the Virtual Machine running on Oracle VM:

Screen Shot 2020-04-06 at 4.07.14 PM.png

NB: wait to see the Virtual Machine in “Stopped” state before proceeding with the next step.

Start the Migration Process, based on "virt-v2v" binary

  • To start the migration process of the selected Virtual Machine, execute the following command on the KVM host

# export LIBGUESTFS_BACKEND=direct

# virt-v2v -i libvirtxml <xml-conf-generated> -o ovirt-upload -oc https://<OLVM-FQDN>/ovirt-engine/api -os <OLVM-Storage-Domain> -op <OLVM-ADMIN-PASSWORD-FILE> -of raw -oo rhv-cluster=<OLVM-CLUSTER> -oo rhv-cafile=<OLVM-CERT-FILE>

Example:

# export LIBGUESTFS_BACKEND=direct

# virt-v2v -i libvirtxml win2k-server.xml -o ovirt-upload -oc https://ovirt.it.oracle.com/ovirt-engine/api -os local-u01 -op /tmp/ovirt-admin-password -of raw -oo rhv-cluster="ol7-cluster" -oo rhv-cafile=/root/ca.pem

 

  • The process starts and further information, related to the Virtual Machine configuration for KVM, are available; the migration progress is also available:

[root@kvm: ~]# virt-v2v -i libvirtxml win2k-server.xml -o ovirt-upload -oc https://ovirt.it.oracle.com/ovirt-engine/api -os local-u01 -op /tmp/ovirt-admin-password -of raw -oo rhv-cluster="ol7-cluster" -oo rhv-cafile=/root/ca.pem

Exception AttributeError: "'module' object has no attribute 'dump_plugin'" in <module 'threading' from '/usr/lib64/python2.7/threading.pyc'> ignored

[ 0.2] Opening the source -i libvirtxml win2k-server.xml

[ 0.2] Creating an overlay to protect the source from being modified

[ 0.3] Opening the overlay

[ 4.1] Inspecting the overlay

[ 11.4] Checking for sufficient free disk space in the guest

[ 11.4] Estimating space required on target for each disk

[ 11.4] Converting Microsoft Windows 2000 to run on KVM

virt-v2v: warning: /usr/share/virt-tools/pnp_wait.exe is missing.

Firstboot scripts may conflict with PnP.

virt-v2v: warning: there are no virtio drivers available for this version

of Windows (5.0 i386 unknown). virt-v2v looks for drivers in

/usr/share/virtio-win

The guest will be configured to use slower emulated devices.

virt-v2v: This guest does not have virtio drivers installed.

[ 12.0] Mapping filesystem data to avoid copying unused and blank areas

virt-v2v: warning: fstrim on guest filesystem /dev/sda1 failed. Usually

you can ignore this message. To find out more read "Trimming" in

virt-v2v(1).

Original message: fstrim: fstrim: /sysroot/: the discard operation is not

supported

[ 12.1] Closing the overlay

[ 12.2] Assigning disks to buses

[ 12.2] Checking if the guest needs BIOS or UEFI to boot

[ 12.2] Initializing the target -o rhv-upload -oc https://ovirt.it.oracle.com/ovirt-engine/api -op /tmp/ovirt-admin-password -os local-u01

[ 13.4] Copying disk 1/1 to qemu URI json:{ "file.driver": "nbd", "file.path": "/var/tmp/rhvupload.HUxMwl/nbdkit0.sock", "file.export": "/" } (raw)

(11.03/100%)

 

Post Migration Steps

  • Once the migration is completed, the Virtual Machine will appear on "Oracle Linux Virtualization Manager" Browser User Interface with VM-UUID as VM-Name:

Screen Shot 2020-04-06 at 4.22.58 PM.png

  • We can now edit the "Virtual Machine", change the "VM-Name" and "Description", verify "vNIC configuration/association" to then start the same Virtual Machine on KVM/OLVM:

Screen Shot 2020-04-06 at 4.23.46 PM.png

  • Start the Virtual Machine on "Oracle Linux Virtualization Manager / Oracle Linux KVM"

Screen Shot 2020-04-06 at 4.24.45 PM.png

Join the discussion

Comments ( 4 )
  • R.Threet Tuesday, October 20, 2020
    These steps *were* working wonderfully until the last round of patches:

    Sep 06 13:24:55 Updated: libvirt-bash-completion-5.7.0-17.el7.x86_64
    Sep 06 13:25:10 Updated: libvirt-libs-5.7.0-17.el7.x86_64
    Sep 06 13:25:12 Updated: libvirt-client-5.7.0-17.el7.x86_64
    Sep 06 13:25:12 Updated: libvirt-daemon-5.7.0-17.el7.x86_64
    Sep 06 13:25:13 Updated: libvirt-daemon-driver-network-5.7.0-17.el7.x86_64
    Sep 06 13:25:13 Updated: libvirt-daemon-driver-nwfilter-5.7.0-17.el7.x86_64
    Sep 06 13:25:13 Updated: libvirt-daemon-driver-qemu-5.7.0-17.el7.x86_64
    Sep 06 13:25:13 Updated: libvirt-daemon-driver-secret-5.7.0-17.el7.x86_64
    Sep 06 13:25:13 Updated: libvirt-daemon-driver-nodedev-5.7.0-17.el7.x86_64
    Sep 06 13:25:13 Updated: libvirt-daemon-driver-interface-5.7.0-17.el7.x86_64
    Sep 06 13:25:26 Updated: libvirt-daemon-config-nwfilter-5.7.0-17.el7.x86_64
    Sep 06 13:25:26 Updated: libvirt-daemon-driver-lxc-5.7.0-17.el7.x86_64
    Sep 06 13:25:26 Updated: libvirt-daemon-config-network-5.7.0-17.el7.x86_64
    Sep 06 13:25:28 Updated: libvirt-daemon-driver-storage-core-5.7.0-17.el7.x86_64
    Sep 06 13:25:28 Updated: libvirt-daemon-driver-storage-disk-5.7.0-17.el7.x86_64
    Sep 06 13:25:28 Updated: libvirt-daemon-driver-storage-rbd-5.7.0-17.el7.x86_64
    Sep 06 13:25:28 Updated: libvirt-daemon-driver-storage-mpath-5.7.0-17.el7.x86_64
    Sep 06 13:25:28 Updated: libvirt-daemon-driver-storage-logical-5.7.0-17.el7.x86_64
    Sep 06 13:25:28 Updated: libvirt-daemon-driver-storage-gluster-5.7.0-17.el7.x86_64
    Sep 06 13:25:28 Updated: libvirt-daemon-driver-storage-scsi-5.7.0-17.el7.x86_64
    Sep 06 13:25:28 Updated: libvirt-daemon-driver-storage-iscsi-5.7.0-17.el7.x86_64
    Sep 06 13:25:28 Updated: libvirt-daemon-driver-storage-5.7.0-17.el7.x86_64
    Sep 06 13:25:28 Updated: libvirt-daemon-kvm-5.7.0-17.el7.x86_64
    Sep 06 13:25:39 Updated: 1:virt-v2v-1.40.2-9.0.1.el7_8.1.x86_64
    Sep 06 13:25:40 Updated: libvirt-5.7.0-17.el7.x86_64
    Sep 06 13:25:40 Updated: libvirt-lock-sanlock-5.7.0-17.el7.x86_64

    Now I get:

    Exception AttributeError: "'module' object has no attribute 'dump_plugin'" in ignored
    [ 0.3] Opening the source -i libvirtxml ratagin.xml
    [ 0.3] Creating an overlay to protect the source from being modified
    [ 0.5] Opening the overlay
    [ 4.6] Inspecting the overlay
    virt-v2v: error: inspection could not detect the source guest (or physical
    machine).

    Assuming that you are running virt-v2v/virt-p2v on a source which is
    supported (and not, for example, a blank disk), then this should not
    happen.

    No root device found in this operating system image.

    If reporting bugs, run virt-v2v with debugging enabled and include the
    complete output:

    virt-v2v -v -x [...]

    Has this possibly been broken by patches?
  • Simon Wednesday, October 21, 2020
    Hi R.Threet,

    -17 is not the latest libvirt release (actually latest one is -19).
    BTW, the message above:

    virt-v2v: error: inspection could not detect the source guest (or physical machine).

    seems that your image is not consistent or the OS is not there. Is this a snapshot of a running VM ?

    Simon
  • iacopo Tuesday, December 15, 2020
    hi,
    i want to ask, at the xend restart passage (Restart “xend” service on OVM Server), the ovm server's guests will be affected?
  • Simon Thursday, December 17, 2020
    Hi Iacopo,

    restarting "xend" won't impact running VMs on Oracle VM Server.
    Thanks

    Simon
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.