Bookmark this page

Guided Exercise: Configuring Virtual Machines

In this exercise, you will deploy a virtual machine using the web console, and configure features made available by the new Q35 emulation.

Outcomes

You should be able to:

  • Install the required packages to enable virtualization

  • Configure the web console for the management of virtual machines

  • Create new virtual machines with the web console

Log in to workstation as student using student as the password. On workstation, run the lab virt-config start command to verify that the environment is ready and prepare the systems for the exercise.

[student@workstation ~]$ lab virt-config start

Note

In case workstation hangs using the web console, restart the virtual machine, and log into the web console with a new browser.

  1. Prepare servera for hosting virtual machines.

    1. Log in to servera as the root user.

      [student@workstation ~]$ ssh root@servera
    2. Use yum to install the virt module.

      [root@servera ~]# yum module install virt
      ...output omitted...
      Is this ok [y/N]: y
      ...output omitted...
      Complete!
    3. Confirm that the servera system supports virtualization.

      [root@servera ~]# virt-host-validate
        QEMU: Checking for hardware virtualization                   : PASS
        QEMU: Checking if device /dev/kvm exists                     : PASS
        QEMU: Checking if device /dev/kvm is accessible              : PASS
        QEMU: Checking if device /dev/vhost-net exists               : PASS
        QEMU: Checking if device /dev/net/tun exists                 : PASS
        QEMU: Checking for cgroup 'memory' controller support        : PASS
        QEMU: Checking for cgroup 'memory' controller mount-point    : PASS
        QEMU: Checking for cgroup 'cpu' controller support           : PASS
        QEMU: Checking for cgroup 'cpu' controller mount-point       : PASS
        QEMU: Checking for cgroup 'cpuacct' controller support       : PASS
        QEMU: Checking for cgroup 'cpuacct' controller mount-point   : PASS
        QEMU: Checking for cgroup 'cpuset' controller support        : PASS
        QEMU: Checking for cgroup 'cpuset' controller mount-point    : PASS
        QEMU: Checking for cgroup 'devices' controller support       : PASS
        QEMU: Checking for cgroup 'devices' controller mount-point   : PASS
        QEMU: Checking for cgroup 'blkio' controller support         : PASS
        QEMU: Checking for cgroup 'blkio' controller mount-point     : PASS
        QEMU: Checking for device assignment IOMMU support           : WARN (No ACPI DMAR table found, IOMMU either disabled in BIOS or not supported by this hardware platform)

      You can safely ignore the warning message because servera is itself a virtual machine and its hardware emulation does not provide IOMMU support.

      PCI pass-through, which allows you to attach a hardware device from the host system to your virtual machine, requires IOMMU.

  2. Configure the web console on servera for managing virtual machines.

    1. Confirm that the web console is running and enabled on servera.

      [root@servera ~]# systemctl is-active cockpit.socket
      active
      [root@servera ~]# systemctl is-enabled cockpit.socket
      enabled

      If that is not the case, start and enable the web console.

      [root@servera ~]# systemctl enable --now cockpit.socket
    2. On workstation, open Firefox and navigate to https://servera.lab.example.com:9090/. If a certificate error appears, accept the self-signed certificate.

      Select Reuse my password for privileged tasks and sign in using student as user name and student as the password.

      Click on servera.lab.example.com in the left navigation bar and notice that the menu on the left does not include an entry for managing virtual machines.

    3. On servera, install the cockpit-machines package.

      [root@servera ~]# yum install cockpit-machines
      ...output omitted...
      Is this ok [y/N]: y
      ...output omitted...
      Complete!
    4. In Firefox, refresh the web console's page. Notice the new Virtual Machines menu entry on the left.

  3. Use the web console to deploy an RHEL 8 virtual machine on servera according to the following requirements.

    Parameter Value
    VM name myrhel8
    RHEL 8 DVD ISO file /var/tmp/boot.iso on servera
    Operating system Red Hat Enterprise Linux 8.0
    Memory 1 GiB
    Storage size 10 GiB
    Kickstart URL http://172.25.250.254/min.ks
    1. In Firefox, click the Virtual Machines menu entry on the left of the web console. If you have not started the libvirtd Systemd service from the command line, then the web console offers to perform this step for you after the Yum virt module has been installed. Click Start libvirt to start and enable the libvirtd Systemd service.

    2. Click Create VM and fill in the form according to the following table.

      Parameter Value
      Name myrhel8
      Installation Source Type Filesystem
      Installation Source /var/tmp/boot.iso
      OS Vendor Red Hat, Inc
      Operating System Red Hat Enterprise Linux 8.0
      Memory 1 GiB
      Storage Size 10 GiB

      Click Create. If the state of the new virtual machine is in transition, refresh the web console's page. Click the myrhel8 virtual machine and click Install to start the installation.

    3. Use the kickstart at http://172.25.250.254/min.ks to perform an unattended installation.

      In the console, use the up arrow key to highlight Install Red Hat Enterprise Linux 8.0. Press the Tab key. At the end of the line, at the bottom of the console, add ks=http://172.25.250.254/min.ks and press Enter.

      Wait for the installation to complete. Because the virtual machine powers off after installation, click Run to start it.

  4. Inspect the new virtual machine details.

    1. Using the web console, in the console of the new virtual machine, log in as root, with redhat for the password.

      Run the dmidecode command to confirm that QEMU uses the new Q35 chipset emulation.

      [root@localhost ~]# dmidecode
      ...output omitted...
      Handle 0x0100, DMI type 1, 27 bytes
      System Information
      	Manufacturer: Red Hat
      	Product Name: KVM
      	Version: RHEL-7.6.0 PC (Q35 + ICH9, 2009)
      	Serial Number: Not Specified
      	UUID: c0dad148-a985-4f74-a894-fc4cf2468661
      	Wake-up Type: Power Switch
      	SKU Number: Not Specified
      	Family: Red Hat Enterprise Linux
      ...output omitted...
    2. Run the lspci command to inspect further the emulated hardware.

      [root@localhost ~]# lspci
      00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller
      00:01.0 VGA compatible controller: Red Hat, Inc. QXL paravirtual graphic card (rev 04)
      00:02.0 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
      00:02.1 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
      00:02.2 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
      00:02.3 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
      00:02.4 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
      00:02.5 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
      00:02.6 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
      00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
      00:1f.0 ISA bridge: Intel Corporation 82801IB (ICH9) LPC Interface Controller (rev 02)
      00:1f.2 SATA controller: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] (rev 02)
      00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 02)
      01:00.0 Ethernet controller: Red Hat, Inc. Virtio network device (rev 01)
      02:00.0 USB controller: Red Hat, Inc. QEMU XHCI Host Controller (rev 01)
      03:00.0 Communication controller: Red Hat, Inc. Virtio console (rev 01)
      04:00.0 SCSI storage controller: Red Hat, Inc. Virtio block device (rev 01)
      05:00.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon (rev 01)
      06:00.0 Unclassified device [00ff]: Red Hat, Inc. Virtio RNG (rev 01)

      Notice that the Q35 chipset emulation provides PCI Express ports and a SATA controller, but no ISA bus.

    3. Run the systemctl status qemu-guest-agent command to confirm that the installation process automatically deploys the qemu-guest-agent package and starts the service.

      [root@localhost ~]# systemctl status qemu-guest-agent
      * qemu-guest-agent.service - QEMU Guest Agent
         Loaded: loaded (/usr/lib/systemd/system/qemu-guest-agent.service; disabled; vendor preset: enabled)
         Active: active (running) since Thu 2019-02-07 03:41:41 EST; 1h 8min ago
       Main PID: 624 (qemu-ga)
          Tasks: 1 (limit: 6104)
         Memory: 908.0K
         CGroup: /system.slice/qemu-guest-agent.service
                 └─624 /usr/bin/qemu-ga --method=virtio-serial --path=/dev/virtio-ports/org.qemu.guest_agent.0 --blacklist=guest-file-open,guest-file-close,guest-f>
      
      Feb 07 03:41:41 localhost.localdomain systemd[1]: Started QEMU Guest Agent.

      The QEMU guest agent allows the host system to issue commands to the operating system running inside the virtual machine. For example, virtualization platforms use this feature to freeze the file systems inside the virtual machine when taking a snapshot.

    4. In the web console, explore the Overview, Disks, and Networks tabs for the new virtual machine.

      In the Networks tab, notice that you can only plug or unplug existing network devices, but you cannot create new devices. In those situations, use the virsh command or the deprecated virt-manager graphical tool.

    5. On servera, use the virsh command to confirm that QEMU uses the Q35 chipset emulation for your new virtual machine.

      [root@servera ~]# virsh dumpxml myrhel8
      <domain type='kvm' id='2'>
        <name>myrhel8</name>
        <uuid>c0dad148-a985-4f74-a894-fc4cf2468661</uuid>
        <metadata>
          <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
            <libosinfo:os id="http://redhat.com/rhel/8.0"/>
          </libosinfo:libosinfo>
          <cockpit_machines:data xmlns:cockpit_machines="https://github.com/cockpit-project/cockpit/tree/master/pkg/machines">
            <cockpit_machines:has_install_phase>false</cockpit_machines:has_install_phase>
            <cockpit_machines:install_source>/var/tmp/boot.iso</cockpit_machines:install_source>
            <cockpit_machines:os_variant>rhel8.0</cockpit_machines:os_variant>
          </cockpit_machines:data>
        </metadata>
        <memory unit='KiB'>1048576</memory>
        <currentMemory unit='KiB'>1048576</currentMemory>
        <vcpu placement='static'>1</vcpu>
        <resource>
          <partition>/machine</partition>
        </resource>
        <os>
          <type arch='x86_64' machine='pc-q35-rhel7.6.0'>hvm</type>
          <boot dev='hd'/>
        </os>
      ...output omitted...
    6. When you are done exploring, delete the virtual machine from the web console. Select the virtual machine and click Delete. Also, delete the associated storage file.

    7. Log off from servera.

      [root@servera ~]# exit
      [student@workstation ~]$ 
  5. Libvirt selects the machine chipset to emulate from the operating system you choose through the Operating System field in the web console or the --os-variant option of the virt-install command.

    Using the web console, create a new virtual machine, but this time, select Red Hat Enterprise Linux 6.10 (Santiago) as the operating system. Even though you are still using the RHEL 8 ISO to install the system, the virtualization platform emulates the older Intel 440FX chipset.

    1. In Firefox, click the Virtual Machines menu entry on the left of the web console. Click Create VM and fill in the form according to the following table.

      Parameter Value
      Name testi440fx
      Installation Source Type Filesystem
      Installation Source /var/tmp/boot.iso
      OS Vendor Red Hat, Inc
      Operating System Red Hat Enterprise Linux 6.10 (Santiago)
      Memory 1 GiB
      Storage Size 10 GiB

      Click Create. If the state of the new virtual machine is in transition, refresh the web console's page. Click the testi440fx virtual machine and click Install to start the installation.

    2. Use the kickstart at http://172.25.250.254/min.ks to perform an unattended installation.

      In the console, use the up arrow key to highlight Install Red Hat Enterprise Linux 8.0. Press the Tab key. At the end of the line, at the bottom of the console, add ks=http://172.25.250.254/min.ks and press Enter.

      Wait for the installation to complete. Because the virtual machine powers off after installation, click Run to start it.

    3. In the console of the new virtual machine, log in as root, with redhat for the password.

      Run the dmidecode command to confirm that QEMU uses the old Intel 440FX chipset emulation.

      [root@localhost ~]# dmidecode
      ...output omitted...
      Handle 0x0100, DMI type 1, 27 bytes
      System Information
      	Manufacturer: Red Hat
      	Product Name: KVM
      	Version: RHEL 7.6.0 PC (i440FX + PIIX, 1996)
      	Serial Number: Not Specified
      	UUID: 6d944c55-5045-4d7a-88bc-10c5ecca03dd
      	Wake-up Type: Power Switch
      	SKU Number: Not Specified
      	Family: Red Hat Enterprise Linux
      ...output omitted...
    4. Run the lspci command to inspect further the emulated hardware.

      [root@localhost ~]# lspci
      00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
      00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
      00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
      00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
      00:02.0 VGA compatible controller: Red Hat, Inc. QXL paravirtual graphic card (rev 04)
      00:03.0 Ethernet controller: Red Hat, Inc. Virtio network device
      00:04.0 Audio device: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) High Definition Audio Controller (rev 01)
      00:05.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03)
      00:05.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03)
      00:05.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03)
      00:05.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03)
      00:06.0 Communication controller: Red Hat, Inc. Virtio console
      00:07.0 SCSI storage controller: Red Hat, Inc. Virtio block device
      00:08.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon

      Notice this time that the Intel 440FX chipset emulation provides an ISA bus but no PCI Express (PCI-E) ports.

    5. When you are done exploring, delete the virtual machine from the web console. Select the virtual machine and click Delete. Also, delete the associated storage file.

Finish

From workstation, run lab virt-config finish to clean up any resources created for this exercise.

[student@workstation ~]$ lab virt-config finish

This concludes the guided exercise.

Revision: rh354-8.0-0e36520