Hello, and welcome to today's video presentation on converting a VirtualBox Linux-base VM to
deploy in KVM on Oracle Linux 8.
This video will focus on using virt-v2v to handle the conversion and deployment of a
VirtualBox VM export to a qcow2 disk image and deploy it to KVM on Oracle Linux 8.
The virt-v2v tool is a handy program used to convert VMs from Xen, VirtualBox, VMware,
and Hyper-V to KVM.
So let us get started.
This demo uses a pre-installed Oracle Linux 8 system with VirtualBox 6.1, KVM, and an
Oracle Linux 8 VM export named ol8-test-vbox.ova.
Additional information is available on VirtualBox exports in the VirtualBox documentation linked
at the end of this video, or in our existing videos at oracle.com/goto/oraclelinuxlearning.
Due to incompatibilities at the time of this recording, VirtualBox VMs and KVM VMs cannot
run on the host system simultaneously.
To start this demo, first, open a terminal.
Next, install the virt-v2v tool by typing sudo dnf install virt-v2v.
If prompted for the user's password due to using sudo, enter it.
DNF will resolve any dependencies and prompt for confirmation to continue.
Accept the packages to install by typing y and hitting Enter.
Depending on your system, DNF might prompt to accept new GPG keys.
Accept the importing of these keys by typing y and hitting Enter.
The requested packages will install.
With virt-v2v now installed, we will step through importing an OVA file for use on libvirt
(KVM).
If additional details are needed, check the man page for a complete list of input and
output options.
The OVA export location for this demo environment is in the directory /home/oracle/Documents.
To ensure virt-v2v, which runs using sudo, has access to the file, move it to /tmp by
typing sudo mv /home/oracle/Documents/ol8-test-vbox.ova /tmp/.
Next, start the conversion by typing sudo virt-v2v -i ova /tmp/ol8-test-vbox.ova -o
libvirt -of qcow2 -os default -n default.
In the command above:
sudo will run virt-v2v with the required elevated privileges to access the KVM (libvirt) System
hypervisor.
-i ova location_of_ova_file points to the conversion input file of type ova
-o libvirt -of qcow2 outputs a libvirt VM in qcow2 file format
-os default places the output VM in the default storage pool
-n default configures the VM with the default virtual network.
As the conversion could take a while to complete, we will fast forward to the end.
Once the conversion and import are complete, check the status of the imported VM.
Type sudo virsh list --all.
The output shows that the VM imported successfully.
As the virt-v2v tool is currently unable to reconfigure all VM network configurations
during the conversion process, review the imported VMs networking settings for accuracy.
From the terminal type sudo virsh domiflist ol8-test-vbox to display the network interfaces
for the imported VM.
For this VM conversion, the network settings remain unchanged, and the values shown are
the original VirtualBox NAT network values.
To correct the network settings, first, remove the existing virtual network interface.
Type sudo virsh detach-interface ol8-test-vbox --type bridge --mac 52:54:00:37:a5:8c --config
The output shows the interface was successfully detached.
Next, get a list of virtual networks available by typing sudo virsh net-list -all.
The output shows the default virtual network configured for KVM.
To get details about the default network shown, type sudo virsh net-dumpxml default.
The information displayed shows the interface type being network and the source or name
as default.
Next, attach this network to the VM by typing sudo virsh attach-interface ol8-test-vbox
--type network --source default --config.
The output shows the interface was successfully attached.
Be sure to use the --config option when the VM is shut-off; otherwise, the virsh attach-interface
command will fail.
While the imported VM is still offline, additional changes to the disk image, such as installing
packages and editing configuration files, are possible using the command virt-customize.
Since using that command is outside the scope of this video, more information is available
by checking the virt-customize man page.
With the VM configuration file now correct, start the ol8-test-vbox KVM VM by typing sudo
virsh start ol8-test-vbox.
Wait a bit for the VM to start and then check the status typing sudo virsh list --all.
Open and display the VM in virt-viewer by typing sudo virt-viewer ol8-test-vbox.
Be sure to use sudo since the VM imported into the System hypervisor.
If the sudo session has access to the X display, a Virt Viewer window will display.
If a warning shows indicating that virt-viewer cannot open the X-display, enable access by
typing xhost + and rerunning the virt-viewer command.
Once the Virt Viewer window appears, log in with the VM credentials.
Now, update the imported VM's guest network configuration.
Type sudo nmcli conn show to get a list of connections.
Next type sudo nmcli dev status.
This command displays a device for this VM, which we can configure for the KVM NAT virtual
network.
The actual device listed may be different in your environment.
Next, type sudo nmcli con add type ethernet con-name wire_1 ifname ens3.
The name wire_1 is an arbitrary name provided to this wired connection in NetworkManager.
Start the connection by typing nmcli con up wire_1.
The connection successfully activated.
Ensure this connection auto connects after a reboot by typing sudo nmcli conn mod wire_1
connection.autoconnect yes.
The created wire_1 connection provides access through the NAT virtual network to the internet,
and the conversion is complete.
Thank you for watching this video and enjoy using KVM on Oracle Linux 8.
Please check our additional information on Oracle Linux 8 in the Oracle Linux 8 Documentation
or Oracle Linux Learning Library.