Migrate Oracle VM to KVM easily and without reconfiguration

Roderick Christ
Migrate Oracle VM to KVM

Oracle VM is end-of-life and is, since March 2021, in extended support1. In looking for a replacement hypervisor AMIS has turned to KVM. Oracle itself also uses KVM, albeit its own brand of KVM, OLKVM, in Oracle Cloud and on the new versions of its Oracle Database Appliance. Topped with KVM being a stable open source product it seemed the logical choice. Of course we needed to migrate Oracle VM machines to KVM. Luckily that is a fairly straight forward process which I shall describe roughly here.

To migrate an Oracle VM VM we will leverage the libvirt daemon on the Oracle VM host and the open source virt-v2v tool to transfer and convert an Oracle VM VM to KVM.

The basic steps are:

  • Ensure we can temporarily logon passwordless from the KVM host to the Oracle VM host. We also need to set some session variables.
  • Start libvirtd on the Oracle VM host
  • Configure xend on the Oracle VM host to listen on port 8000 en restart xend (no downtime for VM’s)
  • Export the filesystem which contains the VM’s disk images on the Oracle VM host. You can do this in Oracle VM Manager or through standard OS commands.
  • Mount the exported filesystem on the KVM host, with the same path as it had on the Oracle VM host.
  • Now we can query the  VM’s on the Oracle VM host from the KVM host:
[root@kvmhost ~]# virsh -c xen+ssh://root@oracleovmhost list --all
Id Name State
----------------------------------------------------
0 Domain-0 running
1 0004fb00000600002560b76177831de3 idle
3 0004fb0000060000d04f7f5799cdddd2 idle
5 0004fb0000060000db5278822f2a53c1 idle
12 0004fb000006000060236e49cb903a03 idle
14 0004fb0000060000472194a721d8bd73 idle

[root@kvmhost ~]#
  • Next step is to get a KVM xml configuration file from the Oracle VM VM
[root@kvmhost ~]# virsh -c xen+ssh://root@oracleovmhost dumpxml 0004fb0000060000d04f7f5799cdddd2 > kvmvm01.xml
[root@kvmhost ~]#
  • Shut down the VM on the Oracle VM host
  • And now we can transfer and convert the VM with virt-v2v
[root@kvmhost ~]# virt-v2v -i libvirtxml kvmvm01.xml -os default --bridge br1 -on kvmvm01 -of qcow2
[ 0.0] Opening the source -i libvirtxml kvmvm01.xml
[ 0.0] Creating an overlay to protect the source from being modified
[ 0.1] Opening the overlay
[ 3.8] Inspecting the overlay
[ 20.2] Checking for sufficient free disk space in the guest
[ 20.2] Estimating space required on target for each disk
[ 20.2] Converting Oracle Linux Server 7.7 to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 77.3] Mapping filesystem data to avoid copying unused and blank areas
[ 77.9] Closing the overlay
[ 77.9] Assigning disks to buses
[ 77.9] Checking if the guest needs BIOS or UEFI to boot
[ 77.9] Initializing the target -o libvirt -os default
[ 78.0] Copying disk 1/2 to /var/lib/libvirt/images/ kvmvm01-sda (qcow2)
(100.00/100%)
[ 624.2] Copying disk 2/2 to /var/lib/libvirt/images/ kvmvm01-sdb (qcow2)
(100.00/100%)
[1172.8] Creating output metadata
Pool default refreshed

virt-v2v: warning: unknown guest operating system: linux oraclelinux 7.7
x86_64 (Oracle Linux Server 7.7)
Domain kvmvm01 defined from /tmp/v2vlibvirtd9a1a5.xml[1172.9] Finishing off
[root@kvmhost ~]#

In this case we converted the raw disk image files from the Oracle VM VM to qcow2 format. Using qcow2 allows us to use KVM snapshots and it has the added benefit of reducing the disk size which also cuts down the amount of data that needs to be transferred during the migration, reducing the migration lead time.

At this point we have a KVM VM which we can run and is the migration complete, although some aftercare steps should be taken such as configuring and installing the qemu guest agent.

With the above process we migrated Oracle VM VMs to KVM with relative ease, no manual reconfiguration and little downtime.

1 At the time of writing extend support for Oracle VM ends June 2024

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Next Post

The True Cost of a Feature–Kill your darlings

TL;DR: the true cost of a software feature includes a long tail of operational and maintenance cost that should be taken into consideration when first implementing the feature. The continuance or deprecation of features  should be evaluated periodically, based on the actual usage and true value of the feature – […]
%d bloggers like this: