Supported libvirt domain XML elements and attributes
You can generate examples of libvirt domain XML tags by running the virsh dumpxml <domain> command. Only specific libvirt domain XML elements and attributes are supported.
The format for libvirt domain XML is described by https://libvirt.org/formatdomain.html. The XML file specifies the guest and guest hardware details. The XML file is parsed, processed, and translated into a number of vCPE virtualization commands.
The following table lists the supported libvirt domain XML elements and attributes. The element and attribute values used in the following tables are examples only. For XML code snippets that include the supported elements and attributes, refer to Sample XML snippet for the libvirt domain XML file.
- The XML element names are shown with leading and trailing angle brackets, such as <name>.
- The XML attribute values are enclosed within single quotation marks, such as 'device'.
- Variables are denoted by the italicized font.
- The commands and XML snippets are in
monospace
font.
XML element or attribute | vCPE command | Description |
---|---|---|
|
The rest of the guest XML specifications must be enclosed by the <domain> element with a 'type' attribute of 'kvm'. | |
| set virtualization guest <guest-name>
|
The XML must contain a nonblank <name> element. The value of the <name> element becomes the guest name in the subsequent vCPE commands. |
| set virtualization guest <guest-name> cpus 2
|
The <vcpu> element defines the number of virtual CPUs assigned to the guest. |
| set virtualization guest <guest-name> cpuset 2-3
|
The <cpuset> element defines the virtual CPU affinity. |
| set virtualization guest <guest-name> memory 1024
| The <memory> element defines the amount of memory allocated to the guest. The default memory unit is kilobytes (blocks of 1024 bytes), but you can change it by using the <memory unit='..'> attribute. For more information, refer to xx. |
| set virtualization guest <guest-name> uuid d4d15d82-f21e-4b0a-bb91-3224cfbc8514
|
Defines the UUID assigned to the guest. The UUID is generated automatically if the element is not present. |
|
All hardware devices must be contained within the <devices> element. The <devices> subelements that are supported are: <disk>, <interface>, <graphics>, <video>, and <watchdog>. | |
| set virtualization guest <guest-name> devices disk <disk-id> device-type {cdrom | disk}
|
The <disk> element must always have a 'device' attribute with a valid value. Two types of disk devices are supported: 'cdrom' and 'disk'. The <disk-id> is automatically allocated on a per-guest basis, starting with the lowest unused disk-id (from 0 to 7). The <disk> element may contain a <target> or a <boot> subelement. |
| set virtualization guest <guest-name> devices disk <disk-id> bus-type ide
|
The attribute 'ide' is normally used for cdrom drives. |
| set virtualization guest <guest-name> devices disk <disk-id> bus-type sata
| |
| set virtualization guest <guest-name> devices disk <disk-id> bus-type virtio
|
The attribute 'virtio' is normally used for disk drives. |
| set virtualization guest <guest-name> devices disk <disk-id> boot-order 3
|
The <boot> element may contain an 'order' attribute whose value determines the boot order of the disk devices. If the <boot> element is missing, or if it does not have an 'order' attribute, the disk is given a default boot-order number equal to its <disk-id> plus 1. So disk 0 has a default boot-order of 1, disk 1 has a default boot-order of 2, and so on. |
|
The <interface> element must always have a 'type' attribute with a valid value. Two types of interface devices are supported: 'bridge' and 'ethernet'. Both interface types can contain a <target> element which can have a 'dev' attribute. | |
| ||
| set interfaces vhost dp0vhost<n> mac-address 52:54:00:4b:d6:fd
|
The <mac-address> element sets the MAC address of the interface. The value is generated automatically if the element is not present. |
| set interfaces vhost dp0vhost8
|
When the dev attribute is of the form dp0vhost<n> the deployment attempts to use or create the vhost interface with that particular name. |
| set interfaces vhost dp0vhost<n> description 'network-23'
|
If the 'dev' attribute value does not start with the 'dp0vhost' prefix, the next free vhost interface is automatically created with the set interfaces vhost command. The 'dev' value is inserted into the description field. |
| set interfaces vhost dp0vhost<n> bridge-group bridge br4
|
The 'bridge' type interface can contain a <source> element with a 'bridge' attribute whose value defines the name of the required bridge. The following three outcomes are possible on running the XML snippet.
|
| set interfaces vhost dp0vhost<n> address 192.168.1.1/24
|
The 'ethernet' type interface can contain an <ip> subelement that has 'address' and 'prefix' attributes whose values define the IP address of the interface. If there is a <target> element that specifies a vhost interface that already exists, the deployment fails if force is not specified. If force is specified, the existing vhost interface configuration is overwritten. |
|
Only the first <graphics> element in the XML file is processed. The <graphics> element must have a 'type' attribute with one of the following two values: 'spice' or 'vnc'. The <graphics> element must also have either a 'port' or an 'autoport' attribute. | |
| set virtualization guest <guest-name> devices display connection-type spice
|
If the 'port' attribute value is anything other than '-1', its value is reflected in the devices display port command. A 'port' attribute value of '-1' is treated as the equivalent of an 'autoport' attribute value of 'yes'. |
| set virtualization guest <guest-name> devices display connection-type vnc
|
When 'autoport' is 'yes', the first unused port number greater than 5899 is used. |
| set virtualization guest <guest-name> devices display password top-secret
|
The password passed and stored in the configuration is in clear text, and, therefore, is not secure. |
| set virtualization guest <guest-name> devices display address 127.0.0.1
|
The listen element (or attribute) causes the display to only listen for connections on the configured address. The configured address must be assigned to an interface of the vCPE host. |
|
|
Currently, the 'tlsPort' attribute is ignored. |
| set virtualization guest <guest-name> devices video ...
|
Only the first <video> element in the XML file is processed. The <video> element must have a <model> subelement with a 'type' attribute with one of the following three values: 'cirrus', 'qxl' or 'vga'. |
| set virtualization guest <guest-name> devices video model cirrus
| |
| set virtualization guest <guest-name> devices video model qxl
| |
| set virtualization guest <guest-name> devices video model vga
| |
| set virtualization guest <guest-name> devices video memory 8196
|
The <model> element may also have the optional 'vram' attribute. |
| set virtualization guest <guest-name> devices watchdog ...
|
Only the first <watchdog> element in the XML file is processed. The <watchdog> element must have the 'model' attribute, and its value must be 'i6300esb'. The <watchdog> element may also contain an optional 'action' attribute that can have one of the following values: 'none, 'poweroff' or 'reset'. |
| set virtualization guest <guest-name> devices watchdog action none
| |
| set virtualization guest <guest-name> devices watchdog action poweroff
| |
| set virtualization guest <guest-name> devices watchdog action reset
|