Mastering KVM Virtualization
上QQ阅读APP看书,第一时间看更新

Hardware configuration examples

Let us take a look at some common hardware configurations; the domcapabilities options of virsh commands will show you the host capabilities. You can parse the output to find the exact supported value of a particular hardware configuration which you can present to a virtual machine. The following is the maximum vcpu that you can present to a VM:

[root@kvmHOST ~]# virsh domcapabilities | grep -i max
 <vcpu max='255'/>
[root@kvmHOST ~]#

As per the output, on this host a maximum of 255 vcpus can be defined for a virtual machine:

[root@kvmHOST ~]# virsh domcapabilities | grep diskDevice -A 5
 <enum name='diskDevice'>
 <value>disk</value>
 <value>cdrom</value>
 <value>floppy</value>
 <value>lun</value>
 </enum>
[root@kvmHOST ~]#

As per the output, disk, cdrom, floppy, and lun type devices can be used with the virtual machine on this host.

A lot of the physical node's hypervisor capabilities are exposed by this command. Explaining all of these capabilities is beyond the scope of this book, so you may want to try running this command in your own environment to see what it reports. Alternatively, it might be good to link it to a definitive online resource. Hence, we suggest that you run the command on your system and learn its capabilities.

Along with libvirt and the qemu-kvm packages, we also installed the virt-manager package on the system. As stated earlier, the virt-manager is a GUI tool for managing either a local or a remote hypervisor. For now, before finishing this chapter we just want to show you how to start a virt-manager and connect it to a local KVM hypervisor:

  1. First, ensure that the libvirtd service is in a running state and the virt-host-validate command passes all its checks.
  2. Then, navigate to the application from Menu | System tools | and click on Virtual Machine Manager.
  3. After clicking on the virt-manager, a Virtual Machine Manager graphical tool connected to the local hypervisor (qemu-kvm) should be opened as shown in the following screenshot:
  4. In case it could not search the local hypervisor and connect to it, click on the File menu and open the Add Connection dialogue box and fill in the connection details:

The preceding hypervisor item should be set to QEMU/KVM from the dropdown list and then you can click on Connect. That's it; it will connect the virt-manager to the local qemu-kvm hypervisor through the libvirt. If you want to connect to the remote hypervisor, check Connect to remote host and fill in the details.

If your virt-manager has successfully connected to the local KVM hypervisor, you are ready to create virtual machines. If the connection fails, check the /user-home/.cache/virt-manager/virt-manager.log log file.