15.6. Sub-Collections
15.6.1. Disks Sub-Collection
15.6.1.1. Disks Sub-Collection
disks sub-collection represents all virtual hard disk devices on a virtual machine. A disk representation contains the following elements:
Table 15.2. Elements for virtual machine disks
| Element | Type | Description | Properties |
|---|---|---|---|
link rel="statistics" | relationship | A link to the statistics sub-collection for a virtual machine's disk statistics. |
|
link rel="permissions" | relationship | A link to the permissions sub-collection. |
|
alias | string | The unique identifier for the disk. Use alias instead of name. | |
image_id | string | A reference to the virtual machine image stored on the defined storage domain. | |
storage_domains | complex | The storage domains associated with this disk. Each storage_domain element contains an id attribute with the associated storage domain's GUID. Update this element with POST to perform live migration of a disk from one data storage domain to another. |
[a] |
size | integer | Size of the disk in bytes. Deprecated; replaced by provisioned_size. |
|
provisioned_size | integer | The provisioned size of the disk in bytes. |
|
actual_size | integer | Actual size of the disk in bytes. |
|
status | One of illegal, invalid, locked or ok | The status of the disk device. These states are listed in disk_states under capabilities. |
|
interface | enumerated | The type of interface driver used to connect to the disk device. A list of enumerated values is available in capabilities. | |
format | enumerated | The underlying storage format. A list of enumerated values is available in capabilities. Copy On Write (COW) allows snapshots, with a small performance overhead. Raw does not allow snapshots, but offers improved performance. |
|
sparse | Boolean: true or false | true if the physical storage for the disk should not be preallocated. |
|
bootable | Boolean: true or false | true if this disk is to be marked as bootable. | |
shareable | Boolean: true or false | true to share the disk with multiple virtual machines. | |
wipe_after_delete | Boolean: true or false | true if the underlying physical storage for the disk should be zeroed when the disk is deleted. This increases security but is a more intensive operation and may prolong delete times. | |
propagate_errors | Boolean: true or false | true if disk errors should not cause virtual machine to be paused and, instead, disk errors should be propagated to the guest OS. | |
vm id= | GUID | The ID of the containing virtual machine. |
|
quota id= | GUID | Sets a quota for the disk. | |
lun_storage | complex | A reference to a direct LUN mapping for storage usage. Requires a logical_unit element that contains iSCSI or FCP device details. |
|
active | Boolean | Defines if the disk is connected to the virtual machine. |
|
read_only | Boolean | Defines if the disk is read-only. | |
link rel="disk_profile" | relationship | A link to the disk_profile sub-collection. | |
[a]
This element is only required if the disk is being added to a virtual machine and not created from a virtual machine template.
| |||
Example 15.11. An XML representation of a disk device
<disk id="ed7feafe-9aaf-458c-809a-ed789cdbd5b4"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks/
ed7feafe-9aaf-458c-809a-ed789cdbd5b4">
<link rel="statistics"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks/
ed7feafe-9aaf-458c-809a-ed789cdbd5b4/statistics"/>
<link rel="permissions"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks/
ed7feafe-9aaf-458c-809a-ed789cdbd5b4/permissions"/>
<vm id="082c794b-771f-452f-83c9-b2b5a19c0399"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399"/>
<alias>Classic_VM</alias>
<image_id>cac69a29-ccff-49d4-8a26-e4cdacd83e34</image_id>
<storage_domains>
<storage_domain id="fabe0451-701f-4235-8f7e-e20e458819ed"/>
</storage_domains>
<size>12884901888</size>
<provisioned_size>12884901888</provisioned_size>
<actual_size>1073741824</actual_size>
<type>system</type>
<status>
<state>ok</state>
</status>
<interface>virtio</interface>
<format>raw</format>
<bootable>true</bootable>
<shareable>true</shareable>
<wipe_after_disk>true</wipe_after_disk>
<propagate_errors>false</propagate_errors>
<active>true</active>
<read_only>false</read_only>
<disk_profile id="23fb2e0d-3062-4819-8165-3be88f2f587e"
href="/api/diskprofiles/23fb2e0d-3062-4819-8165-3be88f2f587e"/>
<lun_storage>
<logical_unit id="lun1">
...
</logical_unit>
</lun_storage>
</disk>
provisioned_size element is required. Use the storage_domains element to specify in which storage domain the disk will be created. Multiple disks for the same virtual machine can reside in different storage domains.
Example 15.12. Creating a new disk device on a virtual machine
POST /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks HTTP/1.1
Accept: application/xml
Content-type: application/xml
<disk>
<storage_domains>
<storage_domain id="fabe0451-701f-4235-8f7e-e20e458819ed"/>
</storage_domains>
<provisioned_size>8589934592</provisioned_size>
<type>system</type>
<interface>virtio</interface>
<format>cow</format>
<bootable>true</bootable>
</disk>
lun_storage element and the logical_unit element, which contains iSCSI or FCP device details.
Example 15.13. Creating a new direct LUN disk device on a virtual machine
POST /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks HTTP/1.1
Accept: application/xml
Content-type: application/xml
<disk>
<interface>virtio</interface>
<lun_storage>
<type>iscsi</type>
<logical_unit id="lun1">
<address>iscsi.example.com</address>
<port>3260</port>
<target>iqn.2010.05.com.example:iscsi.targetX</target>
</logical_unit>
</lun_storage>
</disk>
alias, description, storage_domains, provisioned_size, interface, bootable, shareable, wipe_after_delete and propagate_errors elements are updatable post-creation.
Example 15.14. Updating a virtual machine disk
PUT /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/disks/ed7feafe-9aaf-458c-809a-ed789cdbd5b4 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<disk>
<bootable>false</bootable>
<shareable>false</shareable>
</disk>
Example 15.15. Updating a virtual machine disk to 20GB
PUT /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/disks/ed7feafe-9aaf-458c-809a-ed789cdbd5b4 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<disk>
<provisioned_size>21474836480</provisioned_size>
</disk>
Note
Example 15.16. Renaming a virtual machine disk
PUT /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/disks/ed7feafe-9aaf-458c-809a-ed789cdbd5b4 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<disk>
<alias>Classic_VM2</alias>
</disk>
DELETE request.
Example 15.17. Removing a virtual machine disk
DELETE /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/disks/ed7feafe-9aaf-458c-809a-ed789cdbd5b4 HTTP/1.1 HTTP/1.1 204 No Content
15.6.1.2. Disk Cloning
clone element. Set the clone element to true within the disks sub-collection when creating a virtual machine. This clones a disk from the base template and attaches it to the virtual machine.
Example 15.18. Cloning a disk from a template
POST /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vm>
<name>cloned_vm</name>
<template id="64d4aa08-58c6-4de2-abc4-89f19003b886"/>
<cluster id="99408929-82cf-4dc7-a532-9d998063fa95"/>
<disks>
<clone>true</clone>
<disk id="4825ffda-a997-4e96-ae27-5503f1851d1b">
<format>COW</format>
</disk>
<disk id="42aef10d-3dd5-4704-aa73-56a023c1464c">
<format>COW</format>
</disk>
</disks>
</vm>
Important
alias search parameter instead of name.
15.6.1.3. Disk Statistics Sub-Collection
statistics sub-collection for disk-specific statistics. Each statistic contains the following elements:
Table 15.3. Elements for virtual machine disk statistics
| Element | Type | Description |
|---|---|---|
name | string | The unique identifier for the statistic entry. |
description | string | A plain text description of the statistic. |
unit | string | The unit or rate to measure the statistical values. |
type | One of GAUGE or COUNTER | The type of statistic measures. |
values type= | One of INTEGER or DECIMAL | The data type for the statistical values that follow. |
value | complex | A data set that contains datum. |
datum | see values type | An individual piece of data from a value. |
disk id= | relationship | A relationship to the containing disk resource. |
Table 15.4. Virtual machine disk statistic types
|
Name
|
Description
|
|---|---|
data.current.read |
The data transfer rate in bytes per second when reading from the disk.
|
data.current.write |
The data transfer rate in bytes per second when writing to the disk.
|
Example 15.19. An XML representation of a virtual machine's statistics sub-collection
<statistics>
<statistic id="33b9212b-f9cb-3fd0-b364-248fb61e1272"
href="/api/vms/3a42530e-3bc5-4094-829d-489257894c2a/disks/
f28ec14c-fc85-43e1-818d-96b49d50e27b/statistics/
33b9212b-f9cb-3fd0-b364-248fb61e1272">
<name>data.current.read</name>
<description>Read data rate</description>
<values type="DECIMAL">
<value>
<datum>0</datum>
</value>
</values>
<type>GAUGE</type>
<unit>BYTES_PER_SECOND</unit>
<disk id="f28ec14c-fc85-43e1-818d-96b49d50e27b"
href="/api/vms/3a42530e-3bc5-4094-829d-489257894c2a/
disks/f28ec14c-fc85-43e1-818d-96b49d50e27b"/>
</statistic>
...
</statistics>
Note
statistics sub-collection is read-only.
15.6.1.4. Floating Disk Attach and Detach Actions
rel="disks" collection using a POST request on the virtual machine's disks sub-collection. Include the id of the disk to attach.
Example 15.20. Attach a floating disk
POST /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks HTTP/1.1 Accept: application/xml Content-type: application/xml <disk id="d135f1c5-b5e1-4238-9381-b3277f5a3742"> </disk>
disks sub-collection using a DELETE request on the disk resource but ensure to include a detach Boolean element so the disk is not destroyed.
Example 15.21. Detach a disk from a virtual machine
DELETE /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks/
d135f1c5-b5e1-4238-9381-b3277f5a3742 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<detach>true</detach>
</action>
15.6.1.5. Disk Activate and Deactivate Actions
activate and deactivate actions to add and remove disks from a virtual machine.
Example 15.22. Action to activate a virtual machine disk
POST /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks/a42ada0e-1d69-410d-a392-a6980d873e5d/activate HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
Example 15.23. Action to deactivate a virtual machine disk
POST /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks/a42ada0e-1d69-410d-a392-a6980d873e5d/deactivate HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
Important
- Red Hat Enterprise Linux 6;
- Red Hat Enterprise Linux 5;
- Windows Server 2008; and,
- Windows Server 2003.
15.6.2. Network Interfaces Sub-Collection
15.6.2.1. Network Interfaces Sub-Collection
nics sub-collection represents all network interface devices on a virtual machine. A nic representation contains the following elements:
Table 15.5. Elements for virtual machine network interfaces
| Element | Type | Description | Properties |
|---|---|---|---|
link rel="statistics" | relationship | A link to the statistics sub-collection for a virtual machine's network interface statistics. |
|
network id= | GUID | A reference to the network which the interface should be connected. A blank network id is allowed. |
|
interface | enumerated | The type of driver used for the nic. A list of enumerated values is available in capabilities. | |
mac address= | string | The MAC address of the interface. |
|
port_mirroring | complex | Defines whether the NIC receives mirrored traffic. Define a networks element with a series of network id= references. | |
plugged | Boolean | Defines if the NIC is plugged in to the virtual machine. |
|
linked | Boolean | Defines if the NIC is linked to the virtual machine. |
|
Example 15.24. An XML representation of a network interface
<nic id="7a3cff5e-3cc4-47c2-8388-9adf16341f5e"
ref="/api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/nics/
7a3cff5e-3cc4-47c2-8388-9adf16341f5e">
<link rel="statistics"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/nics/
7a3cff5e-3cc4-47c2-8388-9adf16341f5e/statistics"/>
<name>nic1</name>
<interface>virtio</interface>
<mac address="00:1a:4a:16:84:07"/>
<network id="00000000-0000-0000-0000-000000000009"
href="/api/networks/00000000-0000-0000-0000-000000000009"/>
<vm id="cdc0b102-fbfe-444a-b9cb-57d2af94f401"
href="/api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401"/>
<port_mirroring>
<networks>
<network id="56087282-d7a6-11e1-af44-001a4a400e0c"
href="/api/networks/56087282-d7a6-11e1-af44-001a4a400e0c"/>
</networks>
</port_mirroring>
</nic>
name and network elements are required. Identify the network element with the id attribute or name element.
Example 15.25. Creating a virtual machine NIC
POST /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/nics HTTP/1.1
Accept: application/xml
Content-type: application/xml
<nic>
<name>nic1</name>
<network id="00000000-0000-0000-0000-000000000009"/>
</nic>
PUT request.
Example 15.26. Updating a virtual machine NIC
PUT /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/nics/
7a3cff5e-3cc4-47c2-8388-9adf16341f5e HTTP/1.1
Accept: application/xml
Content-type: application/xml
<nic>
<name>nic2</name>
<network id="00000000-0000-0000-0000-000000000010"/>
<type>e1000</type>
</nic>
DELETE request.
Example 15.27. Deleting a virtual machine NIC
DELETE /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/nics/ 7a3cff5e-3cc4-47c2-8388-9adf16341f5e HTTP/1.1 HTTP/1.1 204 No Content
Important
- Red Hat Enterprise Linux 6;
- Red Hat Enterprise Linux 5;
- Windows Server 2008; and,
- Windows Server 2003.
15.6.2.2. Network Interface Statistics Sub-Collection
statistics sub-collection for network interface statistics. Each statistic contains the following elements:
Table 15.6. Elements for a virtual machine's network interface statistics
| Element | Type | Description |
|---|---|---|
name | string | The unique identifier for the statistic entry. |
description | string | A plain text description of the statistic. |
unit | string | The unit or rate to measure the statistical values. |
type | One of GAUGE or COUNTER | The type of statistic measures. |
values type= | One of INTEGER or DECIMAL | The data type for the statistical values that follow. |
value | complex | A data set that contains datum. |
datum | see values type | An individual piece of data from a value. |
nic id= | relationship | A relationship to the containing nic resource. |
Table 15.7. Virtual machine NIC statistic types
|
Name
|
Description
|
|---|---|
data.current.rx |
The rate in bytes per second of data received.
|
data.current.tx |
The rate in bytes per second of data transmitted.
|
errors.total.rx |
Total errors from receiving data.
|
errors.total.tx |
Total errors from transmitting data.
|
Example 15.28. An XML representation of a virtual machine's NIC statistics sub-collection
<statistics>
<statistic id="ecd0559f-e88f-3330-94b4-1f091b0ffdf7"
href="/api/vms/3a42530e-3bc5-4094-829d-489257894c2a/nics/
6cd08e76-57c0-41ba-a728-7eba46ae1e36/statistics/
ecd0559f-e88f-3330-94b4-1f091b0ffdf7">
<name>data.current.rx</name>
<description>Receive data rate</description>
<values type="DECIMAL">
<value>
<datum>0</datum>
</value>
</values>
<type>GAUGE</type>
<unit>BYTES_PER_SECOND</unit>
<nic id="6cd08e76-57c0-41ba-a728-7eba46ae1e36"
href="/api/vms/3a42530e-3bc5-4094-829d-489257894c2a/
nics/6cd08e76-57c0-41ba-a728-7eba46ae1e36"/>
</statistic>
...
</statistics>
Note
statistics sub-collection is read-only.
15.6.3. Virtual NUMA Nodes Sub-Collection
numanodes sub-collection represents all virtual NUMA nodes on a virtual machine. A vm_numa_node representation contains the following elements:
Table 15.8. Elements for virtual NUMA nodes
| Element | Type | Description | Properties |
|---|---|---|---|
index | integer | The index number of the virtual NUMA node. |
|
memory | integer | The amount of memory allocated to the virtual NUMA node, in MB. |
|
cpu | complex | The CPU topology associated with this virtual NUMA node. Each core element contains an index attribute with the associated core's index number. |
|
vm id= | GUID | The ID of the containing virtual machine. |
|
numa_node_pins | complex | Pins the virtual NUMA node to a host NUMA node. Each numa_node_pin element contains a pinned="true" boolean and the host NUMA node's index number. |
Example 15.29. An XML representation of a virtual NUMA node
<vm_numa_node href="/api/vms/c7ecd2dc-dbd3-4419-956f-1249651c0f2b/numanodes/3290b973-ed3e-4f0b-bbf5-9be10d229e50" id="3290b973-ed3e-4f0b-bbf5-9be10d229e50">
<index>0</index>
<memory>1024</memory>
<cpu>
<cores>
<core index="0"/>
</cores>
</cpu>
<vm href="/api/vms/c7ecd2dc-dbd3-4419-956f-1249651c0f2b" id="c7ecd2dc-dbd3-4419-956f-1249651c0f2b"/>
<numa_node_pins>
<numa_node_pin pinned="true" index="0">
<host_numa_node id="417cdefb-8c47-4838-87f3-dd0498fdf6c7"/>
</numa_node_pin>
</numa_node_pins>
</vm_numa_node>index, memory, and cpu elements are required.
Example 15.30. Adding a new virtual NUMA node to a virtual machine
POST /api/vms/c7ecd2dc-dbd3-4419-956f-1249651c0f2b/numanodes HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vm_numa_node>
<index>0</index>
<memory>1024</memory>
<cpu>
<cores>
<core index="0"/>
</cores>
</cpu>
</vm_numa_nodes>PUT request. You can use a PUT request to pin a virtual NUMA node to a physical NUMA node on a host.
Example 15.31. Updating a virtual NUMA node
PUT /api/vms/c7ecd2dc-dbd3-4419-956f-1249651c0f2b/numanodes/3290b973-ed3e-4f0b-bbf5-9be10d229e50 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vm_numa_node>
<numa_node_pins>
<numa_node_pin pinned="true" index="0">
<host_numa_node id="417cdefb-8c47-4838-87f3-dd0498fdf6c7"/>
</numa_node_pin>
</numa_node_pins>
</vm_numa_node>DELETE request.
Example 15.32. Removing a virtual NUMA node
DELETE /api/vms/c7ecd2dc-dbd3-4419-956f-1249651c0f2b/numanodes/3290b973-ed3e-4f0b-bbf5-9be10d229e50 HTTP/1.1 HTTP/1.1 204 No Content
15.6.4. CD-ROMs Sub-Collection
cdroms sub-collection represents the CD-ROM device on a virtual machine. A cdrom representation contains the following elements:
Table 15.9. Elements for virtual machine CD-ROMs
| Element | Type | Description | Properties |
|---|---|---|---|
file id= | string/filename | A reference to an ISO image. |
Example 15.33. An XML representation of a CD-ROM device
<cdrom id="00000000-0000-0000-0000-000000000000"
href="/api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/cdroms/
00000000-0000-0000-0000-000000000000">
<file id="rhel-server-6.0-x86_64-dvd.iso"/>
<vm id="cdc0b102-fbfe-444a-b9cb-57d2af94f401"
href="/api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401"/>
</cdrom>
PUT request with a file id element to add a new CD-ROM resource.
Example 15.34. Adding a new CD-ROM file
PUT /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/cdroms/00000000-0000-0000-0000-000000000000 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<cdrom>
<file id="fedora-15-x86_64-dvd.iso"/>
</cdrom>
PUT request:
Example 15.35. Changing a CD-ROM file
PUT /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/cdroms/00000000-0000-0000-0000-000000000000 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<cdrom>
<file id="fedora-15-x86_64-dvd.iso"/>
</cdrom>
PUT request with an additional current URI argument:
Example 15.36. Changing a CD-ROM file during a current session
PUT /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/cdroms/00000000-0000-0000-0000-000000000000;current=true HTTP/1.1
Accept: application/xml
Content-type: application/xml
<cdrom>
<file id="fedora-15-x86_64-dvd.iso"/>
</cdrom>
PUT request to the cdroms sub-collection of a virtual machine, adding the current=true matrix parameter:
Example 15.37. Ejecting a CD-ROM file during a current session
PUT /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/cdroms/00000000-0000-0000-0000-000000000000;current=true HTTP/1.1 Accept: application/xml Content-type: application/xml <cdrom> <file id=""/> </cdrom>
Note
PUT request to the cdroms sub-collection of a virtual machine:
Example 15.38. Ejecting a CD-ROM file permanently
PUT /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/cdroms/00000000-0000-0000-0000-000000000000 HTTP/1.1 Accept: application/xml Content-type: application/xml <cdrom> <file id=""/> </cdrom>
Note
15.6.5. Snapshots Sub-Collection
15.6.5.1. Snapshots Sub-Collection
rel="snapshot" sub-collection that behaves similar to other collections.
snapshot element that contains the following sub-elements:
Table 15.10. Elements for virtual machine snapshots
| Element | Type | Description | Properties |
|---|---|---|---|
vm id= | GUID | The ID and URI of the virtual machine to which this snapshot pertains. |
|
link rel="restore" | relationship | A link to restore the snapshot of the virtual machine. |
|
link rel="prev" | relationship | A link to the previous snapshot of this virtual machine. |
|
type | string | The type of the snapshot. For example, active or regular. |
|
date | xsd:dateTime format: YYYY-MM-DDThh:mm:ss | The date and time at which the snapshot was created. |
|
snapshot_status | string | The current status of the snapshot. |
|
persist_memorystate | Boolean | Defines whether the snapshot also includes the state of the memory of the virtual machine at the time the snapshot was taken. |
|
Note
PUT.
Example 15.39. An XML representation of a virtual machine snapshot
<snapshot id="00000000-0000-0000-0000-000000000000"
href="/api/vms/00000000-0000-0000-0000-000000000000/snapshots/
00000000-0000-0000-0000-000000000000">
<actions>
<link rel="restore"
href="/api/vms/00000000-0000-0000-0000-000000000000/snapshots/
00000000-0000-0000-0000-000000000000/restore"/>
<link rel="prev"
href="/api/vms/00000000-0000-0000-0000-000000000000/snapshots/
</actions>
<vm id="00000000-0000-0000-0000-000000000000"
href="/api/vms/00000000-0000-0000-0000-000000000000"/>
<description>Virtual Machine 1 - Snapshot A</description>
<type>active</type>
<date>2010-08-16T14:24:29</date>
<snapshot_status>ok</snapshot_status>
<persist_memorystate>false</persist_memorystate>
</snapshot>
GET request for a virtual machine snapshot with the All-Content: true header to include additional OVF data with the representation of the snapshot.
Accept header defaults to application/xml if left blank, and the data is represented with HTML entities so as not to interfere with the XML tags. Specifying the Accept: application/json header will return the data in standard XML tagging. This example representation has been formatted from its standard block format to improve legibility.
Example 15.40. XML representation of additional ovf data for a snapshot
GET /api/vms/42ec2621-7ad6-4ca2-bd68-973a44b2562e/snapshots HTTP/1.1
All-Content: true
<?xml version='1.0' encoding='UTF-8'?>
<ovf:Envelope xmlns:ovf=\"http://schemas.dmtf.org/ovf/envelope/1/\"
xmlns:rasd=\"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData\"
xmlns:vssd=\"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ovf:version=\"3.5.0.0\">
<References>
<File ovf:href=\"ad353554-f668-46cf-aa3c-e57383de2c92/40456d92-3687-4a85-bab3-87b4cc7af459\"
ovf:id=\"40456d92-3687-4a85-bab3-87b4cc7af459\" ovf:size=\"10737418240\"
ovf:description=\"Active VM\"/>
<Nic ovf:id=\"be14bfc8-3dbd-4ac1-ba02-c6dfa7fc707c\"/>
</References>
<Section xsi:type=\"ovf:NetworkSection_Type\">
<Info>List of networks</Info><Network ovf:name=\"Network 1\"/>
</Section>
<Section
xsi:type=\"ovf:DiskSection_Type\">
<Info>List of Virtual Disks</Info>
<Disk ovf:diskId=\"40456d92-3687-4a85-bab3-87b4cc7af459\"
ovf:size=\"10\" ovf:actual_size=\"0\"
ovf:vm_snapshot_id=\"a209216d-2909-4802-8886-02aad55dccc8\"
ovf:parentRef=\"\"
ovf:fileRef=\"ad353554-f668-46cf-aa3c-e57383de2c92/40456d92-3687-4a85-bab3-87b4cc7af459\"
ovf:format=\"http://www.vmware.com/specifications/vmdk.html#sparse\"
ovf:volume-format=\"RAW\"
ovf:volume-type=\"Preallocated\"
ovf:disk-interface=\"VirtIO\"
ovf:boot=\"true\"
ovf:disk-alias=\"VM_01_Disk1\"
ovf:wipe-after-delete=\"false\"/>
</Section>
<Content
ovf:id=\"out\"
xsi:type=\"ovf:VirtualSystem_Type\">
<CreationDate>2015/02/09 13:53:53</CreationDate>
<ExportDate>2015/02/10 00:39:24</ExportDate>
<DeleteProtected>false</DeleteProtected>
<SsoMethod>guest_agent</SsoMethod>
<IsSmartcardEnabled>false</IsSmartcardEnabled>
<TimeZone>Etc/GMT</TimeZone><default_boot_sequence>0</default_boot_sequence>
<Generation>1</Generation>
<VmType>1</VmType>
<MinAllocatedMem>1024</MinAllocatedMem>
<IsStateless>false</IsStateless>
<IsRunAndPause>false</IsRunAndPause>
<AutoStartup>false</AutoStartup>
<Priority>1</Priority>
<CreatedByUserId>fdfc627c-d875-11e0-90f0-83df133b58cc</CreatedByUserId>
<IsBootMenuEnabled>false</IsBootMenuEnabled>
<IsSpiceFileTransferEnabled>true</IsSpiceFileTransferEnabled>
<IsSpiceCopyPasteEnabled>true</IsSpiceCopyPasteEnabled>
<Name>VM_01</Name>
<TemplateId>00000000-0000-0000-0000-000000000000</TemplateId>
<TemplateName>Blank</TemplateName>
<IsInitilized>true</IsInitilized>
<Origin>3</Origin>
<DefaultDisplayType>1</DefaultDisplayType>
<TrustedService>false</TrustedService>
<OriginalTemplateId>00000000-0000-0000-0000-000000000000</OriginalTemplateId>
<OriginalTemplateName>Blank</OriginalTemplateName>
<UseLatestVersion>false</UseLatestVersion>
<Section ovf:id=\"42ec2621-7ad6-4ca2-bd68-973a44b2562e\" ovf:required=\"false\" xsi:type=\"ovf:OperatingSystemSection_Type\">
<Info>Guest Operating System</Info>
<Description>other</Description>
</Section>
<Section xsi:type=\"ovf:VirtualHardwareSection_Type\">
<Info>1 CPU, 1024 Memeory</Info>
<System>
<vssd:VirtualSystemType>ENGINE 3.5.0.0</vssd:VirtualSystemType>
</System>
<Item>
<rasd:Caption>1 virtual cpu</rasd:Caption>
<rasd:Description>Number of virtual CPU</rasd:Description>
<rasd:InstanceId>1</rasd:InstanceId>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:num_of_sockets>1</rasd:num_of_sockets>
<rasd:cpu_per_socket>1</rasd:cpu_per_socket>
</Item>
<Item>
<rasd:Caption>1024 MB of memory</rasd:Caption>
<rasd:Description>Memory Size</rasd:Description>
<rasd:InstanceId>2</rasd:InstanceId>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits>
<rasd:VirtualQuantity>1024</rasd:VirtualQuantity>
</Item>
<Item>
<rasd:Caption>VM_01_Disk1</rasd:Caption>
<rasd:InstanceId>40456d92-3687-4a85-bab3-87b4cc7af459</rasd:InstanceId>
<rasd:ResourceType>17</rasd:ResourceType>
<rasd:HostResource>ad353554-f668-46cf-aa3c-e57383de2c92/40456d92-3687-4a85-bab3-87b4cc7af459</rasd:HostResource>
<rasd:Parent>00000000-0000-0000-0000-000000000000</rasd:Parent>
<rasd:Template>00000000-0000-0000-0000-000000000000</rasd:Template>
<rasd:ApplicationList></rasd:ApplicationList>
<rasd:StoragePoolId>00000002-0002-0002-0002-000000000255</rasd:StoragePoolId>
<rasd:CreationDate>2015/02/09 13:54:41</rasd:CreationDate>
<rasd:LastModified>1970/01/01 00:00:00</rasd:LastModified>
<rasd:last_modified_date>2015/02/10 00:39:22</rasd:last_modified_date>
<Type>disk</Type>
<Device>disk</Device>
<rasd:Address>{slot=0x06, bus=0x00, domain=0x0000, type=pci, function=0x0}</rasd:Address>
<BootOrder>1</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>false</IsReadOnly>
<Alias>virtio-disk0</Alias>
</Item>
<Item>
<rasd:Caption>Ethernet adapter on ovirtmgmt</rasd:Caption>
<rasd:InstanceId>be14bfc8-3dbd-4ac1-ba02-c6dfa7fc707c</rasd:InstanceId>
<rasd:ResourceType>10</rasd:ResourceType>
<rasd:OtherResourceType>ovirtmgmt</rasd:OtherResourceType>
<rasd:ResourceSubType>3</rasd:ResourceSubType>
<rasd:Connection>ovirtmgmt</rasd:Connection>
<rasd:Linked>true</rasd:Linked>
<rasd:Name>nic1</rasd:Name>
<rasd:MACAddress>00:1a:4a:87:cb:00</rasd:MACAddress>
<rasd:speed>1000</rasd:speed>
<Type>interface</Type>
<Device>bridge</Device>
<rasd:Address>{slot=0x03, bus=0x00, domain=0x0000, type=pci, function=0x0}</rasd:Address>
<BootOrder>0</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>false</IsReadOnly>
<Alias>net0</Alias>
</Item>
<Item>
<rasd:Caption>USB Controller</rasd:Caption>
<rasd:InstanceId>3</rasd:InstanceId>
<rasd:ResourceType>23</rasd:ResourceType>
<rasd:UsbPolicy>DISABLED</rasd:UsbPolicy>
</Item>
<Item>
<rasd:Caption>Graphical Controller</rasd:Caption>
<rasd:InstanceId>17bbf0db-7cf0-4529-9b53-dee6dee41cfd</rasd:InstanceId>
<rasd:ResourceType>20</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:SinglePciQxl>false</rasd:SinglePciQxl>
<Type>video</Type>
<Device>qxl</Device>
<rasd:Address>{slot=0x02, bus=0x00, domain=0x0000, type=pci, function=0x0}</rasd:Address>
<BootOrder>0</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>true</IsReadOnly>
<Alias>video0</Alias>
<SpecParams>
<vram>32768</vram>
<heads>1</heads>
</SpecParams>
</Item>
<Item>
<rasd:Caption>CDROM</rasd:Caption>
<rasd:InstanceId>7ce1bd14-d98a-43ba-beee-520bdfd9c698</rasd:InstanceId>
<rasd:ResourceType>15</rasd:ResourceType>
<Type>disk</Type>
<Device>cdrom</Device>
<rasd:Address>{bus=1, controller=0, type=drive, target=0, unit=0}</rasd:Address>
<BootOrder>0</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>true</IsReadOnly>
<Alias>ide0-1-0</Alias></Item>
<Item>
<rasd:ResourceType>0</rasd:ResourceType>
<rasd:InstanceId>8758c42f-7523-461b-82bb-41d91e46fd36</rasd:InstanceId>
<Type>controller</Type>
<Device>usb</Device>
<rasd:Address>{slot=0x01, bus=0x00, domain=0x0000, type=pci, function=0x2}</rasd:Address>
<BootOrder>0</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>false</IsReadOnly>
<Alias>usb0</Alias>
</Item>
<Item>
<rasd:ResourceType>0</rasd:ResourceType>
<rasd:InstanceId>58f1a596-553e-4e95-9331-64b5d8cebe2e</rasd:InstanceId>
<Type>controller</Type>
<Device>ide</Device>
<rasd:Address>{slot=0x01, bus=0x00, domain=0x0000, type=pci, function=0x1}</rasd:Address>
<BootOrder>0</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>false</IsReadOnly>
<Alias>ide0</Alias>
</Item>
<Item>
<rasd:ResourceType>0</rasd:ResourceType>
<rasd:InstanceId>2f4f8aa5-25eb-4a31-b841-50dc48fce4a7</rasd:InstanceId>
<Type>channel</Type>
<Device>unix</Device>
<rasd:Address>{bus=0, controller=0, type=virtio-serial, port=1}</rasd:Address>
<BootOrder>0</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>false</IsReadOnly>
<Alias>channel0</Alias>
</Item>
<Item>
<rasd:ResourceType>0</rasd:ResourceType>
<rasd:InstanceId>edaac3ed-2ab6-48b1-ae77-cc98f8b45bd8</rasd:InstanceId>
<Type>channel</Type>
<Device>unix</Device>
<rasd:Address>{bus=0, controller=0, type=virtio-serial, port=2}</rasd:Address>
<BootOrder>0</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>false</IsReadOnly>
<Alias>channel1</Alias>
</Item>
<Item>
<rasd:ResourceType>0</rasd:ResourceType>
<rasd:InstanceId>8dfed248-5164-41d3-8b6e-46aef9798d84</rasd:InstanceId>
<Type>channel</Type>
<Device>spicevmc</Device>
<rasd:Address>{bus=0, controller=0, type=virtio-serial, port=3}</rasd:Address>
<BootOrder>0</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>false</IsReadOnly>
<Alias>channel2</Alias>
</Item>
<Item>
<rasd:ResourceType>0</rasd:ResourceType>
<rasd:InstanceId>d184185e-ee19-442a-88f5-6a48f14164e1</rasd:InstanceId>
<Type>controller</Type>
<Device>virtio-scsi</Device>
<rasd:Address>{slot=0x04, bus=0x00, domain=0x0000, type=pci, function=0x0}</rasd:Address>
<BootOrder>0</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>false</IsReadOnly>
<Alias>scsi0</Alias>
</Item>
<Item>
<rasd:ResourceType>0</rasd:ResourceType>
<rasd:InstanceId>374d219e-e2ff-4755-a544-d537c87e82df</rasd:InstanceId>
<Type>controller</Type>
<Device>virtio-serial</Device>
<rasd:Address>{slot=0x05, bus=0x00, domain=0x0000, type=pci, function=0x0}</rasd:Address>
<BootOrder>0</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>false</IsReadOnly>
<Alias>virtio-serial0</Alias>
</Item>
<Item>
<rasd:ResourceType>0</rasd:ResourceType>
<rasd:InstanceId>cf3d7121-9db0-4fd1-bd12-50ce4e1ce379</rasd:InstanceId>
<Type>balloon</Type>
<Device>memballoon</Device>
<rasd:Address>{slot=0x07, bus=0x00, domain=0x0000, type=pci, function=0x0}</rasd:Address>
<BootOrder>0</BootOrder>
<IsPlugged>true</IsPlugged>
<IsReadOnly>true</IsReadOnly>
<Alias>balloon0</Alias>
<SpecParams>
<model>virtio</model>
</SpecParams>
</Item>
</Section>
</Content>
</ovf:Envelope>
POST method:
Example 15.41. Creating a Virtual Machine Snapshot
POST /api/vms/00000000-0000-0000-0000-000000000000/snapshots/ HTTP/1.1 Accept: application/xml Content-type: application/xml <snapshot> <description>Snapshot description</description> </snapshot>
Important
rel="restore" action link in the snapshot representation:
Example 15.42. Restoring a Virtual Machine Snapshot
POST /api/vms/00000000-0000-0000-0000-000000000000/snapshots/00000000-0000-0000-0000-000000000000/restore HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
15.6.5.2. Clone a Virtual Machine from a Snapshot
snapshots element to a standard representation of a virtual machine, which a user sends in a POST request to the vms collection.
snapshots element contains a snapshot id= element to define the specific snapshot to use as a basis for the virtual machine.
Example 15.43. Clone Virtual Machine from Snapshot
POST /api/vms HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vm>
...
<snapshots>
<snapshot id="3f68ee63-0016-4f8c-9b8a-11d9f28f7c9e"/>
</snapshots>
...
</vm>
15.6.6. Statistics Sub-Collection
statistics sub-collection for virtual machine-specific statistics. Each statistic contains the following elements:
Table 15.11. Elements for virtual machine statistics
| Element | Type | Description |
|---|---|---|
name | string | The unique identifier for the statistic entry. |
description | string | A plain text description of the statistic. |
unit | string | The unit or rate to measure the statistical values. |
type | One of GAUGE or COUNTER | The type of statistic measures. |
values type= | One of INTEGER or DECIMAL | The data type for the statistical values that follow. |
value | complex | A data set that contains datum. |
datum | see values type | An individual piece of data from a value. |
vm id= | relationship | A relationship to the containing vm resource. |
Table 15.12. Virtual machine statistic types
|
Name
|
Description
|
|---|---|
memory.installed |
Total memory in bytes allocated for the virtual machine's use.
|
memory.used |
Current memory in bytes used by the virtual machine.
|
cpu.current.guest |
Percentage of CPU used by the guest.
|
cpu.current.hypervisor |
Percentage of CPU overhead on the hypervisor.
|
cpu.current.total |
Total percentage of the current CPU in use.
|
Example 15.44. An XML representation of a virtual machine's statistics sub-collection
<statistics>
<statistic id="ef802239-b74a-329f-9955-be8fea6b50a4"
href="/api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/
statistics/ef802239-b74a-329f-9955-be8fea6b50a4">
<name>memory.installed</name>
<description>Total memory configured</description>
<unit>BYTES</unit>
<type>GUAGE</type>
<values type="DECIMAL">
<value>
<datum>1073741824<datum>
</value>
</values>
<vm id="cdc0b102-fbfe-444a-b9cb-57d2af94f401"
href="/api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401"/>
</statistic>
...
</statistics>
Note
statistics sub-collection is read-only.
15.6.7. Displaying Virtual Machine Session Information
GET request for a virtual machine and use the session sub-collection to view the session information for the user that initiated the SPICE console session and the user logged in to the virtual machine.
session information of a virtual machine is listed as a sub-collection:
Example 15.45. Displaying the session information of a virtual machine
GET /api/roles/a1a701f1-aa06-4f02-af17-158be31489b3/sessions HTTP/1.1
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<sessions>
<session id="37a6259c-c0c1-dae2-99a7-866489dff0bd"
href= "/api/vms/a1a701f1-aa06-4f02-af17-158be31489b3/sessions/37a6259c-c0c1-dae2-99a7-866489dff0bd">
<vm href= "/api/vms/a1a701f1-aa06-4f02-af17-158be31489b3" id="a1a701f1-aa06-4f02-af17-158be31489b3"/>
<ip address="192.0.2.0"/>
<user href= "/api/users/fdfc627c-d875-11e0-90f0-83df133b58cc" id="fdfc627c-d875-11e0-90f0-83df133b58cc">
<domain href= "/api/domains/696e7465-726e-616c-696e-7465726e616c" id="696e7465-726e-616c-696e-7465726e616c">
<name>internal</name>
</domain>
<user_name>admin</user_name>
</user>
<console_user>true</console_user>
</session>
<session id="37a6259c-c0c1-dae2-99a7-866489dff0bd"
href= "/api/vms/a1a701f1-aa06-4f02-af17-158be31489b3/sessions/37a6259c-c0c1-dae2-99a7-866489dff0bd" >
<vm href= "/api/vms/a1a701f1-aa06-4f02-af17-158be31489b3" id="a1a701f1-aa06-4f02-af17-158be31489b3"/>
<user>
<user_name>root</user_name>
</user>
</session>
</sessions>




Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.