KVM/Libvirt

Objective

In this document, you’ll learn how to install Volterra Node on a server using KVM/Libvirt.

Figure: Hypervisor Topology

Prerequisites

Minimum

  • VES account

  • A server supporting hardware virtualization

    • KVM will only work if the CPU has the support of hardware virtualization, either Intel VT or AMD-V.
  • Operating System installed on the host

    • Ubuntu -16.X/18.X, CentOS 7.x/RHEL 7.x
  • At Least one interface with internet reachability

    • Volterra Node Zero Touch Provisioning requires Internet connectivity to Volterra Console
  • Volterra Node Software Image.

  • Please ensure that you have visited Create Site before starting installation.

  • By proceeding with the installation, download and/or access and use, as applicable, of the Volterra software, and/or Volterra platform, you acknowledge that you have read, understand, and agree to be bound by this agreement.

Check for Virtualization Support

$ egrep '(vmx|svm)' /proc/cpuinfo | wc -l
40
$ sudo kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

Install Packages

Ubuntu

$ sudo apt update
$ sudo apt install qemu qemu-kvm libvirt-bin  bridge-utils  virt-manager

CentOS/RHEL

$ yum install qemu-kvm qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer bridge-utils

Enable Hugepages

Step 1: Add Hugepage configuration to Grub config of the Hypervisor Host.

# /etc/default/grub

GRUB_CMDLINE_LINUX="default_hugepagesz=2M hugepagesz=2M hugepages=32000"

Step 2: Update Grub to make Hugepage configuration effective.

$ sudo update-grub
$ grub-mkconfig -o /boot/grub/grub.cfg
$ sudo reboot

Step 3: Check HugePage configuration after host reboot.

$ cat /proc/meminfo | grep Huge
AnonHugePages:   6100992 kB
ShmemHugePages:        0 kB
HugePages_Total:   32000
HugePages_Free:    32000
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

Create a Virtual Network

Step 1: Create a new libvirt network - sample_file (make sure to have a different subnet than the underlay network).

$ cat virtualnetwork1.xml

<network>
  <name>virtualnetwork1</name>
  <uuid>112d35c9-ec3b-4434-bd77-423f4ff1c5e5</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='bridge1' stp='on' delay='0'/>
  <mac address='52:54:00:e0:f9:97'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>

Step 2: Define the network from the file created above.

$ virsh net-define virtualnetwork1.xml

Step 3: Start the network and enable it for "autostart".

 $ virsh net-start virtualnetwork1
 $ virsh net-autostart virtualnetwork1

Step 4: List your libvirt networks to see if it reflects.

$ virsh net-list
  Name                 State      Autostart     Persistent
  ----------------------------------------------------------------
  default            active        yes                 yes
  virtualnetwork1    active        yes                 yes

Step 5: Optionally, list your bridge devices.

  $ brctl show
  bridge name     bridge id               STP enabled     interfaces
  virbr0          8000.5254003339b3       yes             virbr0-nic
  virbr1          8000.52540060f86e       yes             virbr1-nic

Install CE using CLI

Step 1: Create a Virtual Disk Image

Note: This is only required when installing the virtual machine using CLI.

qemu-img resize /var/lib/libvirt/images/coreos-stable-2135.6.0-201909151159.qcow2 +16GB

Step 2: Create a new virtual machine using ‘virt-install’ CLI.

virt-install --name ce-volterra --ram 8196 --vcpus=4 --accelerate --network virtualnetwork1,model=e1000 --disk path=/tmp/coreos-stable-2135.6.0-201909251726.qcow2  --boot hd --noreboot --autostart --graphics vnc,listen=192.168.8.11,port=15118 --cpu host-passthrough
  • name: guest-name
  • ram: ram allocation to guest (minimum: 8G, recommended: 16)
  • vcpus: cpu allocation to guest (minimum: 4)
  • network: name of virtual network that CE should be attached to
  • disk path: virtual disk path
  • graphics: set vnc to localhost address

Step 3: Start the Virtual Machine.

