KVM provides a set of modules that enable you to use the Oracle Linux kernel as a hypervisor to run virtual machines. KVM is built into the Unbreakable Enterprise Kernel (UEK) by default.
Important
Oracle Linux 7 Premier Support ended December 31, 2024, and the Oracle Cloud Marketplace Oracle Linux KVM image is no longer supported.
If you already are using the Oracle Cloud Marketplace Oracle Linux KVM image with your compute instance, there will be no changes to your instance.
The Oracle KVM image includes:
the base environment and tools to configure an Oracle Cloud instance as a KVM host for deploying and managing virtual machines
utilities to manage the host, guests, storage, and networking configurations required for the environment
Important
Currently, the Oracle image is not intended for use with other virtual management solutions, such as Oracle Linux Virtualization Manager.
If you are new to Oracle Cloud Infrastructure, review the Getting Started section in the Oracle Cloud Infrastructure documentation. You should also have familiarity with managing virtual machine guests using libvirt, in particular virsh and virt-install.
For more information on using KVM with Oracle Linux, see:
Oracle updates the KVM image regularly with the latest security errata and updates. Oracle updates this document only when new features are added or existing features are modified.
The base operating system is updated to Oracle Linux 7 Update 9 and Unbreakable Enterprise Kernel Release 6 (UEKR6).
The oci-utils package is updated to v0.11.6-9.
The Oracle Cloud Marketplace now offers two versions of the Oracle Linux KVM image:
Oracle Linux KVM image (Autonomous Linux): This image is configured to run Oracle Autonomous Linux using the standard Oracle Linux repositories. Oracle Autonomous Linux provides autonomous capabilities such as automated Ksplice patching with zero downtime, and known exploit detection, to help keep the instance highly secure and reliable. The Autonomous Linux version of the image is listed in the Oracle Cloud Marketplace as Oracle Linux KVM image (Autonomous Linux).
Oracle Linux KVM image: The Oracle Linux version of the image is listed in the Oracle Cloud Marketplace as Oracle Linux KVM image. Important
Future releases of the Oracle Linux KVM image for Oracle Cloud Infrastructure will be configured as Autonomous Linux using the standard Oracle Linux repositories.
Release 1.6 🔗
The base operating system is updated to Oracle Linux 7 Update 8.
The oci-utils packages are updated to v0.11.3-6.
OCI utilities have been enhanced to provide multi-VNIC support. For more information, see Using the OCI-KVM Utilities.
The Python3 implementation of OCI utilities includes security enhancements for Instance Metadata Service v2.
The python36-oci-sdk package installed in the image to provide added functionality for OCI utilities.
The Oracle Linux 7 KVM Utilities channel is enabled to provide updates for the qemu-kvm and libvirt packages.
Release 1.5 🔗
The base operating system is updated to Oracle Linux 7 Update 7.
Support for compute shapes have been enhanced to support:
Oracle Cloud Infrastructure AMD bare metal (BM) shape.
New OCI-KVM utilities for Oracle Cloud Infrastructure are included in this release:
oci-kvm create-network
Creates a VNIC virtual network for a KVM guest. Creates a bridged libvirt network on top of a VNIC, allowing a single VNIC to be shared among multiple guests.
oci-kvm delete-network
Deletes a VNIC virtual network for a KVM guest.
oci-kvm create-storage-pool
Creates, mounts, and configures a file system on a block storage device or storage allocated on the Oracle Cloud File Storage Service on Oracle Cloud Infrastructure. Enables the use of a single block disk to host several guest disks.
Release 1.4 🔗
The base operation system is based on Oracle Linux 7 Update 5.
You can create Oracle KVM instances using any of the compute shapes. However, AMD processor-based virtual machines do not support nested virtualization. For more information, see Compute Shapes.
You can't attach a KVM guest to VLAN 0 on shapes with an active physical NIC 1.
However, you can attach KVM guests to the other VLANs on either physical
NIC.
Allocating Block Storage and VNICs 🔗
Before creating a virtual machine on your KVM instance, you must allocate block storage and VNICs.
Each guest requires a dedicated Oracle Cloud Infrastructure block storage device and VNIC.
Creating and Attaching Block Storage 🔗
Using the Console
Use the Oracle Cloud Infrastructure Console to create and attach block storage.
For example, to create and attach volume_001 with a size of 128 GB:
# oci-iscsi-config create --attach-volume --volume-name volume_001 --size 128
Creating a new 128 GB volume pool_volume_001
Volume [pool_volume_001] created
Attaching the volume to this instance
Attaching iSCSI device.
Volume [pool_volume_001] is attached.
To verify the configuration:
# oci-iscsi-config show --details
Currently attached iSCSI devices:
Target | Volume name | Volume OCID | Persistent portal | Current portal | Session State | Attached device | Size |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
iqn.2015-12.com.oracleiaas:id...| volume_001 |ocid1.volume.oc1.uk-london-1....| 169.254.2.2:3260 | 169.254.2.2:3260 | LOGGED_IN | sdb | 128G |
Note
If the command fails with: Volume creation has failed: Failed to create volume
Placing the .iso file within /home/opc can cause permissions issues. Ensure the .iso file is in an accessible location (such as /tmp).
Example using block storage
This example creates a guest using a specific block storage device and a serial console for console output. You can also use other options, such as VNC for console output. If a graphical option is used, you must appropriately configure the Oracle Cloud Infrastructure security list for the subnet this image is attached to.
This example creates a guest that is configured to use a storage pool, multiple VNICs (two VNICs in this example using the -n option), and a serial console for console output.
Use the oci-kvm destroy command to remove and deconfigure all system
resources assigned to the guest virtual machine and make them available for
reuse.
Connect to your KVM instance using SSH, for example:
Before you can remove a virtual machine, you must stop it:
oci-kvm destroy -s VM_NAME
After the virtual machine stops, you can permanently destroy it:
oci-kvm destroy -D VM_NAME
For example, to destroy kvm_vm_001:
$ oci-kvm destroy -D kvm_vm_001
Domain kvm_vm_001 has been undefined
The oci-kvm destroy command undefines the virtual machine in libvirt and cleans up any host resources that were created for it. The Oracle Cloud Infrastructure resources that were allocated to the virtual machine become available for reuse by new virtual machines.
Using the OCI-KVM Utilities 🔗
The OCI-KVM (oci-kvm) utilities allow you to create and configure KVM guests on Oracle Cloud Infrastructure instances.
During the automated guest creation process, the utility ensures that Oracle Cloud Infrastructure resources are not assigned to more than one KVM guest. When you no longer need a guest, the utilities can remove the guest and unconfigure all system resources assigned to the guest.
oci-kvm create 🔗
Description 🔗
Performs all actions required to create a KVM guest that uses Oracle Cloud Infrastructure block storage and Oracle Cloud Infrastructure VNICs for both the root disk and network interface.
For block storage, validates and checks device to ensure it has not been
assigned to another guest. A storage pool can also be used.
For virtual network interfaces, creates all virtual network infrastructure, including virtual functions, VLANs, individual block storage devices, and VNICs that are required for each guest.
Guests cannot share either a VNIC or a block storage device.
Guests can have multiple VNICs assigned and be attached to more than one virtual network.
Path to the block device to be used as the root disk of the VM; use with -p | --pool and -s | --disk-size.
-s | --disk-size disk_size
Size of the disk, in gigabytes, to be created when using storage pool; use with -d | --disk and -p | --pool.
-p | --pool pool_name
Name of storage pool to be used for root disk. Use with -d |--disk and -s | --disk-size.
-v | --virtual-network virtual_network_name
The name of libvirt network to attach the guest to; can be repeated to attach guest to multiple networks.
-n | --net ip_vnic
IP or name of the VNIC assigned to the guest; can be repeated to assign
multiple VNICs.
-V | --virt optional_arguments
Other optional arguments to provide to virt-install. These
arguments are passed unmodified into virt-install, even if
they are arguments that oci-kvm would otherwise understand.
Examples
This example shows how to create a guest named MY_VM with a root
disk of 128 GB on storage pool named MY_POOL using the
192.168.100.1 VNIC.
This example shows how to create an Oracle Linux 7 Update 8 guest configured to use a storage pool, multiple VNICs (two VNICs in this example using the -n option), and a serial console for console output.
Guest first IP range in virtual network address space.
-E | --ip-end ip_end
Guest last IP range in virtual network address space.
-P | --ip-prefix ip_prefix
IP prefix to be used in virtual network.
Examples
This example shows how to create a virtual network named MYNET0 on a VNIC with 10.0.1.2 as the IP address, a bridge IP of 192.168.100.9, an IP range of 192.168.100.10 - 192.268.100.30, and an IP prefix of 24.