KVM Virtualization on top of the vmware workstation 12 guest vm‘s

Kernel-based Virtual Machine (KVM) provides a possibility to use the Oracle (or Redhat/CentOS) Linux kernel as a hypervisor.

In my example, I will configure the KVM virtualization on top of the guest vm running OEL 7.4. The guest VM is running on top of the VMWare Workstation 12.

To enable the virtualization layer select VM settings and navigate to the Processor settings. Enable the setting „Virtualize Intel VT-x/EPT or AMD-V/RVI.“

The Guest VM is now enabled for the using of the nested virtualization (such kvm). Start the Guest VM.

Install and configure KVM virtualization on the OEL 7.4 Linux

On Oracle Enterprise Linux Systems is KVM built into the Oracle Linux Unbreakable Enterprise Kernel by default.

You can install virtualization packages in diverse ways:

Installing the virtualization server during Linux Installation

Software Selection Screen ->

  • Select Virtualization Host with GUI in the Base Environment section
  • Select the following package groups in the Add-ons for Selected Environment section:
    • Virtualization Client
    • Virtualization Hypervisor
    • Virtualization Tools

Installing the virtualization server packages on the already installed OEL 7 System:

The following packages are the minimum required for a virtualization host:

libvirt
qemu-kvm

You can install these packages via yum:

yum install libvirt qemu-kvm

Check if the following packages are installed:

[root@host04 ~]# yum info installed virt-manager virt-install virt-top virt-viewer libvirt-client

If not, install packages via yum:

[root@host04 ~]# yum install virt-manager virt-install virt-top virt-viewer libvirt-client

Alternatively, you can install the kvm virtualization via virtualization package groups.

The Virtualization Host package group contains the minimum set of packages required for a virtualization host.

Install via the group:

yum groupinstall "Virtualization Host"

Check the status of the libvirt deamon:

[root@host04 ~]# systemctl status libvirtd

libvirtd.service - Virtualization daemon
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-01-21 18:11:26 CET; 51min ago
Docs: man:libvirtd(8)
http://libvirt.org
Main PID: 6152 (libvirtd)
CGroup: /system.slice/libvirtd.service
─1582 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/defa...
─1583 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/defa...
└─6152 /usr/sbin/libvirtd

You can start the deamon via:

[root@host04 ~]# systemctl start libvirtd

Use „yum groupinfo“ to find out which packages are included in a group:

[root@host04 ~]# yum groupinfo "Virtualization Host"

Loaded plugins: langpacks, ulninfo
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Environment Group: Virtualization Host
Environment-Id: virtualization-host-environment
Description: Minimal virtualization host.
Mandatory Groups:
+base
+core
+virtualization-hypervisor
+virtualization-tools
Optional Groups:
+debugging
+network-file-system-client
+remote-system-management
+virtualization-platform

Check the loaded kvm modules:

[root@host04 ~]# lsmod | grep kvm

kvm_intel 167936 0
kvm 516096 1 kvm_intel

Check if the kvm deamon ist started and configured for starting after the reboot:

[root@host04 ~]# systemctl list-unit-files | grep libvirt

libvirt-guests.service disabled
libvirtd.service enabled

Use the systemctl to enable the kvm deamon:

[root@host04 ~]# systemctl enable libvirt-guests.service

Check again:

[root@host04 ~]# systemctl list-unit-files | grep libvirt

libvirt-guests.service enabled
libvirtd.service enabled

Creating the Guest VM’s

My OEL 7.4 Server (on top of the VM Workstation 12) has 4 vCPU’s and 8 GB RAM. In this Example, I will create the OEL 7.3 Linux guest VM with 2 vCPU and 2 GB RAM.

We can create the guest VM via command line tool virt-install or via GUI tool virt-manager.

Check the options of the command line tool virt-install:

[root@host04 ~]# virt-install -h

I will use for the creation of the guest VM the GUI Tool virt-manager.

Start the virt-manager:

[root@host04 ~]# virt-manager

Click on the „Create a new virtual machine“