$ virsh start ce-madhukar-test-new
Domain ce-volterra started

Step 4: Verify Virtual Machine Status.

$ virsh list --all
 Id    Name                           State
----------------------------------------------------
 31    ce-volterra                  running

Step 5: Connect to Virtual Machine using Console.

$ virsh console 31
Connected to domain ce-madhukar-test-new
Escape character is ^]

This is localhost (Linux x86_64 4.19.56-coreos-r1) 22:53:47
SSH host key: SHA256:aIFHRiKcjFWaF47+9AAd6IGzCQ5M6suHzL0xH3QUaS4 (ECDSA)
SSH host key: SHA256:hmWTu9M5GYKDQcTgks7LDTkQK9LXKhQjSodVO14JICo (ED25519)
SSH host key: SHA256:ewojrrFELDNOZWIW+jp2UgSaQVikpnGupdbu9+ObgZw (RSA)
SSH host key: SHA256:dM0wUNcFqfJxVRGwwzOJBLtTY1JdptmtjyHXthnBKqY (DSA)
eth0: 192.168.122.197 fe80::5054:ff:fe89:abb8

Step 6: Connect to Virtual Machine using IP Address.

$ virsh domifaddr ce-volterra
 Name       MAC address          Protocol     Address
-------------------------------------------------------------------------------
 vnet0      52:54:00:89:ab:b8    ipv4         192.168.122.197/24

Install CE using VirtMgr (UI)

Installing using the Virt Manager requires ‘virt-manager’ package installed. Users can use the ‘virt-manager’ UI to interactively install Volterra CE on a hypervisor host.

Step 1: Initiate virt-manager on the hypervisor host.

$ virsh domifaddr ce-volterra
 Name       MAC address          Protocol     Address
-------------------------------------------------------------------------------
 vnet0      52:54:00:89:ab:b8    ipv4         192.168.122.197/24

Step 2: Create a virtual network from virt-manager UI.

Figure: Virtual Network Creation

Step 3: Create a new virtual machine.

Figure: Virtual Machine Creation

Step 4: Selecting Volterra CE ISO for install.

Figure: Installation Using ISO Option

Figure: Image Selection for Installation

Figure: Creation of Virtual Machine with ISO

Step 5: Configure Memory and CPUs.

Figure: Virtual Machine Memory and CPU Settings

Step 6: Configure disk image.

Figure: Disk Image Storage Setting

Step 7: Configure Network.

Figure: Virtual Machine Network Setting

Step 8: Configure NIC driver and CPU from customization menu.

Figure: Virtual Machine NIC Setting

Figure: Virtual Machine CPU Setting

Post-Install Configuration and Registration

At any point of time, you can login to the node via SSH using the admin username and Volterra123 password. Perform the following in order to set the node parameters.

Note: Login for the first time prompts you to update the password for the admin user.

Step 1: Log on to the node using your credentials. The login shell loads with the options to select for different activities. Use the TAB key to select options.

Figure: Node Login Shell Menu Options

Step 2: Select get-config and enter to verify the configuration.

Figure: Node Login Shell Get Configuration

Configuring Network

Step 3: Enter configure-network. Enter Yes for Do you want to configure ADVANCED network options? and Do you want to configure wifi? options.

Step 4: Enter the SSID and password for your wifi network.

Figure: Node Wifi Configuration

Note: Configuring network is optional. In case you intend to apply static configuration, then this option can be used.

Step 5: Select configure and enter. Enter the following fields.

  • Cluster Name
  • Registration Token
  • Hostname (master0 by default)
  • Longitude and Latitude information

Note: You must first perform network configuration using the configure-network before setting the other fields using the configure option in case you are applying static configuration for network.

Step 6: Enter Yes for confirm configuration.

Step 7: Select health option and enter to verify your wifi configuration and registration status.

Figure: Node Wifi Information
Figure: Node Registration Status

See Accept Registration in the Create a Site document to complete the registration.

Note: Select the factory-reset option to perform a reset and perform registration again.


Concepts


How-to’s

With Volterra Node installed, make sure to Create a Site.