In this lab learn about the kernel-based virtual machine (KVM) functionality included with Oracle Linux 7, UEK5, and Oracle Linux Virtualization Manager. Walk through the planning and deployment of an infrastructure-as-a-service (IaaS) environment with an Oracle Linux KVM as the foundation. Topics covered include planning storage capacity, creating a logical unit number, planning network bandwidth, and best practices for designing and streamlining the environment through Oracle Linux Virtualization Manager.
This hands-on lab takes you through the planning and deployment of an infrastructure as a service (IaaS) environment with Oracle Linux KVM and Oracle Linux Virtualization Manager as the foundation. It covers a range of topics, from planning storage capacity, LUN creation, network bandwidth planning, and best practices to designing and streamlining the environment for ease of management.
During this lab, we will create an Oracle Linux KVM demo environment on a single laptop machine, using KVM with nested virtualization.
Minimal Configuration to run this lab
This document can be used to run the lab at home or at your office on your own laptop/desktop/server machine.
In this lab, we use Oracle Linux KVM on the host to create 2 virtual machines that will later be used by Oracle Linux KVM and Oracle Linux Virtualization Manager, so that we can install all software components on a single physical machine.
Since the hypervisor used on the host is KVM, the native operating system on the laptop/desktop/server machine has to be Linux based.
The minimal configuration needed for your laptop/desktop/server is:
- 16 GB of RAM memory
- Modern Intel/AMD x86 CPU
- ~ 80GB of disk space
The KVM Virtual Machine requirements requirements are:
- Virtual Machine dedicated to KVM Compute node
- 2 vCPUs
- 4GB RAM
- 50GB of disk space
- Virtual Machine dedicated to Oracle Linux Virtualization Manager node
- 2 vCPUs
- 6GB RAM
- 30GB of disk space
For the installation of the Oracle Linux KVM node and Oracle Linux Virtualization Manager node you can follow documentation available at: https://docs.oracle.com/cd/F15085_01/F15081/html/index.html
Global Architecture Picture
In the present document, we will use the following acronyms:
- OLVM for “Oracle Linux Virtualization Manager”
- OL KVM for "Oracle Linux Kernel-based Virtual Machine"
- VM for “Virtual machine”
In this lab, 2 Virtualization layers are used to emulate a compute/management architecture:
- Oracle Linux KVM with "virt-manager"
- Oracle Linux KVM with Oracle Linux Virtualization Manager
The first step is to start the Virtual Machines required to run the lab.
Those Virtual Machines have been created on KVM and can be managed by the local GUI utility called "virt-manager"; so, to proceed, open a terminal with "lab" user and execute:
The "Virtual Machine Manager" windows will open:
As you can see more Virtual Machines are available; the two Virtual Machines required for HOL-5308 are:
- ol7-olvm (Oracle Linux Virtualization Manager node - Management)
- ol7-kvm (Oracle Linux KVM node - Compute)
Select each of those Virtual Machines and click on "Play" button to start them.
To connect to the Oracle Linux Virtualization Manager web-interface, open a browser a connect to:
Click on "Administration Portal" and login with the following account:
The OLVM Homepage dashboard will be displayed:
Before starting to work on the OLVM/KVM environment, proceed to check that everything is correctly configured.
On this environment we have one unique Oracle Linux KVM Host (ol7-kvm); to check the Host status click on "Compute => Hosts"
Once "Host" webpage is opened, we can see the list of KVM hosts configured and managed by Oracle Linux Virtualization Manager; information details immediately available are:
- Host status
- Host name
- IP Address
- Cluster (host joined)
- Datacenter (associated)
On this environment we have one unique "Storage Domain"; to check the "Storage Domain" status click on "Storage => Domains"
Once "Storage Domain" webpage is opened, we can see the list of Storage Domains configured and managed by Oracle Linux Virtualization Manager; information details immediately available are:
- Status (up)
- Domain Name (local-fs)
- Domain Type (Data - Master)
- Storage Type (Local on Host)
- Format (v4 - based on OLVM release)
- Cross Data Center Status (Active)
- Total Space (35GB)
- Free Space (29GB)
The Network configuration is based on capabilities of the KVM Hosts; our configured KVM host has two different NICs:
- ens3 (NAT) with IP address 192.168.122.104
- ens6 (Host-Only) with IP address 188.8.131.52
ens6 is also used for the communication between OLVM and OL KVM hosts (ovirtmgmt Network).
To check the "Network" status click on "Network => Networks"
Once "Networks" webpage is opened, we can see the list of Networks configured and managed by Oracle Linux Virtualization Manager; information details immediately available are:
- Network Name (ovirtmgmt)
- Datacenter (Default)
- Description (Management Network)
- Role (VM - other than default ones)
Before proceeding with the lab execution, due to a known issue, we have to execute an operation on the OL KVM compute node.
To complete this process, execute following steps:
- Open a terminal and connect to the OL KVM Compute Host with "root" user (password is "Welcome1")
# ssh firstname.lastname@example.org
- Remove following RPM package from the installed host
# yum remove vdsm-hook-allocate_net-4.20.46-1.0.7.el7.noarch -y
During this lab following operations will be executed:
- Configure a new Virtual Network, dedicated to KVM Virtual Machines
- Import an OVA (Open Virtualization Archive) with Oracle Linux 8
- Create a Virtual Machine
- Edit the Virtual Machine and apply different settings (CPU, Storage, Network)
- Create a Virtual Machine Snapshot (using the existing and running Oracle Linux 8 machine)
- Create a Template, starting from the Snapshot created
- Deploy a new Virtual Machine starting from the Template
Virtual Network Configuration
On a default OLVM / OL KVM installation the only Virtual Network available is the default "ovirtmgmt" one; this Network can be also used for Virtual Machines but best practices suggest to have a dedicated NIC for Virtual Machines.
To create a new Network, click on "Network => Networks" and then click on "New" button:
On the "New Logical Network" Window, supply following information:
- Data Center: "Default"
- Name: "vm-hol"
- Description: "VM default network"
- Comment: "VM default network"
- Network Label: "vm-hol"
- Leave all the other options to their default values
and then click "OK" to confirm the Network creation.
Now, with the "Logical Network" in place, the same has to be associated to a specific Network device (or set of devices) on our KVM host.
The association can be executed by the following steps:
- Open Host configuration by clicking on "Compute => Hosts" and then select the KVM host "ol7-kvm"
- Click on "Network Interfaces" tab
- Click on "Setup Host Networks" and get "Logical Network" named "vm-hol" associated to NIC "ens3" (just drag it to the ens3 slot)
Once "vm-hol" is correctly associated, click on "OK" button to confirm.
By expanding the "Logical Networks" we can now see the "Logical Network vm-hol" associated to the host physical device "ens3"
One of the fastest method to get a Virtual Machine created by OLVM is the OVA Import process.
The Oracle Linux KVM host already has an Oracle Linux 8 OVA file available that can be easily imported, by the GUI, into our environment.
To import the OVA proceed with following steps:
- Click on "Compute => Virtual Machines", click on the "3 points" (upper right) and select "Import"
- On the "Import Virtual Machine" window, select following options
- Data Center: "Default"
- Source: "Virtual Appliance (OVA)"
- Host: "ol7-kvm"
- File Path: "/media/ol8.ova"
- and then click on "Load" button.
- Select the Virtual Machine on Source named "ol8" and move it to the right; once done, click on "Next" button
- On the following window select the option "Clone" and proceed with following configuration changes
- Leave default configuration options
- Network Interfaces
- Network Name: "vm-hol"
- Profile Name: "vm-hol"
- and then click on "OK" button to start the import process.
The import process will get more minutes and the machine will remain in "Initializing" status until the process is completed; a padlock icon is also shown on the Virtual Machine row.
While waiting to get the Virtual Machine "ol8" ready, we can also try to import an other type of resource (a Virtual Disk) on the same environment because Oracle Linux Virtualization Manager grants parallel processing.
To accomplish the "Virtual Disk" import, proceed with following steps:
- By the "Virtual Machine Manager" open the Console of the Virtual Machine named "ol7-olvm"
- On the Virtual Machine "ol7-olvm" console, login with "root/Welcome1" and start a graphical user-interface
- On the Virtual Machine "ol7-olvm" open a terminal and execute following commands to download and extract the required "Virtual Disk"
# wget https://bit.ly/2lObY4i -O ol6.qcow2.gz
# gunzip ol6.qcow2.gz
Original Link is available at:
- On the same "ol7-olvm" console, open a new browser, that will be used to upload the "Virtual Disk", pointing to
- By the OLVM web interface, go to "Storage => Disks"; then click on the "Upload" button and select "Start"
- In the "Upload" windows, choose the file "ol6.qcow2" and supply "ol6" as alias for the Virtual Disk and then click on "Test Connection" button
- First time you click on "Test Connection" button a warning message will appear; then click on "ovirt-engine-certificate" link and proceed as in the picture below
- Click on "OK" to proceed to the "Virtual Disk" import process; the import will get not more than 2 or 3 minutes
We had to execute the import "Virtual Disk" operation from the "ol7-olvm" virtual machine because we do not have a valid DNS resolver for the "ol7-olvm" hostname on our laptop; on production or normal environments the "Virtual Disk" import operation can be executed from any client/browser.
So, coming back to the browser running on the laptop we can now proceed to the following steps.
Create a Virtual Machine
In this section we'll create one new "Virtual Machine" starting from the "ol6.qcow2" virtual disk imported.
To complete this section, proceed with the following steps
- On the OLVM "Administration Portal" open "Compute => Virtual Machines" section and then click on "New" button
- On the "New Virtual Machine" window, supply following details
- Operating System: "Oracle Linux 6.x x64"
- Optimized for: "Server"
- Name: "ol6"
- Instance Images: "Attach => ol6"
- nic1: "vm-hol/vm-hol" Network profile
- System (if you do not see "System" click on the lower left corner button "Show Advanced Options")
- Memory Size: "1024 MB"
- Maximum Memory: "1024 MB"
- and then click on "OK" button to create the new "Virtual Machine"
Before starting both the Virtual Machines "ol6" and "ol8" we still need to apply a configuration change to the "ol8" machine (imported by OVA); by editing the same we need to reduce the values of:
- Memory size: "1024 MB"
- Maximum memory: "1024 MB"
and then proceed to start both the "Virtual Machines" by the "Run" button; while the VMs are starting we can also check their boot-process with the "Console" button
Create a Virtual Machine Snapshot
By this section we'll proceed to get a "Virtual Machine Snapshot" of a running VM.
To get a snapshot of a running Virtual Machine, proceed with the following steps.
- By the OLVM web interface, go to "Compute => Virtual Machines"; then select the line with the virtual machine named "ol8" and click on "Create Snapshot" button
- On the "Create Snapshot" window supply a name for the snapshot (for-template) and unselect the "VM Memory" option
The "Save Memory" option cannot be used on this Virtual Machine because we do not have the "guest-agent" installed on the VM itself.
Click "OK" to create the snapshot.
Create a Template
The next step is to create a new "Template" starting from the "Virtual Machine Snapshot"; before proceeding with this step you have to wait to get the "ol8" snapshot completed.
To accomplish this operation, complete following steps:
- By the OLVM web interface, go to "Compute => Virtual Machines"; then select the virtual machine named "ol8" and click on its name.
- On the "ol8" details webpage, click on "Snapshots" tab to see the list of snapshots available
- Select the snapshot named "for-template" and click on the button "Make Template"
- On the "New Template" window, supply a name for the template and confirm with "OK" to get it created
Deploy a Virtual Machine from a Template
During this lab we already tested/demonstrated the process to create a Virtual Machine by:
- Importing an OVA file
- Importing a Virtual Disk
and, now, we'll see how to create a "Virtual Machine" from an existing "Template"; to complete this process, complete following steps
- By the OLVM web interface, go to "Compute => Templates"; then select the template named "ol8-template" and click on "New VM" button.
- On the "New Virtual Machine" window you'll see that the "Template" is "ol8-template | base version (1)" and, here we can configure the new Virtual Machine.
and then click on "OK" button to create the "ol8-custom" VM.
- Once completed we can also start the new "ol8-custom" Virtual Machine from "Compute => Virtual Machines" menu.
This VM will boot with the same hostname of the previous one and there is no option to get it configured on the first boot; the requirement to properly get Templates created is to have within the guest:
- cloud-init for automated deployment on Linux machines
- Sysprep for automated deployment on MS-Windows machines
Once those tools are installed on the source Virtual Machine, the consequent Template can operate with the "Initial RUN" tab, available on the "New Virtual Machine" window
Further details on "Oracle Linux KVM" and "Oracle Linux Virtualization Manager" are available at on Oracle Documentation Library.