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

How it works...

In step 1, we installed the package on Ubuntu. The postinstall script started the libvirt daemon after the package was successfully installed. We verified that in step 2. 

In step 3, we examined the main configuration file for the service-side daemon - libvirtd. The process runs on the host OS and manages tasks for the virtual machines, such as configuration, life cycle management, migration, storage, and networking, as we are going to see later in this chapter. The userspace tools provided by the package we installed communicate with the daemon by sending requests on a local Unix domain socket. The default options we saw in step 3 are sufficient for the recipes in this chapter, but the configuration file is rather large. We encourage you to go through it and get familiar with the rest of the available configuration options. The file is very well documented.

In step 4, we disabled the security driver for QEMU. By default on RHEL/CentOS systems, QEMU is configured to use SELinux. Ubuntu distributions use AppArmor. For simplicity, we disable that functionality in this step; however, in production, you should take advantage of the extra security that a mandatory access control system such as SELinux provides.

Any change to the libvirt configuration file requires a restart. We restart the libvirt service in step 5.

There are few important configuration files that we need to be familiar, which are listed in step 6:

  •  libvirt.conf is the client-side configuration file for the virsh command that we are going to use in this recipe. We can specify URI aliases in it. The defaults should be sufficient.
  •  libvirtd.conf is the server-side configuration file, as we saw in step 3. It provides various security options, request limits, and logging controls. For the purpose of this book, the defaults are sufficient. 
  •  qemu.conf is the main configuration file for the QEMU driver that libvirt uses. We can configure options such as the VNC server address, the security driver that we saw in step 4 and the user and group for the QEMU process.
  • Once we create a QEMU/KVM virtual machine, the /etc/libvirt/qemu/ directory will contain the XML configuration definition for that instance, as we are going to see in the following recipes. 
  • Finally, the /etc/libvirt/qemu/networks/ directory contains configuration files for the networking. We are going to explore those in more detail later in this chapter.