Selasa, 09 November 2021

ORACLE VM-virtualitation

 

HOL: Install and configure Oracle Linux KVM and Oracle Linux Virtualization Manager

Simon Coter | October 3, 2020
Director, Oracle Linux and Virtualization Product Management

Abstract

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.

Lab Objective

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

arch_hol5308.png

Important Notes

Acronyms

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”

Nested Virtualization

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

Lab Execution

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:

# virt-manager

The "Virtual Machine Manager" windows will open:

01.png

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:

https://192.168.122.187

03.png

Click on "Administration Portal" and login with the following account:

Username: admin

Password: Welcome1

Profile: internal

The OLVM Homepage dashboard will be displayed:

04.png

Lab Checks

Before starting to work on the OLVM/KVM environment, proceed to check that everything is correctly configured.

Host

On this environment we have one unique Oracle Linux KVM Host (ol7-kvm); to check the Host status click on "Compute => Hosts"

05.png

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)

06.png

Storage

On this environment we have one unique "Storage Domain"; to check the "Storage Domain" status click on "Storage => Domains"

07.png

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)

08.png

Network

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 128.128.128.207

ens6 is also used for the communication between OLVM and OL KVM hosts (ovirtmgmt Network).

To check the "Network" status click on "Network => Networks"

09.png

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)

10.png

Known issue

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 root@192.168.122.104

  • Remove following RPM package from the installed host

# yum remove vdsm-hook-allocate_net-4.20.46-1.0.7.el7.noarch -y

Lab Steps

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:

11.png

On the "New Logical Network" Window, supply following information:

  • General
    • 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.

12.png

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"

13.png

  • Click on "Network Interfaces" tab

14.png

  • Click on "Setup Host Networks" and get "Logical Network" named "vm-hol" associated to NIC "ens3" (just drag it to the ens3 slot)

15.png

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"

16.png

OVA Import

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"

17.png

  • 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.

18.png

  • Select the Virtual Machine on Source named "ol8" and move it to the right; once done, click on "Next" button

19.png

  • On the following window select the option "Clone" and proceed with following configuration changes
    • General
      • 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.

20.png

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.

21.png

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"

25.png

  • On the Virtual Machine "ol7-olvm" console, login with "root/Welcome1" and start a graphical user-interface

# startx

  • 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:

https://publicdocs-corp.documents.us2.oraclecloud.com/documents/link/LDCE9095D390DDE972AE8912F6C3FF17C1177E4725F3/file/D0687F46AC5459FE4D833265F6C3FF17C1177E4725F3?dRevLabel=1&allowInterrupt=1

  • On the same "ol7-olvm" console, open a new browser, that will be used to upload the "Virtual Disk", pointing to

https://ol7-olvm

  • By the OLVM web interface, go to "Storage => Disks"; then click on the "Upload" button and select "Start"

22.png

  • 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

23.png

  • 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

24.png

  • Click on "OK" to proceed to the "Virtual Disk" import process; the import will get not more than 2 or 3 minutes

26.png

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

27.png

  • On the "New Virtual Machine" window, supply following details
    • General
      • Operating System: "Oracle Linux 6.x x64"
      • Optimized for: "Server"
      • Name: "ol6"
      • Instance Images: "Attach => ol6"
      • nic1: "vm-hol/vm-hol" Network profile

28.png

    • 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"

29.png

  • 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

30.png

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

31.png

  • On the "Create Snapshot" window supply a name for the snapshot (for-template) and unselect the "VM Memory" option

32.png

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.

33.png

  • On the "ol8" details webpage, click on "Snapshots" tab to see the list of snapshots available

34.png

  • Select the snapshot named "for-template" and click on the button "Make Template"

35.png

  • On the "New Template" window, supply a name for the template and confirm with "OK" to get it created

36.png

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.

37.png

  • 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.

38.png

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.

39.png

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

40.png

Further details on "Oracle Linux KVM" and "Oracle Linux Virtualization Manager" are available at on Oracle Documentation Library.

Tidak ada komentar:

Posting Komentar