Chapter 17. Templates

17.1. Virtual Machine Template Elements

The templates collection provides information about the virtual machine templates in a Red Hat Enterprise Virtualization environment. An API user accesses this information through the rel="templates" link obtained from the entry point URI.
Additional information can be retrieved for GET requests using the All-Content: true header.
The following table shows specific elements contained in a virtual machine template resource representation.

Table 17.1. Virtual machine template elements

Element Type Description Properties
link rel="disks" relationship A link to the disks sub-collection for virtual machine template resources.
link rel="nics" relationship A link to the nics sub-collection for virtual machine template resources.  
link rel="cdroms" relationship A link to the cdroms sub-collection for virtual machine template resources.
link rel="permissions" relationship A link to the permissions sub-collection for virtual machine template permissions.  
type enumerated The type of virtual machine the template provides. A list of enumerated values are available in capabilities.
status One of illegal, locked or ok The template status. These states are listed in template_states under capabilities.
memory integer The amount of memory allocated to the guest, in bytes.
cpu complex The CPU topology (i.e. number of sockets and cores) available to the guest.
os type= string, e.g. RHEL5 or WindowsXP The guest operating system type.
os boot dev= enumerated A list of boot devices, described by a dev attribute on a boot element. A list of enumerated values are available in capabilities.
os kernel string A path to a kernel image which the template is configured to boot from.  
os initrd string A path to an initrd image to be used with the kernel above.  
os cmdline string A kernel command line parameter string to be used with the kernel above.  
cluster id= GUID A reference to the template's host cluster.
vm id= GUID A reference to the VM on which this template is based.
domain id= GUID A reference to the template's domain.
creation_time xsd:dateTime format: YYYY-MM-DDThh:mm:ss The date and time at which this template was created.
origin One of rhev, ovirt, vmware or xen The system from which this template originated.
high_availability complex Set enabled to true if the VM should be automatically restarted if the host crashes. A priority element controls the order in which VMs are re-started.  
display complex The display type (either vnc or spice), port, and the number of monitors. The allow_reconnect Boolean value specifies if a client can reconnect to the machine via display.  
stateless Boolean: true or false A stateless template contains a snapshot of its disk image taken at boot and deleted at shutdown. This means state changes do not persist after a reboot.
usb complex Defines the USB policy for a virtual machine template. Requires an enabled element set to a Boolean value and a type element set to either native or legacy.  
placement_policy complex Sets the placement policy for virtual machine migration. Requires a default host= and an affinity (one of migratable, user_migratable or pinned). Leave the host element empty to set no preferred host.  
custom_properties complex A set of user-defined environment variable passed as parameters to custom scripts. Each custom_property contains name and value attributes. A list of enumerated values are available in capabilities.  
timezone tz database format: Area/Location The the Sysprep timezone setting for a Windows virtual machine template.  
domain complex The the Sysprep domain setting for a Windows virtual machine template. Requires a name from the domains collection.