VMmanager 5 KVM: Administrator guide
Do you make friends with the documentation?
Share your opinion and complete a small poll
Take a survey

Virtualization management using libvirt

VMmanager uses libvirt for virtualization management.  The virsh utility is used for libvirt management. With virsh you can manage libvirt manually, however, we don't recommend doing so. If you do need to manage libvirt manually, please note the following peculiarities of VMmanager.

libvirt

libvirt is a software application that allows performing the following main functions: 

  • create and manage a virtual machine; 
  • manage a storage;
  • manage a network interface.

libvirt consists of the following components:

  • API library;
  • daemon (libvirtd);
  • command line utility (virsh).

Virtual machines are stored as XML-descriptions in the directory /etc/libvirt/<virtualization>, where <virtualization> is a virtualization type, e.g.  qemu.

For more information about the description of virtual machines, elements, attributes, and their values, please refer to the libvirt official documentation.

Note
Use the virsh utility to modify the virtual machines manually. Modifying the virtual machine in the control panel for the next time will reset its XML-description and delete the manual changes.


The XML-description of the virtual machine: 

Description of the virtual machine «ceph-client»
cat /etc/libvirt/qemu/ceph-client.xml

<domain type='kvm'>
  <name>ceph-client</name>
  <uuid>ba4ff807-bce2-40a3-8fb7-5a970de112ff</uuid>
  <memory unit='KiB'>262144</memory>
  <currentMemory unit='KiB'>262144</currentMemory>
  <blkiotune>
    <weight>500</weight>
  </blkiotune>
  <vcpu placement='static'>2</vcpu>
  <cputune>
    <shares>1000</shares>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.4.0'>hvm</type>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/ceph/ceph-client'/>
      <target dev='vda' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/ceph/volume4'/>
      <target dev='vdc' bus='virtio'/>
      <boot order='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='piix3-uhci'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <interface type='network'>
      <mac address='52:54:00:ad:9b:4b'/>
      <source network='NAT_192.168.0.1'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <graphics type='vnc' port='-1' autoport='yes' passwd='U1g3A8y9'>
      <listen type='network' network='DefaultBridge'/>
    </graphics>
    <video>
      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
</domain>

Learn more under libvirt official documentation.

virsh

virsh performs the following main functions: 

  • virsh create <vm> — create a virtual machine;
  • virsh edit <vm> — edit a virtual machine;
  • virsh list — shows a list of running virtual machine and their identifiers;
  • virsh start <vm>, virsh shutdown <vm> — run and disable virtual machines;
  • virsh destroy <vm> — destroy a virtual machine.
View details

Learn more under virsh official documentation or from the console:

man virsh