Specify the installation media for the guest vm

Navigate to the ISO Image and specify the OS type and Version

Choose memory and amount of CPU’s for the vm

Create the virtual Storage for the Guest VM

Define the name of the VM and configure (if needed) the network settings

Click on „Finish“

The VM will be created:

The installation will be started…

Follow the installation screens and install the guest vm with Oracle Linux 7.3

The OEL 7.3 is now installed in tge guest vm.

Check the running vm using the virt-manager:

Configuration and Administration of the guest vm

After the VM is created, the configuration is saved in the xml file:

[root@host04 ~]# ll /etc/libvirt/qemu/OEL_7.3_Guest.xml

-rw-------. 1 root root 4106 Jan 27 17:40 /etc/libvirt/qemu/OEL_7.3_Guest.xml

Don’t configure the vm by editing of this file. Use the command virsh for this.

[root@host04 ~]# virsh edit OEL_7.3_Guest

With the virsh you can configure network and storage settings for the vm

Display VM configuration:

[root@host04 ~]# virsh dominfo OEL_7.3_Guest

Id: 1
Name: OEL_7.3_Guest
UUID: 10b280d6-c633-46d5-87f8-05a6252372bd
OS Type: hvm
State: running
CPU(s): 2
CPU time: 7.1s
Max memory: 2097152 KiB
Used memory: 2097152 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: selinux
Security DOI: 0
Security label: system_u:system_r:svirt_t:s0:c362,c732 (enforcing)

Administer the guest vm via command virsh

Check the vm status:

[root@host04 ~]# virsh list --all

Id Name State
----------------------------------------------------
2 OEL_7.3_Guest running

Shutdown vm:

[root@host04 ~]# virsh shutdown OEL_7.3_Guest

Domain OEL_7.3_Guest is being shutdown

[root@host04 ~]# virsh list --all

Id Name State
----------------------------------------------------
- OEL_7.3_Guest shut off

Start the vm:

[root@host04 ~]# virsh start OEL_7.3_Guest

Domain OEL_7.3_Guest started

[root@host04 ~]# virsh list --all

Id Name State
----------------------------------------------------
3 OEL_7.3_Guest running

Power off:

[root@host04 ~]# virsh destroy OEL_7.3_Guest

Domain OEL_7.3_Guest destroyed

[root@host04 ~]# virsh list

Id Name State
----------------------------------------------------

Suspend/resume:

[root@host04 ~]# virsh suspend OEL_7.3_Guest

Domain OEL_7.3_Guest suspended

[root@host04 ~]# virsh list

Id Name State
----------------------------------------------------
4 OEL_7.3_Guest paused

[root@host04 ~]# virsh resume OEL_7.3_Guest

Domain OEL_7.3_Guest resumed

[root@host04 ~]# virsh list
Id Name State
----------------------------------------------------
4 OEL_7.3_Guest running

Connect to the vm console:

[root@host04 ~]# virsh console OEL_7.3_Guest

Connected to domain OEL_7.3_Guest
Escape character is ^]

Command virt-top

The command line tool virt-top is similar to the unix command top and shows the resource allocation and consumption of the started vm.

[root@host04 ~]# virt-top

virt-top 08:43:10 - x86_64 4/4CPU 2591MHz 7708MB
1 domains, 1 active, 1 running, 0 sleeping, 0 paused, 0 inactive D:0 O:0 X:0
CPU: 0.4% Mem: 2048 MB (2048 MB by guests)
ID S RDRQ WRRQ RXBY TXBY %CPU %MEM TIME NAME
2 R 0 0 52 0 0.4 26.0 1:16.80 OEL_7.3_Guest

Command virt-clone

Duplicate a virtual machine, changing all the unique host side configuration like MAC address, name, etc.

Check options with:

[root@host04 ~]# virt-clone -h

 

Advertisements

Autor: Neselovskyi, Borys

Oracle Database / Middleware / Engineered System Infrastructure Solution Architect

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )

Verbinde mit %s