Using the Red Hat Enterprise Virtualization Application Programming Interfaces
Legal Notice
Abstract
- Preface
- I. Introduction
- 1. Introduction
- 2. Authentication and Security
- 3. REST API Quick Start Example
- 3.1. REST API Quick Start Introduction
- 3.2. Example: Access API Entry Point
- 3.3. Example: List Data Center Collection
- 3.4. Example: List Host Cluster Collection
- 3.5. Example: List Logical Networks Collection
- 3.6. Example: List Host Collection
- 3.7. Example: Approve Host
- 3.8. Example: Create NFS Data Storage
- 3.9. Example: Create NFS ISO Storage
- 3.10. Example: Attach Storage Domains to Data Center
- 3.11. Example: Activate Storage Domains
- 3.12. Example: Create Virtual Machine
- 3.13. Example: Create Virtual Machine NIC
- 3.14. Example: Create Virtual Machine Storage Disk
- 3.15. Example: Attach ISO Image to Virtual Machine
- 3.16. Example: Start Virtual Machine
- 3.17. Example: Check System Events
- 4. Python Quick Start Example
- 4.1. Python Quick Start Introduction
- 4.2. Example: Accessing the API Entry Point using Python
- 4.3. Example: Listing the Data Center Collection using Python
- 4.4. Example: Listing the Cluster Collection using Python
- 4.5. Example: Listing the Logical Networks Collection using Python
- 4.6. Example: Listing the Host Collection using Python
- 4.7. Example: Approving a Host using Python
- 4.8. Example: Creating NFS Data Storage using Python
- 4.9. Example: Creating NFS ISO Storage using Python
- 4.10. Example: Attaching Storage Domains to a Data Center using Python
- 4.11. Example: Activating Storage Domains using Python
- 4.12. Example: Creating a Virtual Machine using Python
- 4.13. Example: Creating a Virtual Machine NIC using Python
- 4.14. Example: Creating a Virtual Machine Storage Disk using Python
- 4.15. Example: Attaching an ISO Image to a Virtual Machine using Python
- 4.16. Example: Starting a Virtual Machine using Python
- 4.17. Example: Checking System Events using Python
- II. REST Application Programming Interface
- 5. Entry Point
- 5.1. Accessing the API Entry Point
- 5.2. Product Information
- 5.3. Link Elements
- 5.4. Special Object Elements
- 5.5. Summary Element
- 5.6. RESTful Service Description Language (RSDL)
- 5.7. Backup-Restore API Overview
- 5.8. Full Virtual Machine Backups
- 5.9. Full Virtual Machine Restore
- 5.10. Red Hat Enterprise Virtualization Windows Guest VSS Support
- 5.11. QEMU Guest Agent Overview
- 5.12. VSS Transaction Flow
- 6. Compatibility Level Versions
- 7. Capabilities
- 7.1. Capabilities
- 7.2. Version-Dependent Capabilities
- 7.3. Current Version
- 7.4. Features
- 7.5. CPUs
- 7.6. Power Managers
- 7.7. Fence Types
- 7.8. Storage Types
- 7.9. Configuration Types
- 7.10. Storage Domain Types
- 7.11. Virtual Machine Types
- 7.12. Boot Devices
- 7.13. Display Types
- 7.14. NIC Interface Types
- 7.15. OS Types
- 7.16. Disk Formats
- 7.17. Disk Interfaces
- 7.18. Virtual Machine Affinities
- 7.19. Custom Properties
- 7.20. Boot Protocols
- 7.21. Error Handling
- 7.22. Storage Formats
- 7.23. Creation States
- 7.24. Power Management States
- 7.25. Host States
- 7.26. Host Non-Operational Details
- 7.27. Network States
- 7.28. Storage Domain States
- 7.29. Template States
- 7.30. Virtual Machine States
- 7.31. Virtual Machine Pause Details
- 7.32. Disk States
- 7.33. Host Network Interface Card States
- 7.34. Data Center States
- 7.35. Virtual Machine Device Types
- 7.36. Watchdog Models
- 7.37. Watchdog Actions
- 7.38. Gluster Volume Types
- 7.39. Gluster Transport Types
- 7.40. Permits
- 7.41. Scheduling Policies
- 7.42. Usages
- 7.43. NFS Versions
- 7.44. Power Management Proxy Types
- 7.45. CPU Modes
- 7.46. SCSI Generio I/O Options
- 7.47. Authentication Methods
- 7.48. Step Types
- 7.49. Payload Encodings
- 7.50. Gluster Volume Types
- 7.51. Transport Types
- 7.52. Gluster Volume States
- 7.53. Brick States
- 7.54. Reported Device Types
- 7.55. IP Versions
- 7.56. Snapshot Status
- 7.57. Content Types
- 7.58. Hook States
- 7.59. Stages
- 8. Common Features
- 9. Data Centers
- 10. Host Clusters
- 11. Networks
- 12. Storage Domains
- 13. Storage Connections
- 14. Hosts
- 15. Virtual Machines
- 16. Floating Disks
- 17. Templates
- 18. Virtual Machine Pools
- 19. Domains
- 20. Groups
- 21. Roles
- 22. Users
- 23. Tags
- 24. Events
- III. Python Sofware Development Kit
- 25. Software Development Kit Overview
- 26. Using the Software Development Kit
- 26.1. Connecting to the API using Python
- 26.2. Resources and Collections
- 26.3. Retrieving Resources from a Collection
- 26.4. Retrieving a Specific Resource from a Collection
- 26.5. Retrieving a List of Resources from a Collection
- 26.6. Adding a Resource to a Collection
- 26.7. Updating a Resource in a Collection
- 26.8. Removing a Resource from a Collection
- 26.9. Handling Errors
- 27. Python Reference Documentation
- IV. Java Software Development Kit
- 28. Software Development Kit Overview
- 29. Using the Software Development Kit
- 29.1. Connecting to the Red Hat Enterprise Virtualization Manager
- 29.2. Listing Entities
- 29.3. Modifying the Attributes of Resources
- 29.4. Getting a Resource
- 29.5. Adding Resources
- 29.6. Performing Actions on Resources
- 29.7. Listing Sub-Resources
- 29.8. Getting Sub-Resources
- 29.9. Adding Sub-Resources to a Resource
- 29.10. Modifying Sub-Resources
- 29.11. Performing Actions on Sub-Resources
- 29.12. Java SDK Best Practices
- 29.13. Working with SSL (Secure Socket Layer)
- A. API Usage with cURL
- B. UI Plugins
- C. Certificates
- D. Enumerated Value Translation
- E. Event Codes
- F. Timezones
- G. Revision History
1. Document Conventions
1.1. Typographic Conventions
Mono-spaced Bold
To see the contents of the filemy_next_bestselling_novelin your current working directory, enter thecat my_next_bestselling_novelcommand at the shell prompt and press Enter to execute the command.
Press Enter to execute the command.Press Ctrl+Alt+F2 to switch to a virtual terminal.
mono-spaced bold. For example:
File-related classes includefilesystemfor file systems,filefor files, anddirfor directories. Each class has its own associated set of permissions.
Choose → → from the main menu bar to launch Mouse Preferences. In the Buttons tab, select the Left-handed mouse check box and click to switch the primary mouse button from the left to the right (making the mouse suitable for use in the left hand).To insert a special character into a gedit file, choose → → from the main menu bar. Next, choose → from the Character Map menu bar, type the name of the character in the Search field and click . The character you sought will be highlighted in the Character Table. Double-click this highlighted character to place it in the Text to copy field and then click the button. Now switch back to your document and choose → from the gedit menu bar.
Mono-spaced Bold Italic or Proportional Bold Italic
To connect to a remote machine using ssh, typessh username@domain.nameat a shell prompt. If the remote machine isexample.comand your username on that machine is john, typessh john@example.com.Themount -o remount file-systemcommand remounts the named file system. For example, to remount the/homefile system, the command ismount -o remount /home.To see the version of a currently installed package, use therpm -q packagecommand. It will return a result as follows:package-version-release.
Publican is a DocBook publishing system.
1.2. Pull-quote Conventions
mono-spaced roman and presented thus:
books Desktop documentation drafts mss photos stuff svn books_tests Desktop1 downloads images notes scripts svgs
mono-spaced roman but add syntax highlighting as follows:
static int kvm_vm_ioctl_deassign_device(struct kvm *kvm,
struct kvm_assigned_pci_dev *assigned_dev)
{
int r = 0;
struct kvm_assigned_dev_kernel *match;
mutex_lock(&kvm->lock);
match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head,
assigned_dev->assigned_dev_id);
if (!match) {
printk(KERN_INFO "%s: device hasn't been assigned before, "
"so cannot be deassigned\n", __func__);
r = -EINVAL;
goto out;
}
kvm_deassign_device(kvm, match);
kvm_free_assigned_device(kvm, match);
out:
mutex_unlock(&kvm->lock);
return r;
}1.3. Notes and Warnings
Note
Important
Warning
2. Getting Help and Giving Feedback
2.1. Do You Need Help?
- Search or browse through a knowledge base of technical support articles about Red Hat products.
- Submit a support case to Red Hat Global Support Services (GSS).
- Access other product documentation.
2.2. We Need Feedback
Part I. Introduction
Table of Contents
- 1. Introduction
- 2. Authentication and Security
- 3. REST API Quick Start Example
- 3.1. REST API Quick Start Introduction
- 3.2. Example: Access API Entry Point
- 3.3. Example: List Data Center Collection
- 3.4. Example: List Host Cluster Collection
- 3.5. Example: List Logical Networks Collection
- 3.6. Example: List Host Collection
- 3.7. Example: Approve Host
- 3.8. Example: Create NFS Data Storage
- 3.9. Example: Create NFS ISO Storage
- 3.10. Example: Attach Storage Domains to Data Center
- 3.11. Example: Activate Storage Domains
- 3.12. Example: Create Virtual Machine
- 3.13. Example: Create Virtual Machine NIC
- 3.14. Example: Create Virtual Machine Storage Disk
- 3.15. Example: Attach ISO Image to Virtual Machine
- 3.16. Example: Start Virtual Machine
- 3.17. Example: Check System Events
- 4. Python Quick Start Example
- 4.1. Python Quick Start Introduction
- 4.2. Example: Accessing the API Entry Point using Python
- 4.3. Example: Listing the Data Center Collection using Python
- 4.4. Example: Listing the Cluster Collection using Python
- 4.5. Example: Listing the Logical Networks Collection using Python
- 4.6. Example: Listing the Host Collection using Python
- 4.7. Example: Approving a Host using Python
- 4.8. Example: Creating NFS Data Storage using Python
- 4.9. Example: Creating NFS ISO Storage using Python
- 4.10. Example: Attaching Storage Domains to a Data Center using Python
- 4.11. Example: Activating Storage Domains using Python
- 4.12. Example: Creating a Virtual Machine using Python
- 4.13. Example: Creating a Virtual Machine NIC using Python
- 4.14. Example: Creating a Virtual Machine Storage Disk using Python
- 4.15. Example: Attaching an ISO Image to a Virtual Machine using Python
- 4.16. Example: Starting a Virtual Machine using Python
- 4.17. Example: Checking System Events using Python
Chapter 1. Introduction
1.1. Introduction to the Red Hat Enterprise Virtualization REST API
- Broad client support - Any programming language, framework, or system with support for HTTP protocol can use the API;
- Self descriptive - Client applications require minimal knowledge of the virtualization infrastructure as many details are discovered at runtime;
- Resource-based model - The resource-based REST model provides a natural way to manage a virtualization platform.
- Integrate with enterprise IT systems.
- Integrate with third-party virtualization software.
- Perform automated maintenance or error checking tasks.
- Automate repetitive tasks in a Red Hat Enterprise Virtualization environment with scripts.
1.2. Representational State Transfer
GET, POST, PUT, and DELETE. This provides a stateless communication between the client and server where each request acts independent of any other request and contains all necessary information to complete the request.
1.3. Red Hat Enterprise Virtualization REST API Prerequisites
- A networked installation of Red Hat Enterprise Virtualization Manager, which includes the REST API;
- A client or programming library that initiates and receives HTTP requests from the REST API. For example:
- Red Hat Enterprise Virtualization 3.1 and higher provides a Python software development kit (SDK) that interacts with the REST API. This guide includes a Python Beginner Example to help developers get started with using the SDK.
- This guide includes basic instructions on use with cURL.
- Knowledge of Hypertext Transfer Protocol (HTTP), which is the protocol used for REST API interactions. The Internet Engineering Task Force provides a Request for Comments (RFC) explaining the Hypertext Transfer Protocol at http://www.ietf.org/rfc/rfc2616.txt; and,
- Knowledge of Extensible Markup Language (XML), which the API uses to construct resource representations. The W3C provides a full specification on XML at http://www.w3.org/TR/xml/.
Note
Red Hat Enterprise Virtualization entitlement pool if using certificate-based Red Hat Network, or the Red Hat Enterprise Virtualization Manager channel if using Red Hat Network classic. See the Red Hat Enterprise Virtualization Installation Guide for more information on subscribing your system(s) to download software from these locations.
Note
Chapter 2. Authentication and Security
2.1. TLS/SSL Certification
Important
Procedure 2.1. Obtaining a Certificate
- Method 1 - Use a command line tool to download the certificate from the Manager. Examples of command line tools include cURL and Wget, both of which are available on multiple platforms.
- If using cURL:
$ curl -o rhevm.cer http://[rhevm-server]/ca.crt
- If using Wget:
$ wget -O rhevm.cer http://[rhevm-server]/ca.crt
- Method 2 - Use a web browser to navigate to the certificate located at:
http://[rhevm-server]/ca.crt
Depending on the chosen browser, the certificate either downloads or imports into the browser's keystore.- If the browser downloads the certificate: save the file as
rhevm.cer.If the browser imports the certificate: export it from the browser's certification options and save it asrhevm.cer.
- Method 3 - Log in to the Manager, export the certificate from the truststore and copy it to your client machine.
- Log in to the Manager as the
rootuser. - Export the certificate from the truststore using the Java keytool management utility:
$ keytool -exportcert -keystore /etc/pki/ovirt-engine/.truststore -alias cacert -storepass mypass -file rhevm.cer
This creates a certificate file calledrhevm.cer. - Copy the certificate to the client machine using the
scpcommand:$ scp rhevm.cer [username]@[client-machine]:[directory]
rhevm.cer on your client machine. An API user imports this file into the certificate store of the client.
Procedure 2.2. Importing a Certificate to a Client
- Importing a certificate to a client relies on how the client itself stores and interprets certificates. This guide contains some examples on importing certificates. For clients not using Network Security Services (NSS) or Java KeyStore (JKS), see your client documentation for more information on importing a certificate.
2.2. HTTP Authentication
Authorization header, the API sends a 401 Authorization Required as a result:
Example 2.1. Access to the REST API without appropriate credentials
HEAD [base] HTTP/1.1 Host: [host] HTTP/1.1 401 Authorization Required
Authorization header for the specified realm. An API user encodes an appropriate Red Hat Enterprise Virtualization Manager domain and user in the supplied credentials with the username@domain:password convention.
Table 2.1. Encoding credentials for API access
| Item | Value |
|---|---|
| username | rhevmadmin |
| domain | domain.example.com |
| password | 123456 |
| unencoded credentials | rhevmadmin@domain.example.com:123456 |
| base64 encoded credentials | cmhldm1hZG1pbkBibGFjay5xdW1yYW5ldC5jb206MTIzNDU2 |
Example 2.2. Access to the REST API with appropriate credentials
HEAD [base] HTTP/1.1 Host: [host] Authorization: Basic cmhldm1hZG1pbkBibGFjay5xdW1yYW5ldC5jb206MTIzNDU2 HTTP/1.1 200 OK ...
Important
Important
2.3. Authentication Sessions
Procedure 2.3. Requesting an authenticated session
- Send a request with the
AuthorizationandPrefer: persistent-authHEAD [base] HTTP/1.1 Host: [host] Authorization: Basic cmhldm1hZG1pbkBibGFjay5xdW1yYW5ldC5jb206MTIzNDU2 Prefer: persistent-auth HTTP/1.1 200 OK ...
This returns a response with the following header:Set-Cookie: JSESSIONID=5dQja5ubr4yvI2MM2z+LZxrK; Path=/api; Secure
Note theJSESSIONID=value. In this example the value isJSESSIONID=5dQja5ubr4yvI2MM2z+LZxrK. - Send all subsequent requests with the
Prefer: persistent-authandcookieheader with theJSESSIONID=value. TheAuthorizationis no longer needed when using an authenticated session.HEAD [base] HTTP/1.1 Host: [host] Prefer: persistent-auth cookie: JSESSIONID=5dQja5ubr4yvI2MM2z+LZxrK HTTP/1.1 200 OK ...
- When the session is no longer required, perform a request to the sever without the
Prefer: persistent-authheader.HEAD [base] HTTP/1.1 Host: [host] Authorization: Basic cmhldm1hZG1pbkBibGFjay5xdW1yYW5ldC5jb206MTIzNDU2 HTTP/1.1 200 OK ...
Chapter 3. REST API Quick Start Example
- 3.1. REST API Quick Start Introduction
- 3.2. Example: Access API Entry Point
- 3.3. Example: List Data Center Collection
- 3.4. Example: List Host Cluster Collection
- 3.5. Example: List Logical Networks Collection
- 3.6. Example: List Host Collection
- 3.7. Example: Approve Host
- 3.8. Example: Create NFS Data Storage
- 3.9. Example: Create NFS ISO Storage
- 3.10. Example: Attach Storage Domains to Data Center
- 3.11. Example: Activate Storage Domains
- 3.12. Example: Create Virtual Machine
- 3.13. Example: Create Virtual Machine NIC
- 3.14. Example: Create Virtual Machine Storage Disk
- 3.15. Example: Attach ISO Image to Virtual Machine
- 3.16. Example: Start Virtual Machine
- 3.17. Example: Check System Events
3.1. REST API Quick Start Introduction
- A networked and configured host containing Red Hat Enterprise Virtualization Hypervisor;
- An ISO file containing a desired virtual machine operating system to install. This chapter uses Red Hat Enterprise Linux Server 6 for our installation ISO example; and
- Red Hat Enterprise Virtualization's engine-iso-uploader tool to upload your chosen operating system ISO file.
Important
Host: and Authorization: fields. However, these fields are mandatory and require data specific to your installation of Red Hat Enterprise Virtualization Manager.
Important
USER:PASS) and certificate location (CERT). Ensure all requests performed with cURL fulfill certification and authentication requirements.
Note
id attribute for each resource. Identifier codes in this example might appear different to the identifier codes in your Red Hat Enterprise Virtualization environment.
3.2. Example: Access API Entry Point
Example 3.1. Access the API entry point
GET /api HTTP/1.1 Accept: application/xml
# curl -X GET -H "Accept: application/xml" -u [USER:PASS] \
--cacert [CERT] https://[RHEVM Host]:443/api
HTTP/1.1 200 OK
Content-Type: application/xml
<api>
<link rel="capabilities" href="/api/capabilities"/>
<link rel="clusters" href="/api/clusters"/>
<link rel="clusters/search" href="/api/clusters?search={query}"/>
<link rel="datacenters" href="/api/datacenters"/>
<link rel="datacenters/search" href="/api/datacenters?search={query}"/>
<link rel="events" href="/api/events"/>
<link rel="events/search" href="/api/events?search={query}"/>
<link rel="hosts" href="/api/hosts"/>
<link rel="hosts/search" href="/api/hosts?search={query}"/>
<link rel="networks" href="/api/networks"/>
<link rel="roles" href="/api/roles"/>
<link rel="storagedomains" href="/api/storagedomains"/>
<link rel="storagedomains/search" href="/api/storagedomains?search={query}"/>
<link rel="tags" href="/api/tags"/>
<link rel="templates" href="/api/templates"/>
<link rel="templates/search" href="/api/templates?search={query}"/>
<link rel="users" href="/api/users"/>
<link rel="groups" href="/api/groups"/>
<link rel="domains" href="/api/domains"/>
<link rel="vmpools" href="/api/vmpools"/>
<link rel="vmpools/search" href="/api/vmpools?search={query}"/>
<link rel="vms" href="/api/vms"/>
<link rel="vms/search" href="/api/vms?search={query}"/>
<special_objects>
<link rel="templates/blank"
href="/api/templates/00000000-0000-0000-0000-000000000000"/>
<link rel="tags/root"
href="/api/tags/00000000-0000-0000-0000-000000000000"/>
</special_objects>
<product_info>
<name>Red Hat Enterprise Virtualization</name>
<vendor>Red Hat</vendor>
<version revision="0" build="0" minor="0" major="3"/>
</product_info>
<summary>
<vms>
<total>5</total>
<active>0</active>
</vms>
<hosts>
<total>1</total>
<active>1</active>
</hosts>
<users>
<total>1</total>
<active>1</active>
</users>
<storage_domains>
<total>2</total>
<active>2</active>
</storage_domains>
</summary>
</api>
rel= attribute of each collection link provides a reference point for each link. The next step in this example examines the datacenter collection, which is available through the rel="datacenter" link.
product_info, special_objects and summary. This data is covered in chapters outside this example.
3.3. Example: List Data Center Collection
Default data center on installation. This example uses the Default data center as the basis for our virtual environment.
Example 3.2. List data center collection
GET /api/datacenters HTTP/1.1 Accept: application/xml
# curl -X GET -H "Accept: application/xml" -u [USER:PASS] \
--cacert [CERT] \
https://[RHEVM Host]:443/api/datacenters
HTTP/1.1 200 OK
Content-Type: application/xml
<data_centers>
<data_center id="01a45ff0-915a-11e0-8b87-5254004ac988"
href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988">
<name>Default</name>
<description>The default Data Center</description>
<link rel="storagedomains"
href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988/
storagedomains"/>
<link rel="permissions"
href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988/permissions"/>
<storage_type>nfs</storage_type>
<storage_format>v1</storage_format>
<version minor="0" major="3"/>
<supported_versions>
<version minor="0" major="3"/>
</supported_versions>
<status>
<state>up</state>
</status>
</data_center>
</data_centers>
id code of your Default data center. This code identifies this data center in relation to other resources of your virtual environment.
storagedomains sub-collection. The data center uses this sub-collection to attach storage domains from the storagedomains main collection, which this example covers later.
3.4. Example: List Host Cluster Collection
Default host cluster on installation. This example uses the Default cluster to group resources in your Red Hat Enterprise Virtualization environment.
Example 3.3. List host clusters collection
GET /api/clusters HTTP/1.1 Accept: application/xml
# curl -X GET -H "Accept: application/xml" -u [USER:PASS] \
--cacert [CERT] \
https://[RHEVM Host]:443/api/clusters
HTTP/1.1 200 OK
Content-Type: application/xml
<clusters>
<cluster id="99408929-82cf-4dc7-a532-9d998063fa95"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95">
<name>Default</name>
<description>The default server cluster</description>
<link rel="networks"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks"/>
<link rel="permissions"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/permissions"/>
<cpu id="Intel Penryn Family"/>
<data_center id="01a45ff0-915a-11e0-8b87-5254004ac988"
href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988"/>
<memory_policy>
<overcommit percent="100"/>
<transparent_hugepages>
<enabled>false</enabled>
</transparent_hugepages>
</memory_policy>
<scheduling_policy/>
<version minor="0" major="3"/>
<error_handling>
<on_error>migrate</on_error>
</error_handling>
</cluster>
</clusters>
id code of your Default host cluster. This code identifies this host cluster in relation to other resources of your virtual environment.
Default cluster is associated with the Default data center through a relationship using the id and href attributes of the data_center element.
networks sub-collection contains a list of associated network resources for this cluster. The next section examines the networks collection in more detail.
3.5. Example: List Logical Networks Collection
rhevm network on installation. This network acts as the management network for Red Hat Enterprise Virtualization Manager to access hypervisor hosts.
Default cluster and is a member of the Default data center. This example uses the rhevm network to connect our virtual machines.
Example 3.4. List logical networks collection
GET /api/networks HTTP/1.1 Accept: application/xml
# curl -X GET -H "Accept: application/xml" -u [USER:PASS] \
--cacert [CERT] \
https://[RHEVM Host]:443/api/networks
HTTP/1.1 200 OK
Content-Type: application/xml
<networks>
<network id="00000000-0000-0000-0000-000000000009"
href="/api/networks/00000000-0000-0000-0000-000000000009">
<name>rhevm</name>
<description>Management Network</description>
<data_center id="01a45ff0-915a-11e0-8b87-5254004ac988"
href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988"/>
<stp>false</stp>
<status>
<state>operational</state>
</status>
<display>false</display>
</network>
</networks>
rhevm network is attached to the Default data center through a relationship using the data center's id code.
rhevm network is also attached to the Default cluster through a relationship in the cluster's network sub-collection.
3.6. Example: List Host Collection
hypervisor registered with the virtualization environment.
Example 3.5. List hosts collection
GET /api/hosts HTTP/1.1 Accept: application/xml
# curl -X GET -H "Accept: application/xml" -u [USER:PASS] \
--cacert [CERT] \
https://[RHEVM Host]:443/api/hosts
HTTP/1.1 200 OK
Accept: application/xml
<hosts>
<host id="0656f432-923a-11e0-ad20-5254004ac988"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988">
<name>hypervisor</name>
<actions>
<link rel="install"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/install"/>
<link rel="activate"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/activate"/>
<link rel="fence"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/fence"/>
<link rel="deactivate"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/deactivate"/>
<link rel="approve"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/approve"/>
<link rel="iscsilogin"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/iscsilogin"/>
<link rel="iscsidiscover"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/iscsidiscover"/>
<link rel="commitnetconfig"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/
commitnetconfig"/>
</actions>
<link rel="storage"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/storage"/>
<link rel="nics"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/nics"/>
<link rel="tags"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/tags"/>
<link rel="permissions"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/permissions"/>
<link rel="statistics"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/statistics"/>
<address>10.64.14.110</address>
<status>
<state>non_operational</state>
</status>
<cluster id="99408929-82cf-4dc7-a532-9d998063fa95"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95"/>
<port>54321</port>
<storage_manager>true</storage_manager>
<power_management>
<enabled>false</enabled>
<options/>
</power_management>
<ksm>
<enabled>false</enabled>
</ksm>
<transparent_hugepages>
<enabled>true</enabled>
</transparent_hugepages>
<iscsi>
<initiator>iqn.1994-05.com.example:644949fe81ce</initiator>
</iscsi>
<cpu>
<topology cores="2"/>
<name>Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz</name>
<speed>2993</speed>
</cpu>
<summary>
<active>0</active>
<migrating>0</migrating>
<total>0</total>
</summary>
</host>
</hosts>
id code of your Default host. This code identifies this host in relation to other resources of your virtual environment.
Default cluster and accessing the nics sub-collection shows this host has a connection to the rhevm network.
3.7. Example: Approve Host
hypervisor host resource contains an approve action. A user accesses this action's URI with a POST request.
Example 3.6. Approve a pre-configured Red Hat Enterprise Virtualization Hypervisor host
POST /api/hosts/0656f432-923a-11e0-ad20-5254004ac988/approve HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<action/>" \
https://[RHEVM Host]:443/api/hosts/0656f432-923a-11e0-ad20-5254004ac988/approve
action element.
approve action only for Red Hat Enterprise Virtualization Hypervisor hosts. Red Hat Enterprise Linux hosts require a different process to connect to the virtualization environment.
status for hypervisor changes from non_operational to up.
3.8. Example: Create NFS Data Storage
POST request, with the storage domain representation included, sent to the URL of the storage domain collection.
Example 3.7. Create an NFS data storage domain
POST /api/storagedomains HTTP/1.1
Accept: application/xml
Content-type: application/xml
<storage_domain>
<name>data1</name>
<type>data</type>
<storage>
<type>nfs</type>
<address>192.168.0.10</address>
<path>/data1</path>
</storage>
<host>
<name>hypervisor</name>
</host>
</storage_domain>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<storage_domain><name>data1</name><type>data</type> \
<storage><type>nfs</type><address>192.168.0.10</address> \
<path>/data1</path></storage> \
<host><name>hypervisor</name></host></storage_domain>" \
https://[RHEVM Host]:443/api/storagedomains
data1 with an export path of 192.168.0.10:/data1 and sets access to the storage domain through the hypervisor host. The API also returns the following representation of the newly created storage domain resource.
HTTP/1.1 200 OK
Accept: application/xml
<storage_domain id="9ca7cb40-9a2a-4513-acef-dc254af57aac"
href="/api/storagedomains/9ca7cb40-9a2a-4513-acef-dc254af57aac">
<name>data1</name>
<link rel="permissions"
href="/api/storagedomains/9ca7cb40-9a2a-4513-acef-dc254af57aac/
permissions"/>
<link rel="files"
href="/api/storagedomains/9ca7cb40-9a2a-4513-acef-dc254af57aac/files"/>
<type>data</type>
<master>false</master>
<storage>
<type>nfs</type>
<address>192.168.0.10</address>
<path>/data1</path>
</storage>
<available>175019917312</available>
<used>27917287424</used>
<committed>10737418240</committed>
<storage_format>v1</storage_format>
<host id="0656f432-923a-11e0-ad20-5254004ac988"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988">
</storage_domain>
3.9. Example: Create NFS ISO Storage
POST request, with the storage domain representation included, sent to the URL of the storage domain collection.
Example 3.8. Create an NFS ISO storage domain
POST /api/storagedomains HTTP/1.1
Accept: application/xml
Content-type: application/xml
<storage_domain>
<name>iso1</name>
<type>iso</type>
<storage>
<type>nfs</type>
<address>192.168.0.10</address>
<path>/iso1</path>
</storage>
<host>
<name>hypervisor</name>
</host>
</storage_domain>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<storage_domain><name>iso1</name><type>iso</type> \
<storage><type>nfs</type><address>192.168.0.10</address> \
<path>/iso1</path></storage> \
<host><name>hypervisor</name></host></storage_domain>" \
https://[RHEVM Host]:443/api/storagedomains
iso1 with an export path of 192.168.0.10:/iso1 and gets access to the storage domain through the hypervisor host. The API also returns the following representation of the newly created storage domain resource.
HTTP/1.1 200 OK
Accept: application/xml
<storage_domain id="00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da"
href="/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da">
<name>iso1</name>
<link rel="permissions"
href="/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/
permissions"/>
<link rel="files"
href="/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/files"/>
<type>iso</type>
<host id="" href="">
<master>false</master>
<storage>
<type>nfs</type>
<address>192.168.0.10</address>
<path>/iso1</path>
</storage>
<available>82678120448</available>
<used>18253611008</used>
<committed>0</committed>
<storage_format>v1</storage_format>
<host id="0656f432-923a-11e0-ad20-5254004ac988"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988">
</storage_domain>
3.10. Example: Attach Storage Domains to Data Center
data1 and iso1 storage domains to the Default data center.
Example 3.9. Attach data1 storage domain to the Default data center
POST /api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988/storagedomains HTTP/1.1 Accept: application/xml Content-type: application/xml <storage_domain> <name>data1</name> </storage_domain>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<storage_domain><name>data1</name></storage_domain>" \
https://[RHEVM Host]:443/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988/storagedomains
Example 3.10. Attach iso1 storage domain to the Default data center
POST /api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988/storagedomains HTTP/1.1 Accept: application/xml Content-type: application/xml <storage_domain> <name>iso1</name> </storage_domain>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<storage_domain><name>iso1</name></storage_domain>" \
https://[RHEVM Host]:443/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988/storagedomains
POST requests place our two new storage_domain resources in the storagedomains sub-collection of the Default data center. This means the storagedomain sub-collection contains attached storage domains of the data center.
3.11. Example: Activate Storage Domains
data1 and iso1 storage domains for the Red Hat Enterprise Virtualization Manager's use.
Example 3.11. Activate data1 storage domain
POST /api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/ 9ca7cb40-9a2a-4513-acef-dc254af57aac/activate HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<action/>" \
https://[RHEVM Host]:443/api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/9ca7cb40-9a2a-4513-acef-dc254af57aac/activate
Example 3.12. Activate iso1 storage domain
POST /api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/ 00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/activate HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<action/>"
https://[RHEVM Host]:443/api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/activate
3.12. Example: Create Virtual Machine
vm1 on the Default cluster using the virtualization environment's Blank template as a basis. The request also defines the virtual machine's memory as 512 MB and sets the boot device to a virtual hard disk.
Example 3.13. Create a virtual machine
POST /api/vms HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vm>
<name>vm1</name>
<cluster>
<name>default</name>
</cluster>
<template>
<name>Blank</name>
</template>
<memory>536870912</memory>
<os>
<boot dev="hd"/>
</os>
</vm>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<vm><name>vm1</name><cluster><name>default</name> \
</cluster><template><name>Blank</name></template> \
<memory>536870912</memory><os><boot dev='hd'/></os></vm>" \
https://[RHEVM Host]:443/api/vms
HTTP/1.1 200 OK
Accept: application/xml
<vm id="6efc0cfa-8495-4a96-93e5-ee490328cf48"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48">
<name>vm1</name>
<actions>
<link rel="shutdown"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/shutdown"/>
<link rel="start"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/start"/>
<link rel="stop"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/stop"/>
<link rel="suspend"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/suspend"/>
<link rel="detach"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/detach"/>
<link rel="export"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/export"/>
<link rel="move"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/move"/>
<link rel="ticket"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/ticket"/>
<link rel="migrate"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/migrate"/>
</actions>
<link rel="disks"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/disks"/>
<link rel="nics"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/nics"/>
<link rel="cdroms"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/cdroms"/>
<link rel="snapshots"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/snapshots"/>
<link rel="tags"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/tags"/>
<link rel="permissions"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/permissions"/>
<link rel="statistics"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/statistics"/>
<type>desktop</type>
<status>
<state>down</state>
</status>
<memory>536870912</memory>
<cpu>
<topology cores="1" sockets="1"/>
</cpu>
<os type="Unassigned">
<boot dev="cdrom"/>
</os>
<high_availability>
<enabled>false</enabled>
<priority>0</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
</display>
<cluster id="99408929-82cf-4dc7-a532-9d998063fa95"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95"/>
<template id="00000000-0000-0000-0000-000000000000"
href="/api/templates/00000000-0000-0000-0000-000000000000"/>
<start_time>2011-06-15T04:48:02.167Z</start_time>
<creation_time>2011-06-15T14:48:02.078+10:00</creation_time>
<origin>rhev</origin>
<stateless>false</stateless>
<placement_policy>
<affinity>migratable</affinity>
</placement_policy>
<memory_policy>
<guaranteed>536870912</guaranteed>
</memory_policy>
</vm>
3.13. Example: Create Virtual Machine NIC
rhevm network.
Example 3.14. Create a virtual machine NIC
POST /api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/nics HTTP/1.1
Accept: application/xml
Content-type: application/xml
<nic>
<interface>virtio</interface>
<name>nic1</name>
<network>
<name>rhevm</name>
</network>
</nic>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<nic><name>nic1</name><network><name>rhevm</name></network></nic>" \
https://[RHEVM Host]:443/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/nics
3.14. Example: Create Virtual Machine Storage Disk
Example 3.15. Create a virtual machine storage disk
POST /api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/disks HTTP/1.1
Accept: application/xml
Content-type: application/xml
<disk>
<storage_domains>
<storage_domain id="9ca7cb40-9a2a-4513-acef-dc254af57aac"/>
</storage_domains>
<size>8589934592</size>
<type>system</type>
<interface>virtio</interface>
<format>cow</format>
<bootable>true</bootable>
</disk>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<disk><storage_domains> \
<storage_domain id='9ca7cb40-9a2a-4513-acef-dc254af57aac'/> \
</storage_domains><size>8589934592</size><type>system</type> \
<interface>virtio</interface><format>cow</format> \
<bootable>true</bootable></disk>" \
https://[RHEVM Host]:443/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/disks
storage_domain element tells the API to store the disk on the data1 storage domain.
3.15. Example: Attach ISO Image to Virtual Machine
iso1 ISO domain for the virtual machines to use. Red Hat Enterprise Virtualization Platform provides an uploader tool that ensures that the ISO images are uploaded into the correct directory path with the correct user permissions.
files sub-collection to view the file resource:
Example 3.16. View the files sub-collection in an ISO storage domain
GET /api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/files HTTP/1.1 Accept: application/xml
# curl -X GET -H "Accept: application/xml" -u [USER:PASS] --cacert [CERT] \
https://[RHEVM Host]:443/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/files
<files>
<file id="rhel-server-6.0-x86_64-dvd.iso"
href="/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/
files/rhel-server-6.0-x86_64-dvd.iso.iso">
<name>rhel-server-6.0-x86_64-dvd.iso.iso</name>
<storage_domain id="00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da"
href="/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da"/>
</file>
</files>
rhel-server-6.0-x86_64-dvd.iso to our example virtual machine.
Example 3.17. Attach an ISO image to the virtual machine
POST /api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/cdroms HTTP/1.1 Accept: application/xml Content-type: application/xml <cdrom> <file id="rhel-server-6.0-x86_64-dvd.iso"/> </cdrom>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<cdrom><file id='rhel-server-6.0-x86_64-dvd.iso'/></cdrom>" \
https://[RHEVM Host]:443/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/cdroms
3.16. Example: Start Virtual Machine
start action.
Example 3.18. Start the virtual machine
POST /api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/start HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<vm>
<os>
<boot dev="cdrom"/>
</os>
</vm>
</action>
# curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
-u [USER:PASS] --cacert [CERT] \
-d "<action><vm><os><boot dev='cdrom'/></os></vm></action>" \
https://[RHEVM Host]:443/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48/start
disk for all future boots.
3.17. Example: Check System Events
start action for the vm1 creates several entries in the events collection. This example lists the events collection and identifies events specific to the API starting a virtual machine.
Example 3.19. List the events collection
GET /api/events HTTP/1.1 Accept: application/xml
# curl -X GET -H "Accept: application/xml" -u [USER:PASS] \
--cacert [CERT] \
https://[RHEVM Host]:443/api/events
<events>
...
<event id="103" href="/api/events/103">
<description>User admin logged out.</description>
<code>31</code>
<severity>normal</severity>
<time>2011-06-29T17:42:41.544+10:00</time>
<user id="80b71bae-98a1-11e0-8f20-525400866c73"
href="/api/users/80b71bae-98a1-11e0-8f20-525400866c73"/>
</event>
<event id="102" href="/api/events/102">
<description>vm1 was started by admin (Host: hypervisor).</description>
<code>153</code>
<severity>normal</severity>
<time>2011-06-29T17:42:41.499+10:00</time>
<user id="80b71bae-98a1-11e0-8f20-525400866c73"
href="/api/users/80b71bae-98a1-11e0-8f20-525400866c73"/>
<vm id="6efc0cfa-8495-4a96-93e5-ee490328cf48"
href="/api/vms/6efc0cfa-8495-4a96-93e5-ee490328cf48"/>
<host id="0656f432-923a-11e0-ad20-5254004ac988"
href="/api/hosts/0656f432-923a-11e0-ad20-5254004ac988"/>
</event>
<event id="101" href="/api/events/101">
<description>User admin logged in.</description>
<code>30</code>
<severity>normal</severity>
<time>2011-06-29T17:42:40.505+10:00</time>
<user id="80b71bae-98a1-11e0-8f20-525400866c73"
href="/api/users/80b71bae-98a1-11e0-8f20-525400866c73"/>
</event>
...
</events>
id="101"- The API authenticates with theadminuser's username and password.id="102"- The API, acting as theadminuser, startsvm1on thehypervisorhost.id="103"- The API logs out of theadminuser account.
Chapter 4. Python Quick Start Example
- 4.1. Python Quick Start Introduction
- 4.2. Example: Accessing the API Entry Point using Python
- 4.3. Example: Listing the Data Center Collection using Python
- 4.4. Example: Listing the Cluster Collection using Python
- 4.5. Example: Listing the Logical Networks Collection using Python
- 4.6. Example: Listing the Host Collection using Python
- 4.7. Example: Approving a Host using Python
- 4.8. Example: Creating NFS Data Storage using Python
- 4.9. Example: Creating NFS ISO Storage using Python
- 4.10. Example: Attaching Storage Domains to a Data Center using Python
- 4.11. Example: Activating Storage Domains using Python
- 4.12. Example: Creating a Virtual Machine using Python
- 4.13. Example: Creating a Virtual Machine NIC using Python
- 4.14. Example: Creating a Virtual Machine Storage Disk using Python
- 4.15. Example: Attaching an ISO Image to a Virtual Machine using Python
- 4.16. Example: Starting a Virtual Machine using Python
- 4.17. Example: Checking System Events using Python
4.1. Python Quick Start Introduction
Red Hat Enterprise Virtualization entitlement pool if using certificate-based Red Hat Network, or the Red Hat Enterprise Virtualization Manager channel if using Red Hat Network classic. See the Red Hat Enterprise Virtualization Installation Guide for more information on subscribing your system(s) to download software from these locations.
Note
- A networked installation of Red Hat Enterprise Virtualization Manager.
- A networked and configured Red Hat Enterprise Virtualization Hypervisor.
- An ISO image file containing an operating system for installation on a virtual machine.
- A working understanding of both the logical and physical objects that make up a Red Hat Enterprise Virtualization environment.
- A working understanding of the Python programming language.
Important
Note
id attribute for each resource. Identifier codes in these examples might appear different to the identifier codes in your Red Hat Enterprise Virtualization environment.
Note
pydoc for the ovirtsdk.infrastructure.errors module.
4.2. Example: Accessing the API Entry Point using Python
API class, which acts as the entry point for the API.
Example 4.1. Accessing the API entry point using Python
rhevm.demo.redhat.com. To connect the example creates an instance of the API class If connection was successful a message is printed. Finally the disconnect() method of the API class is called to close the connection.
API class in this example are:
- The
urlof the Manager to connect to. - The
usernameof the user to authenticate as. - The
passwordof the user to authenticate as. - The
ca_filewhich is the path to a certificate. The certificate is expected to be a copy of the one for the Manager's Certificate Authority. It can be obtained fromhttps://HOST/ca.crt.
API class supports other parameters. Only mandatory parameters are specified in this example.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API (url="https://HOST", username="USER", password="PASS", ca_file="ca.crt") print "Connected to %s successfully!" % api.get_product_info().name api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
Connected to Red Hat Enterprise Virtualization Manager successfully!
4.3. Example: Listing the Data Center Collection using Python
API class provides access to a data centers collection, named datacenters. This collection contains all data centers in the environment.
Example 4.2. Listing the Data Center Collection using Python
datacenters collection. It also outputs some basic information about each data center in the collection.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API (url="https://HOST", username="USER", password="PASS", ca_file="ca.crt") dc_list = api.datacenters.list() for dc in dc_list: print "%s (%s)" % (dc.get_name(), dc.get_id()) api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
Default data center exists, and it is not activated, the example outputs:
Default (d8b74b20-c6e1-11e1-87a3-00163e77e2ed)
4.4. Example: Listing the Cluster Collection using Python
clusters. This collection contains all clusters in the environment.
Example 4.3. Listing the clusters collection using Python
clusters collection. It also outputs some basic information about each cluster in the collection.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API (url="https://HOST", username="USER", password="PASS", ca_file="ca.crt") c_list = api.clusters.list() for c in c_list: print "%s (%s)" % (c.get_name(), c.get_id()) api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
Default cluster exists, the example outputs:
Default (99408929-82cf-4dc7-a532-9d998063fa95)
4.5. Example: Listing the Logical Networks Collection using Python
API class provides access to a logical networks collection, named networks. This collection contains all logical networks in the environment.
Example 4.4. Listing the logical networks collection using Python
networks collection. It also outputs some basic information about each network in the collection.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API(url="https://HOST", username="USER", password="PASS", ca_file="ca.crt") n_list = api.logicalnetworks.list() for n in n_list: print "%s (%s)" % (n.get_name(), n.get_id()) api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
rhevm (00000000-0000-0000-0000-000000000009)
4.6. Example: Listing the Host Collection using Python
API class provides access to a hosts collection, named hosts. This collection contains all hosts in the environment.
Example 4.5. Listing the host collection using Python
hosts collection.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API(url="HOST", username="USER", password="PASS", ca_file="ca.crt") h_list = api.hosts.list() for h in h_list: print "%s (%s)" % (h.get_name(), h.get_id()) api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
Atlantic, has been attached the example outputs:
Atlantic (5b333c18-f224-11e1-9bdd-00163e77e2ed)
4.7. Example: Approving a Host using Python
Example 4.6. Approving a host using Python
approve method for a host named Atlantic.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API(url="HOST", username="USER", password="PASS", ca_file="ca.crt") h = api.hosts.get(name="Atlantic") if(h.approve()): print "Host '%s' approved (Status: %s)." % (h.get_name(), h.get_status().get_state()) else: print "Approval of '%s' failed." % h.get_name() api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
approve request is successful then the script will output:
Host 'Atlantic' approved (Status: Up).
status reflects that the host has been approved and is now considered to be up.
4.8. Example: Creating NFS Data Storage using Python
API class provides access to a storage domains collection, named storagedomains. This collection contains all the storage domains in the environment. The storagedomains collection can also be used to add and remove storage domains.
Note
Example 4.7. Creating NFS data storage using Python
storagedomains collection. Adding an NFS storage domain in Python can be broken down into several steps:
- Identify the data center to which the storage must be attached, using the
getmethod of thedatacenterscollection.dc = api.datacenters.get(name="Default")
- Identify the host that must be used to attach the storage, using the
getmethod of thehostscollection.h = api.hosts.get(name="Atlantic")
- Define the
Storageparameters for the NFS storage domain. In this example the NFS location192.0.43.10/storage/datais being used.s = params.Storage(address="192.0.43.10", path="/storage/data", type_="nfs")
- Request creation of the storage domain, using the
addmethod of thestoragedomainscollection. In addition to theStorageparameters it is necessary to pass:- A name for the storage domain.
- The data center object that was retrieved from the
datacenterscollection. - The host object that was retrieved from the
hostscollection. - The type of storage domain being added (
data,iso, orexport). - The storage format to use (
v1,v2, orv3).
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API (url="HOST", username="USER", password="PASS", ca_file="ca.crt") dc = api.datacenters.get(name="Default") h = api.hosts.get(name="Atlantic") s = params.Storage(address="192.0.43.10", path="/storage/data", type_="nfs") sd_params = params.StorageDomain(name="data1", data_center=dc, host=h, type_="data", storage_format="v3", storage=s) try: sd = api.storagedomains.add(sd_params) print "Storage Domain '%s' added (%s)." % (sd.get_name()) except Exception as ex: print "Adding storage domain failed: %s" % ex api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
add method call is successful then the script will output:
Storage Domain 'data1' added (bd954c03-d180-4d16-878c-2aedbdede566).
4.9. Example: Creating NFS ISO Storage using Python
Note
Example 4.8. Creating NFS ISO storage using Python
storagedomains collection. Adding an NFS storage domain in Python can be broken down into several steps:
- Identify the data center to which the storage must be attached, using the
getmethod of thedatacenterscollection.dc = api.datacenters.get( name="Default" )
- Identify the host that must be used to attach the storage, using the
getmethod of thehostscollection.h = api.hosts.get(name="Atlantic")
- Define the
Storageparameters for the NFS storage domain. In this example the NFS location192.0.43.10/storage/isois being used.s = params.Storage(address="192.0.43.10", path="/storage/iso", type_="nfs")
- Request creation of the storage domain, using the
addmethod of thestoragedomainscollection. In addition to theStorageparameters it is necessary to pass:- A name for the storage domain.
- The data center object that was retrieved from the
datacenterscollection. - The host object that was retrieved from the
hostscollection. - The type of storage domain being added (
data,iso, orexport). - The storage format to use (
v1,v2, orv3).
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API (url="HOST", username="USER", password="PASS", ca_file="ca.crt") dc = api.datacenters.get(name="Default") h = api.hosts.get(name="Atlantic") s = params.Storage(address="192.0.43.10", path="/storage/iso", type_="nfs") sd_params = params.StorageDomain(name="iso1", data_center=dc, host=h, type_="iso", storage_format="v3", storage=s) try: sd = api.storagedomains.add(sd_params) print "Storage Domain '%s' added (%s)." % (sd.get_name()) except Exception as ex: print "Adding storage domain failed: %s" % ex api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
add method call is successful then the script will output:
Storage Domain 'iso1' added (789814a7-7b90-4a39-a1fd-f6a98cc915d8).
4.10. Example: Attaching Storage Domains to a Data Center using Python
Example 4.9. Attaching storage domains to a data center using Python
data1, and an ISO storage domain named iso1 to the default data center. The attach action is facilitated by the add method of the data center's storagedomains collection.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API (url="HOST", username="USER", password="PASS", ca_file="ca.crt") dc = api.datacenters.get(name="Default") sd_data = api.storagedomains.get(name="data1") sd_iso = api.storagedomains.get(name="iso1") try: dc_sd = dc.storagedomains.add(sd_data) print "Attached data storage domain '%s' to data center '%s' (Status: %s)." % (dc_sd.get_name(), dc.get_name, dc_sd.get_status().get_state()) except Exception as ex: print "Attaching data storage domain to data center failed: %s." % ex try: dc_sd = dc.storagedomains.add(sd_iso) print "Attached ISO storage domain '%s' to data center '%s' (Status: %s)." % (dc_sd.get_name(), dc.get_name, dc_sd.get_status().get_state()) except Exception as ex: print "Attaching ISO storage domain to data center failed: %s." % ex api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
add methods are successful then the script will output:
Attached data storage domain 'data1' to data center 'Default' (Status: maintenance). Attached ISO storage domain 'iso1' to data center 'Default' (Status: maintenance).
status reflects that the storage domains still need to be activated.
4.11. Example: Activating Storage Domains using Python
Example 4.10. Activating storage domains using Python
data1, and an ISO storage domain named iso1. Both storage domains are attached to the Default data center. The activate action is facilitated by the activate method of the storage domain.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API(url="https://HOST", username="USER", password="PASS", ca_file="ca.crt") dc = api.datacenters.get(name="Default") sd_data = dc.storagedomains.get(name="data1") sd_iso = dc.storagedomains.get(name="iso1") try: sd_data.activate() print "Activated data storage domain '%s' in data center '%s' (Status: %s)." % (sd_data.get_name(), dc.get_name, sd_data.get_status().get_state()) except Exception as ex: print "Activating data storage domain in data center failed: %s." % ex try: sd_iso.activate() print "Activated ISO storage domain '%s' in data center '%s' (Status: %s)." % (sd_iso.get_name(), dc.get_name, sd_iso.get_status().get_state()) except Exception as ex: print "Activating ISO storage domain in data center failed: %s." % ex api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
activate requests are successful then the script will output:
Activated data storage domain 'data1' in data center 'Default' (Status: active). Activated ISO storage domain 'iso1' in data center 'Default' (Status: active).
status reflects that the storage domains have been activated.
4.12. Example: Creating a Virtual Machine using Python
Example 4.11. Creating a virtual machine using Python
vm1. The virtual machine in this example:
- Must have 512 MB of memory, expressed in bytes.
vm_memory = 512 * 1024 * 1024
- Must be attached to the
Defaultcluster, and therefore theDefaultdata center.vm_cluster = api.clusters.get(name="Default")
- Must be based on the default
Blanktemplate.vm_template = api.templates.get(name="Blank")
- Must boot from the virtual hard disk drive.
vm_os = params.OperatingSystem(boot=[params.Boot(dev="hd")])
add method of the vms collection to create the virtual machine itself.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API(url="https://HOST", username="USER", password="PASS", ca_file="ca.crt") vm_name = "vm1" vm_memory = 512 * 1024 * 1024 vm_cluster = api.clusters.get(name="Default") vm_template = api.templates.get(name="Blank") vm_os = params.OperatingSystem(boot=[params.Boot(dev="hd")]) vm_params = params.VM(name=vm_name, memory=vm_memory, cluster=vm_cluster, template=vm_template, os=vm_os) try: api.vms.add(vm=vm_params) print "Virtual machine '%s' added." % vm_name except Exception as ex: print "Adding virtual machine '%s' failed: %s" % (vm_name, ex) api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
add request is successful then the script will output:
Virtual machine 'vm1' added.
4.13. Example: Creating a Virtual Machine NIC using Python
Example 4.12. Creating a virtual machine NIC using Python
nic1 and attaches it to the virtual machine named vm1. The NIC in this example:
- Must be a
virtionetwork device.nic_interface = "virtio"
- Must be linked to the
rhevmmanagement network.nic_network = api.networks.get(name="rhevm")
add method of the virtual machine's nics collection to create the NIC.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API (url="HOST", username="USER", password="PASS", ca_file="ca.crt") vm = api.vms.get(name="vm1") nic_name = "nic1" nic_interface = "virtio" nic_network = api.networks.get(name="rhevm") nic_params = params.NIC(name=nic_name, interface=nic_interface, network=nic_network) try: nic = vm.nics.add(nic_params) print "Network interface '%s' added to '%s'." % (nic.get_name(), vm.get_name()) except Exception as ex: print "Adding network interface to '%s' failed: %s" % (vm.get_name(), ex) api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
add request is successful then the script will output:
Network interface 'nic1' added to 'vm1'.
4.14. Example: Creating a Virtual Machine Storage Disk using Python
Example 4.13. Creating a virtual machine storage disk using Python
virtio disk drive and attaches it to the virtual machine named vm1. The disk in this example:
- must be stored on the storage domain named
data1,disk_storage_domain = params.StorageDomains(storage_domain=[api.storagedomains.get(name="data1")])
- must be 8 GB in size,
disk_size = 8*1024*1024
- must be a
systemtype disk (as opposed todata),disk_type = "system"
- must be
virtiostorage device,disk_interface = "virtio"
- must be stored in
cowformat, anddisk_format = "cow"
- must be marked as a usable boot device.
disk_bootable = True
add method of the virtual machine's disks collection to create the disk itself.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API (url="https://HOST", username="USER", password="PASS", ca_file="ca.crt") vm = api.vms.get(name="vm1") sd = params.StorageDomains(storage_domain=[api.storagedomains.get(name="data1")]) disk_size = 8*1024*1024 disk_type = "system" disk_interface = "virtio" disk_format = "cow" disk_bootable = True disk_params = params.Disk(storage_domains=sd, size=disk_size, type_=disk_type, interface=disk_interface, format=disk_format, bootable=disk_bootable) try: d = vm.disks.add(disk_params) print "Disk '%s' added to '%s'." % (d.get_name(), vm.get_name()) except Exception as ex: print "Adding disk to '%s' failed: %s" % (vm.get_name(), ex) api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
add request is successful then the script will output:
Disk 'vm1_Disk1' added to 'vm1'.
4.15. Example: Attaching an ISO Image to a Virtual Machine using Python
Example 4.14. Identifying ISO images
files collection attached to the ISO storage domain. This example lists the contents of the files collection on an ISO storage domain.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API(url="https://HOST", username="USER", password="PASS", ca_file="ca.crt") sd = api.storagedomains.get(name="iso1") iso = sd.files.list() for i in iso: print "%s" % i.get_name() except Exception as ex: print "Unexpected error: %s"
files collection:
RHEL6.3-Server-x86_64-DVD1.iso
id and name attributes of the file are shared.
Example 4.15. Attaching an ISO image to a virtual machine using Python
RHEL6.3-Server-x86_64-DVD1.iso ISO image file to the vm1 virtual machine. Once identified the image file is attached using the add method of the virtual machine's cdroms collection.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API(url="HOST", username="USER", password="PASS") sd = api.storagedomains.get(name="iso1") cd_iso = sd.files.get(name="RHEL6.3-Server-x86_64-DVD1.iso") cd_vm = api.vms.get(name="vm1") cd_params = params.CdRom(file=cd_iso) try: cd_vm.cdroms.add(cd_params) print "Attached CD to '%s'." % cd_vm.get_name() except Exception as ex: print "Failed to attach CD to '%s': %s" % (cd_vm.get_name(), ex) api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
add request is successful then the script will output:
Attached CD to 'vm1'.
Note
Down. To attach an ISO to a virtual machine with an Up status, amend the second try statement to the following:
try: cdrom=cd_vm.cdroms.get(id="00000000-0000-0000-0000-000000000000") cdrom.set_file(cd_iso) cdrom.update(current=True) print "Attached CD to '%s'." % cd_vm.get_name() except: print "Failed to attach CD to '%s': %s" % (cd_vm.get_name(), ex)
Example 4.16. Ejecting a cdrom from a Virtual Machine using Python
cdrom collection.
from ovirtsdk.api import API
from ovirtsdk.xml import params
try:
api = API(url="HOST",
username="USER",
password="PASS")
sd = api.storagedomains.get(name="iso1")
vm = api.vms.get(name="vm1")
try:
vm.cdroms.get(id="00000000-0000-0000-0000-000000000000").delete()
print "Removed CD from '%s'." % vm.get_name()
except Exception as ex:
print "Failed to remove CD from '%s': %s" % (vm.get_name(), ex)
api.disconnect()
except Exception as ex:
print "Unexpected error: %s" % ex
4.16. Example: Starting a Virtual Machine using Python
Example 4.17. Starting a virtual machine using Python
start method.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API(url="https://HOST", username="USER", password="PASS", ca_file="ca.crt") vm = api.vms.get(name="vm1") try: vm.start() print "Started '%s'." % vm.get_name() except Exception as ex: print "Unable to start '%s': %s" % (vm.get_name(), ex) api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex
start request is successful then the script will output:
Started 'vm1'.
status reflects that the virtual machine has been started and is now up.
4.17. Example: Checking System Events using Python
events collection.
Example 4.18. Checking System Events using Python
events collection is listed. Note that:
- The
queryparameter of thelistmethod is used to ensure that all available pages of results are returned. By default thelistmethod will only return the first page of results which defaults to a maximum of100records in length. - The resultant list is reversed to ensure that events are included in the output in the order that they occurred.
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API (url="https://HOST", username="USER", password="PASS", ca_file="ca.crt") event_list = [] event_page_index = 1 event_page_current = api.events.list(query="page %s" % event_page_index) while(len(event_page_current) != 0): event_list = event_list + event_page_current event_page_index = event_page_index + 1 try: event_page_current = api.events.list(query="page %s" % event_page_index) except Exception as ex: print "Error retrieving page %s of list: %s" % (event_page_index, ex) event_list.reverse() for event in event_list: print "%s %s CODE %s - %s" % (event.get_time(), event.get_severity().upper(), event.get_code(), event.get_description()) except Exception as ex: print "Unexpected error: %s" % ex
2012-09-25T18:40:10.065-04:00 NORMAL CODE 30 - User admin@internal logged in. 2012-09-25T18:40:10.368-04:00 NORMAL CODE 153 - VM vm1 was started by admin@internal (Host: Atlantic). 2012-09-25T18:40:10.470-04:00 NORMAL CODE 30 - User admin@internal logged in.
Part II. REST Application Programming Interface
Table of Contents
- 5. Entry Point
- 5.1. Accessing the API Entry Point
- 5.2. Product Information
- 5.3. Link Elements
- 5.4. Special Object Elements
- 5.5. Summary Element
- 5.6. RESTful Service Description Language (RSDL)
- 5.7. Backup-Restore API Overview
- 5.8. Full Virtual Machine Backups
- 5.9. Full Virtual Machine Restore
- 5.10. Red Hat Enterprise Virtualization Windows Guest VSS Support
- 5.11. QEMU Guest Agent Overview
- 5.12. VSS Transaction Flow
- 6. Compatibility Level Versions
- 7. Capabilities
- 7.1. Capabilities
- 7.2. Version-Dependent Capabilities
- 7.3. Current Version
- 7.4. Features
- 7.5. CPUs
- 7.6. Power Managers
- 7.7. Fence Types
- 7.8. Storage Types
- 7.9. Configuration Types
- 7.10. Storage Domain Types
- 7.11. Virtual Machine Types
- 7.12. Boot Devices
- 7.13. Display Types
- 7.14. NIC Interface Types
- 7.15. OS Types
- 7.16. Disk Formats
- 7.17. Disk Interfaces
- 7.18. Virtual Machine Affinities
- 7.19. Custom Properties
- 7.20. Boot Protocols
- 7.21. Error Handling
- 7.22. Storage Formats
- 7.23. Creation States
- 7.24. Power Management States
- 7.25. Host States
- 7.26. Host Non-Operational Details
- 7.27. Network States
- 7.28. Storage Domain States
- 7.29. Template States
- 7.30. Virtual Machine States
- 7.31. Virtual Machine Pause Details
- 7.32. Disk States
- 7.33. Host Network Interface Card States
- 7.34. Data Center States
- 7.35. Virtual Machine Device Types
- 7.36. Watchdog Models
- 7.37. Watchdog Actions
- 7.38. Gluster Volume Types
- 7.39. Gluster Transport Types
- 7.40. Permits
- 7.41. Scheduling Policies
- 7.42. Usages
- 7.43. NFS Versions
- 7.44. Power Management Proxy Types
- 7.45. CPU Modes
- 7.46. SCSI Generio I/O Options
- 7.47. Authentication Methods
- 7.48. Step Types
- 7.49. Payload Encodings
- 7.50. Gluster Volume Types
- 7.51. Transport Types
- 7.52. Gluster Volume States
- 7.53. Brick States
- 7.54. Reported Device Types
- 7.55. IP Versions
- 7.56. Snapshot Status
- 7.57. Content Types
- 7.58. Hook States
- 7.59. Stages
- 8. Common Features
- 9. Data Centers
- 10. Host Clusters
- 11. Networks
- 12. Storage Domains
- 13. Storage Connections
- 14. Hosts
- 15. Virtual Machines
- 16. Floating Disks
- 17. Templates
- 18. Virtual Machine Pools
- 19. Domains
- 20. Groups
- 21. Roles
- 22. Users
- 23. Tags
- 24. Events
Chapter 5. Entry Point
- 5.1. Accessing the API Entry Point
- 5.2. Product Information
- 5.3. Link Elements
- 5.4. Special Object Elements
- 5.5. Summary Element
- 5.6. RESTful Service Description Language (RSDL)
- 5.7. Backup-Restore API Overview
- 5.8. Full Virtual Machine Backups
- 5.9. Full Virtual Machine Restore
- 5.10. Red Hat Enterprise Virtualization Windows Guest VSS Support
- 5.11. QEMU Guest Agent Overview
- 5.12. VSS Transaction Flow
5.1. Accessing the API Entry Point
GET request on the entry point URI consisting of a host and base.
Example 5.1. Accessing the API Entry Point
www.example.com and the base is /api, the entry point appears with the following request:
GET /api HTTP/1.1
Accept: application/xml
Host: www.example.com
Authorization: [base64 encoded credentials]
HTTP/1.1 200 OK
Content-Type: application/xml
<api>
<link rel="hosts" href="/api/hosts"/>
<link rel="vms" href="/api/vms"/>
...
<product_info>
<name>Red Hat Enterprise Virtualization</name>
<vendor>Red Hat</vendor>
<version revision="0" build="0" minor="1" major="3"/>
</product_info>
<special_objects>
<link rel="templates/blank" href="..."/>
<link rel="tags/root" href="..."/>
</special_objects>
<summary>
<vms>
<total>10</total>
<active>3</active>
</vms>
<hosts>
<total>2</total>
<active>2</active>
</hosts>
<users>
<total>8</total>
<active>2</active>
</users>
<storage_domains>
<total>2</total>
<active>2</active>
</storage_domains>
</summary>
</api>
Note
Host: and Authorization: request headers and assume the base is the default /api path. This base path differs depending on your implementation.
5.2. Product Information
product_info element to help an API user determine the legitimacy of the Red Hat Enterprise Virtualization environment. This includes the name of the product, the vendor and the version.
Example 5.2. Verify a genuine Red Hat Enterprise Virtualization environment
<api>
...
<product_info>
<name>Red Hat Enterprise Virtualization</name>
<vendor>Red Hat</vendor>
<version revision="0" build="0" minor="2" major="3"/>
</product_info>
...
</api>
5.3. Link Elements
link elements and URIs for all of the resource collections the API exposes. Each collection uses a relation type to identify the URI a client needs.
Table 5.1. Available Relationship Types
| Relationship | Description |
|---|---|
capabilities | Supported capabilities of the Red Hat Enterprise Virtualization Manager. |
datacenters | Data centers. |
clusters | Host clusters. |
networks | Virtual networks. |
storagedomains | Storage domains. |
hosts | Hosts. |
vms | Virtual machines. |
disks | Virtual machine disks. |
templates | Templates. |
vmpools | Virtual machine pools. |
domains | Identity service domains. |
groups | Imported identity service groups. |
roles | Roles. |
users | Users. |
tags | Tags. |
events | Events. |

Figure 5.1. The relationship between the API entry point and the resource collections exposed by the API
Note
link elements also contain a set of search URIs for certain collections. These URIs use URI templates
[4] to integrate search queries. The purpose of the URI template is to accept a search expression using the natural HTTP pattern of a query parameter. The client does not require prior knowledge of the URI structure. Thus clients should treat these templates as being opaque and access them with a URI template library.
"collection/search".
Table 5.2. Relationships associated with search query URIs
| Relationship | Description |
|---|---|
datacenters/search | Query data centers. |
clusters/search | Query host clusters. |
storagedomains/search | Query storage domains. |
hosts/search | Query hosts. |
vms/search | Query virtual machines. |
disks/search | Query disks. |
templates/search | Query templates. |
vmpools/search | Query virtual machine pools. |
events/search | Query events. |
users/search | Query users. |
5.4. Special Object Elements
Table 5.3. Special Objects
| Relationship | Description |
|---|---|
templates/blank | The default blank virtual machine template for your virtualization environment. This template exists in every cluster as opposed to a standard template, which only exists in a single cluster. |
tags/root | The root tag that acts as a base for tag hierarchy in your virtualization environment. |
5.5. Summary Element
Table 5.4. Summary Elements
| Element | Description |
|---|---|
vms | Total number of vms and total number of active vms. |
hosts | Total number of hosts and total number of active hosts. |
users | Total number of users and total number of active users. |
storage_domains | Total number of storage domains and total number of active storage domains. |
5.6. RESTful Service Description Language (RSDL)
GET /api?rsdl HTTP/1.1 Accept: application/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rsdl href="/api?rsdl" rel="rsdl">
<description>...</description>
<version major="3" minor="1" build="0" revision="0"/>
<schema href="/api?schema" rel="schema">
<name>...</name>
<description>...</description>
</schema>
<links>
<link href="/api/capabilities" rel="get">
...
</link>
...
</links>
</rsdl>
Table 5.5. RSDL Structure Elements
| Element | Description |
|---|---|
description | A plain text description of the RSDL document. |
version | The API version, including major release, minor release, build and revision. |
schema | A link to the XML schema (XSD) file. |
links | Defines each link in the API. |
link element contains the following a structure:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rsdl href="/api?rsdl" rel="rsdl">
...
<links>
<link href="/api/..." rel="...">
<request>
<http_method>...</http_method>
<headers>
<header>
<name>...</name>
<value>...</value>
</header>
...
</headers>
<body>
<type>...</type>
<parameters_set>
<parameter required="..." type="...">
<name>...</name>
</parameter>
...
</parameters_set>
</body>
</request>
<response>
<type>...</type>
</response>
</link>
...
</links>
</rsdl>
Table 5.6. RSDL Link Structure Elements
| Element | Description |
|---|---|
link | A URI for API requests. Includes a URI attribute (href) and a relationship type attribute (rel). |
request | Defines the request properties required for the link. |
http_method | The method type to access this link. Includes the standard HTTP methods for REST API access: GET, POST, PUT and DELETE. |
headers | Defines the headers for the HTTP request. Contains a series of header elements, which each contain a header name and value to define the header. |
body | Defines the body for the HTTP request. Contains a resource type and a parameter_set, which contains a sets of parameter elements with attributes to define whether they are required for a request and the data type. The parameter element also includes a name element to define the Red Hat Enterprise Virtualization Manager property to modify and also a further parameter_set subset if type is set to collection. |
response | Defines the output for the HTTP request. Contains a type element to define the resource structure to output. |
5.7. Backup-Restore API Overview
- Full virtual machine backups
- Full virtual machine restoration from backup
- File-level backup
- File-level restoration from backup
- LAN Free Backup (SAN access to the disk devices out of the box)
5.8. Full Virtual Machine Backups
- Take a vm snapshot of the vm targeted for backup.
- Back up the vm configuration at the time of the snapshot (Disks configuration can be backed up as well if needed) - (added capability to Red Hat Enterprise Virtualization Manager as part of the Backup API)
- Attach the disk snapshots that were created in (1) to the virtual appliance for data backup - (added capability to Red Hat Enterprise Virtualization Manager as part of the Backup API)
- Back up the data.
- Detach the disk snapshots that were attached in (4) from the virtual appliance - (added capability to Red Hat Enterprise Virtualization Manager as part of the Backup API)
- Navigate to the wanted disk snapshot from REST by accessing
SERVER:PORT:/api/vms/GUID/snapshots/GUID/disks
- POST the copied disk with the disk id and the snapshot ID:
http://SERVER:PORT/api/vms/GUID/disks/
When creating a disk you will have to pass the disk ID and the snapshot ID such as the following example:<disk id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> <snapshot id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"/> </disk>
- After copying the data from the disk detach the disk snapshot from the VM using the REST with the following parameters:
Method = DELETE URL indicates to the specific disk in the VM: http://SERVER:PORT/api/vms/GUID/disks/GUID Body=<action><detach>true</detach></action>
5.9. Full Virtual Machine Restore
- Create disks for restore
- Attach the disks for restore to the virtual appliance (Restore the data to it)
- Detach the disks from the virtual appliance.
- Create a vm using the configuration that was saved as part of the backup flow - (added capability to Red Hat Enterprise Virtualization Manager as part of the Backup API)
- Attach the restored disks to the created vm.
- Create a disk to restore: POST the new disk : (Example)
http://SERVER:PORT/api/disks/
- Attach the disk to the virtual appliance: POST the copied disk with the disk id :
http://SERVER:PORT/api/vms/GUID/disks/ <disk id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> </disk>
- After copying the data from the disk detach the disk snapshot from the VM using the REST with the following parameters (Example):
Method = DELETE URL indicates to the specific disk in the VM: http://SERVER:PORT/api/vms/GUID/disks/GUID Body=<action><detach>true</detach></action>
5.10. Red Hat Enterprise Virtualization Windows Guest VSS Support
5.11. QEMU Guest Agent Overview
guest-fsfreeze-freeze QMP command to the QEMU GA via the virtio-serial port. This command caused the guest agent to freeze all of the guest virtual machine's filesystems, via the FIFREEZE ioctl() kernel function. This ioctl() function is implemented by the Linux kernel in the guest virtual machine. The function flushes the filesystem cache in the guest virtual machine's kernel, brings the filesystem into a consistent state, and denies all userspace threads write access to the filesystem.
guest-fsfreeze-thaw QMP command to the QEMU GA over the virtio-serial port. This command tells the QEMU GA to issue a FITHAW ioctl(), which unblocks the userspace threads that were previously denied write access, and resumes normal processing. This process did not ensure that application-level data was in a consistent state when the virtual disk snapshot was taken. This was evident in cases where the fsck utility found no problems on filesystems restored from snapshots, and yet applications were not able to resume processing from the point where the snapshot was taken and userspace processes may not have written their internal buffers to files on the disk.
5.12. VSS Transaction Flow
C:\Users\Administrator>vssadmin list providers
vssadmin 1.1 - Volume Shadow Copy Service administrative command-line tool
(C) Copyright 2001-2005 Microsoft Corp.
Provider name: 'QEMU Guest Agent VSS Provider'
Provider type: Software
Provider Id: {3629d4ed-ee09-4e0e-9a5c-6d8ba2872aef}
Version: 0.12.1
Chapter 6. Compatibility Level Versions
6.1. Compatibility Level Versions
compatibility level for each host, corresponding to the version of VDSM installed. A version element contains major and minor attributes, which describe the compatibility level.
version level appears under a supported_versions element. This indicates the cluster's version is now updatable to that level. Once the administrator updates all clusters within a data center to a given level, the data center is updatable to that level.
6.2. Upgrading Compatibility Levels
Example 6.1. Upgrading compatibility levels
<host ...>
...
<version major="3" minor="0"/>
...
</host>
<cluster ...>
...
<version major="3" minor="0"/>
<supported_versions/>
...
</cluster>
<data_center ...>
...
<version major="3" minor="0"/>
<supported_versions/>
...
</data_center>
3.1 and the API reports:
<host ...>
...
<version major="3" minor="1"/>
...
</host>
<cluster ...>
...
<version major="3" minor="0"/>
<supported_versions>
<version major="3" minor="1"/>
</supported_versions>
...
</cluster>
<data_center ...>
...
<version major="3" minor="0"/>
<supported_versions/>
...
</data_center>
3.1. When the cluster is updated, the API reports:
<cluster ...>
...
<version major="3" minor="1"/>
<supported_versions/>
...
</cluster>
<data_center ...>
...
<version major="3" minor="0"/>
<supported_versions>
<version major="3" minor="1"/>
</supported_versions>
...
</data_center>
3.1. Once upgraded, the API exposes features available in Red Hat Enterprise Virtualization 3.1 for this data center.
Chapter 7. Capabilities
- 7.1. Capabilities
- 7.2. Version-Dependent Capabilities
- 7.3. Current Version
- 7.4. Features
- 7.5. CPUs
- 7.6. Power Managers
- 7.7. Fence Types
- 7.8. Storage Types
- 7.9. Configuration Types
- 7.10. Storage Domain Types
- 7.11. Virtual Machine Types
- 7.12. Boot Devices
- 7.13. Display Types
- 7.14. NIC Interface Types
- 7.15. OS Types
- 7.16. Disk Formats
- 7.17. Disk Interfaces
- 7.18. Virtual Machine Affinities
- 7.19. Custom Properties
- 7.20. Boot Protocols
- 7.21. Error Handling
- 7.22. Storage Formats
- 7.23. Creation States
- 7.24. Power Management States
- 7.25. Host States
- 7.26. Host Non-Operational Details
- 7.27. Network States
- 7.28. Storage Domain States
- 7.29. Template States
- 7.30. Virtual Machine States
- 7.31. Virtual Machine Pause Details
- 7.32. Disk States
- 7.33. Host Network Interface Card States
- 7.34. Data Center States
- 7.35. Virtual Machine Device Types
- 7.36. Watchdog Models
- 7.37. Watchdog Actions
- 7.38. Gluster Volume Types
- 7.39. Gluster Transport Types
- 7.40. Permits
- 7.41. Scheduling Policies
- 7.42. Usages
- 7.43. NFS Versions
- 7.44. Power Management Proxy Types
- 7.45. CPU Modes
- 7.46. SCSI Generio I/O Options
- 7.47. Authentication Methods
- 7.48. Step Types
- 7.49. Payload Encodings
- 7.50. Gluster Volume Types
- 7.51. Transport Types
- 7.52. Gluster Volume States
- 7.53. Brick States
- 7.54. Reported Device Types
- 7.55. IP Versions
- 7.56. Snapshot Status
- 7.57. Content Types
- 7.58. Hook States
- 7.59. Stages
7.1. Capabilities
capabilities collection provides information about the supported capabilities of a Red Hat Enterprise Virtualization Manager version. These capabilities include active features and available enumerated values for specific properties. An API user accesses this information through the rel="capabilities" link obtained from the entry point URI.
7.2. Version-Dependent Capabilities
capabilities element contains any number of version elements that describe capabilities dependent on a compatibility level.
version element includes attributes for major and minor version numbers. This indicates the current version level.
3.0, 3.1, 3.2 and 3.3 respectively:
<capabilities>
<version major="3" minor="0">
...
</version>
<version major="3" minor="1">
...
</version>
<version major="3" minor="2">
...
</version>
<version major="3" minor="3">
...
</version>
...
</capabilities>
version contains a series of capabilities dependent on the version specified.
7.3. Current Version
current element signifies if the version specified is the most recent supported compatibility level. The value is a Boolean true or false.
<capabilities>
<version major="3" minor="3">
...
<current>true</current>
...
</version>
</capabilities>
7.4. Features
Table 7.1. Feature Types
| Feature | Description |
|---|---|
| Transparent huge pages memory policy | Allows you to define the availability of transparent huge pages for hosts. Acceptable values are true or false. |
| Gluster support | This features provides support for using Gluster Volumes and Bricks as storage. |
| POSIX-FS storage type | This feature provides support for the POSIX-FS storage type. |
| Port mirroring | Allows you to define the availability of port mirroring for virtual network interface cards. Acceptable values are true or false. |
| Display server time | Displays the current date and time in the API. |
| Display host memory | Displays the total memory for a specific host. |
| Display host sockets | Allows you to define the topology of a host CPU. Takes three attributes - sockets, threads and cores - which define the number of host sockets displayed, the number of threads and the number of cores per socket. |
| Search case sensitivity | Allows you to specify whether a search query is case sensitive by providing a URL parameter. |
Maximum results for GET requests | Allows you to specify the maximum number of results returned from a GET request. |
| JSON content type | Allows you to define a header that makes it possible to set a correlation ID for POST and PUT requests. |
| Activate and deactivate disks | Allows you to activate or deactivate a disk by specifying activate or deactivate as an action on a specific virtual disk. |
| Activate and deactivate network interface cards | Allows you to activate or deactivate a network interface card by specifying activate or deactivate as an action on a specific network interface card. |
| Snapshot refactoring | Allows you to refactor snapshots for virtual machines. |
| Remove template disks from specified storage domain | Allows you to remove virtual machine template disks from a specific storage domain using a DELETE request. |
| Floating disks | Floating disks are disks that are not attached to any virtual machine. With this feature, such disks also appear in the root collection rather than under specific virtual machines. |
| Asynchronous deletion | Allows you to specify that DELETE requests are to be performed asynchronously by specifying the async URL parameter. |
| Session-based authentication | Allows you to maintain a client-server session by providing an appropriate header, eliminating the need to log in with each request. |
| Virtual machine applications | Allows you to view a list of applications installed on a specific virtual machine. This list is located in the applications element of a specific virtual machine. |
| VirtIO-SCSI support | This feature provides support for para-virtualized SCSI controller devices. |
| Custom resource comments | Allows you to add custom comments to data centers and other resources. |
| Refresh host capabilities | Allows you to synchronize data on hosts and refresh the list of network interfaces available to a specific host. |
| Memory snapshot | Allows you to include the memory state as part of a virtual machine snapshot. |
| Watchdog device | Allows you to create watchdog devices for virtual machines. |
| SSH authentication method | Allows you to authenticate with hosts over SSH using an administrative user password or SSH public key. |
| Force select SPM | Allows you to force the selection of a host as SPM. |
| Console device | Allows you to control the attachment of console devices in virtual machines. |
| Storage server connections for storage domains | Allows you to view storage server connections to or from a specific storage domain. |
| Attach and detach storage server connections | Allows you to attach or detach storage server connections to or from a specific storage domain. |
| Single PCI for Qxl | Allows you to view multiple video devices via a single PCI guest device. |
| Add virtual machine from OVF configuration | Allows you to add a virtual machine from a provided OVF configuration. |
| Virtual network interface card profiles | Allows you to configure a profile that defines quality of service, custom properties and port mirroring for a specific virtual network interface card. |
| Image storage domains (tech preview) | Allows you to import images from and export images to an image storage domain such as an OpenStack image service (Glance). |
| Virtual machine fully qualified domain names | Allows you to retrieve the fully qualified domain name of a specific virtual machine. |
| Attaching disk snapshots to virtual machines | This feature provides support for attaching disk snapshots to virtual machines. |
| Cloud Init | Allows you to initialize a virtual machine using Cloud Init. |
<capabilities>
<version major="3" minor="3">
...
<features>
<feature>
<name>Transparent-Huge-Pages Memory Policy</name>
<transparent_huepages/>
</feature>
</features>
...
</version>
</capabilities>
7.5. CPUs
Table 7.2. CPU properties
| Element | Description |
|---|---|
id | An opaque identifier for the CPU model. |
level | An indication as to the relative priority/preference for the CPUs in the list. |
<capabilities>
<version major="3" minor="3">
...
<cpus>
<cpu id="Intel Conroe Family">
<level>3</level>
</cpu>
<cpu id="Intel Penryn Family">
<level>4</level>
</cpu>
...
</cpus>
...
</version>
</capabilities>
7.6. Power Managers
power_managers for host fencing configuration. Each power_management option contains a set of properties.
Table 7.3. Power Management Properties
| Element | Description |
|---|---|
type | The supported fencing device type. |
options | A list of options available to the supported fencing device. Options include a name and a value type. |
<capabilities>
<version major="3" minor="3">
...
<power_managers>
<power_management type="apc">
<options>
<option name="secure" type="bool"/>
<option name="port" type="int"/>
<option name="slot" type="int"/>
</options>
</power_management>
<power_management type="apc_snmp">
<options>
<option name="port" type="int"/>
</options>
</power_management>
<power_management type="bladecenter">
<options>
<option name="secure" type="bool"/>
<option name="port" type="int"/>
<option name="slot" type="int"/>
</options>
</power_management>
...
</power_managers>
...
</version>
</capabilities>
7.7. Fence Types
fence_types element defines fence_type options to fence a host and reduce power usage.
<capabilities>
<version major="3" minor="3">
...
<fence_types>
<fence_type>manual</fence_type>
<fence_type>restart</fence_type>
<fence_type>start</fence_type>
<fence_type>stop</fence_type>
<fence_type>status</fence_type>
</fence_types>
...
</version>
</capabilities>
7.8. Storage Types
storage_types element defines the available physical storage_type options.
<capabilities>
<version major="3" minor="3">
...
<storage_types>
<storage_type>iscsi</storage_type>
<storage_type>fcp</storage_type>
<storage_type>nfs</storage_type>
<storage_type>localfs</storage_type>
<storage_type>posixfs</storage_type>
<storage_type>glusterfs</storage_type>
</storage_types>
...
</version>
</capabilities>
7.9. Configuration Types
configuration_types element lists the available configuration types.
<capabilities>
<version major="3" minor="3">
...
<configuration_types>
<configuration_type>ovf</configuration_type>
</configuration_types>
...
</version>
</capabilities>7.10. Storage Domain Types
storage_domain_types element shows the available types of storage domains.
<capabilities>
<version major="3" minor="3">
...
<storage_domain_types>
<storage_domain_type>data</storage_domain_type>
<storage_domain_type>iso</storage_domain_type>
<storage_domain_type>export</storage_domain_type>
<storage_domain_type>image</storage_domain_type>
</storage_domain_types>
...
</version>
</capabilities>
7.11. Virtual Machine Types
vm_types element defines each virtual machine type (vm_type) available for creation in a virtual environment.
<capabilities>
<version major="3" minor="3">
...
<vm_types>
<vm_type>desktop</vm_type>
<vm_type>server</vm_type>
</vm_types>
...
</version>
</capabilities>
7.12. Boot Devices
boot_devices element lists such boot_device options.
<capabilities>
<version major="3" minor="3">
...
<boot_devices>
<boot_device>cdrom</boot_device>
<boot_device>hd</boot_device>
<boot_device>network</boot_device>
</boot_devices>
...
</version>
</capabilities>
7.13. Display Types
display_types element lists each display_type protocol.
<capabilities>
<version major="3" minor="3">
...
<display_types>
<display_type>vnc</display_type>
<display_type>spice</display_type>
</display_types>
...
</version>
</capabilities>
7.14. NIC Interface Types
nic_interfaces element defines the supported NIC types available. Each nic_interface depends on the drivers available for different types of virtual machines. VirtIO drivers are available for Red Hat Enterprise Linux 4.8 and above, and for Windows virtual machines. Windows supports rtl8139 without the need for drivers. Other Linux machines, or earlier versions of Red Hat Enterprise Linux, use e1000 or rtl8139.
<capabilities>
<version major="3" minor="3">
...
<nic_interfaces>
<nic_interface>e1000</nic_interface>
<nic_interface>virtio</nic_interface>
<nic_interface>rtl8139</nic_interface>
<nic_interface>rtl8139_virtio</nic_interface>
</nic_interfaces>
...
</version>
</capabilities>
7.15. OS Types
os_type value to define the virtual machine operating system. The default is unassigned.
<capabilities>
<version major="3" minor="3">
...
<os_types>
<os_type>windows_2008x64</os_type>
<os_type>unassigned</os_type>
<os_type>other</os_type>
<os_type>other_linux</os_type>
<os_type>windows_2008r2</os_type>
<os_type>ubuntu_12_04</os_type>
<os_type>windows_2008</os_type>
<os_type>windows_7x64</os_type>
<os_type>windows_2003x64</os_type>
<os_type>windows_8x64</os_type>
<os_type>windows_7</os_type>
<os_type>rhel_6x64</os_type>
<os_type>ubuntu_12_10</os_type>
<os_type>rhel_6</os_type>
<os_type>rhel_5</os_type>
<os_type>rhel_4x64</os_type>
<os_type>rhel_4</os_type>
<os_type>rhel_3</os_type>
<os_type>windows_8</os_type>
<os_type>windows_2008R2x64</os_type>
<os_type>windows_2012x64</os_type>
<os_type>windows_xp</os_type>
<os_type>rhel_3x64</os_type>
<os_type>windows_2012x64</os_type>
<os_type>windows_2003</os_type>
<os_type>ubuntu_13_10</os_type>
<os_type>rhel_5x64</os_type>
<os_type>sles_11</os_type>
<os_type>ubuntu_13_04</os_type>
</os_types>
...
</version>
</capabilities>
7.16. Disk Formats
disk_formats element defines the format types. The disk_format types include pre-allocated (raw) or thin-provisioned (Copy-On-Write or cow).
<capabilities>
<version major="3" minor="3">
...
<disk_formats>
<disk_format>cow</disk_format>
<disk_format>raw</disk_format>
</disk_formats>
...
</version>
</capabilities>
7.17. Disk Interfaces
disk_interfaces element lists disk_interface options for emulated protocols to interface with virtual disks.
<capabilities>
<version major="3" minor="3">
...
<disk_interfaces>
<disk_interface>ide</disk_interface>
<disk_interface>virtio_scsi</disk_interface>
<disk_interface>virtio</disk_interface>
</disk_interfaces>
...
</version>
</capabilities>
7.18. Virtual Machine Affinities
vm_affinities element defines each available migration affinity for virtual machines.
<capabilities>
<version major="3" minor="3">
...
<vm_affinities>
<affinity>migratable</affinity>
<affinity>user_migratable</affinity>
<affinity>pinned</affinity>
</vm_affinities>
...
</version>
</capabilities>
7.19. Custom Properties
custom_properties element lists a set of environment variables for a virtual environment. The virtual environment uses these variables as parameters for event-triggered VDSM scripts. Each custom_property includes attributes for a property name and a regular expression (regexp) to define the format of the property value.
<capabilities>
<version major="3" minor="3">
...
<custom_properties>
<custom_property name="sap_agent" regexp="^(true|false)$"/>
<custom_property name="sndbuf" regexp="^[0-9]+$"/>
<custom_property name="vhost"
regexp="^(([a-zA-Z0-9_]*):(true|false))
(,(([a-zA-Z0-9_]*):(true|false)))*$"/>
<custom_property name="viodiskcache"
regexp="^(none|writeback|writethrough)$"/>
</custom_properties>
...
</version>
</capabilities>
7.20. Boot Protocols
boot_protocol element lists each possible IP assignment boot_protocol for hosts when booting.
<capabilities>
<version major="3" minor="3">
...
<boot_protocols>
<boot_protocol>dhcp</boot_protocol>
<boot_protocol>static</boot_protocol>
<boot_protocol>none</boot_protocol>
</boot_protocols>
...
</version>
</capabilities>
7.21. Error Handling
on_error options the in the error_handling element.
<capabilities>
<version major="3" minor="3">
...
<error_handling>
<on_error>migrate</on_error>
<on_error>do_not_migrate</on_error>
<on_error>migrate_highly_available</on_error>
</error_handling>
...
</version>
</capabilities>
7.22. Storage Formats
storage_formats element lists the available format versions for storage metadata.
<capabilities>
<version major="3" minor="3">
...
<storage_formats>
<format>v1</format>
<format>v2</format>
<format>v3</format>
</storage_formats>
...
</version>
</capabilities>
7.23. Creation States
creation_states element lists the different states of an action for creating a resource.
<capabilities>
<version major="3" minor="3">
...
<creation_states>
<creation_state>pending</creation_state>
<creation_state>in_progress</creation_state>
<creation_state>complete</creation_state>
<creation_state>failed</creation_state>
</creation_states>
...
</version>
</capabilities>7.24. Power Management States
power_management_states element lists the available states for power management.
<capabilities>
<version major="3" minor="3">
...
<power_management_states>
<power_management_state>on</power_management_state>
<power_management_state>off</power_management_state>
<power_management_state>unknown</power_management_state>
</power_management_states>
...
</version>
</capabilities>7.25. Host States
host_states element lists the available states in which hosts can be placed.
<capabilities>
<version major="3" minor="3">
...
<host_states>
<host_state>down</host_state>
<host_state>error</host_state>
<host_state>initializing</host_state>
<host_state>installing</host_state>
<host_state>install_failed</host_state>
<host_state>maintenance</host_state>
<host_state>non_operational</host_state>
<host_state>non_responsive</host_state>
<host_state>pending_approval</host_state>
<host_state>preparing_for_maintenance</host_state>
<host_state>connecting</host_state>
<host_state>reboot</host_state>
<host_state>unassigned</host_state>
<host_state>up</host_state>
</host_states>
...
</version>
</capabilities>7.26. Host Non-Operational Details
host_non_operational_details element lists the available reasons why a host may be non-operational.
<capabilities>
<version major="3" minor="3">
...
<host_non_operational_details>
<host_non_operational_detail>
none
</host_non_operational_detail>
<host_non_operational_detail>
general
</host_non_operational_detail>
<host_non_operational_detail>
cpu_type_incompatible_with_cluster
</host_non_operational_detail>
<host_non_operational_detail>
storage_domain_unreachable
</host_non_operational_detail>
<host_non_operational_detail>
network_unreachable
</host_non_operational_detail>
<host_non_operational_detail>
version_incompatible_with_cluster
</host_non_operational_detail>
<host_non_operational_detail>
kvm_not_running
</host_non_operational_detail>
<host_non_operational_detail>
timeout_recovering_from_crash
</host_non_operational_detail>
<host_non_operational_detail>
vm_network_is_bridgeless
</host_non_operational_detail>
<host_non_operational_detail>
gluster_command_failed
</host_non_operational_detail>
<host_non_operational_detail>
gluster_host_uuid_not_found
</host_non_operational_detail>
<host_non_operational_detail>
emulated_machines_incompatible_with_cluster
</host_non_operational_detail>
<host_non_operational_detail>
untrusted
</host_non_operational_detail>
<host_non_operational_detail>
uninitialized
</host_non_operational_detail>
<host_non_operational_detail>
cluster_version_incompatible_with_cluster
</host_non_operational_detail>
</host_non_operational_details>
...
</version>
</capabilities>7.27. Network States
network_states element lists the available states in which networks can be placed.
<capabilities>
<version major="3" minor="3">
...
<network_states>
<host_state>operational</host_state>
<host_state>non-operational</host_state>
</network_states>
...
</version>
</capabilities>7.28. Storage Domain States
storage_domain_states element lists the available states in which storage domains can be placed.
<capabilities>
<version major="3" minor="3">
...
<storage_domain_states>
<storage_domain_state>active</storage_domain_state>
<storage_domain_state>inactive</storage_domain_state>
<storage_domain_state>locked</storage_domain_state>
<storage_domain_state>mixed</storage_domain_state>
<storage_domain_state>unattached</storage_domain_state>
<storage_domain_state>maintenance</storage_domain_state>
<storage_domain_state>unknown</storage_domain_state>
</storage_domain_states>
...
</version>
</capabilities>7.29. Template States
template_states element lists the available states in which templates can be placed.
<capabilities>
<version major="3" minor="3">
...
<template_states>
<template_state>illegal</template_state>
<template_state>locked</template_state>
<template_state>ok</template_state>
</template_states>
...
</version>
</capabilities>7.30. Virtual Machine States
vm_states element lists the available states in which virtual machines can be placed.
<capabilities>
<version major="3" minor="3">
...
<vm_states>
<vm_state>unassigned</vm_state>
<vm_state>down</vm_state>
<vm_state>up</vm_state>
<vm_state>powering_up</vm_state>
<vm_state>paused</vm_state>
<vm_state>migrating</vm_state>
<vm_state>unknown</vm_state>
<vm_state>not_responding</vm_state>
<vm_state>wait_for_launch</vm_state>
<vm_state>reboot_in_progress</vm_state>
<vm_state>saving_state</vm_state>
<vm_state>restoring_state</vm_state>
<vm_state>suspended</vm_state>
<vm_state>image_locked</vm_state>
<vm_state>powering_down</vm_state>
</vm_states>
...
</version>
</capabilities>7.31. Virtual Machine Pause Details
vm_pause_details element lists the available states in which virtual machines can be paused.
<capabilities>
<version major="3" minor="3">
...
<vm_pause_details>
<vm_pause_detail>none</vm_pause_detail>
<vm_pause_detail>eother</vm_pause_detail>
<vm_pause_detail>eio</vm_pause_detail>
<vm_pause_detail>enospc</vm_pause_detail>
<vm_pause_detail>eperm</vm_pause_detail>
<vm_pause_detail>noerr</vm_pause_detail>
</vm_pause_details>
...
</version>
</capabilities>7.32. Disk States
disk_states element lists the available states in which disks can be placed.
<capabilities>
<version major="3" minor="3">
...
<disk_states>
<disk_state>illegal</disk_state>
<disk_state>locked</disk_state>
<disk_state>ok</disk_state>
</disk_states>
...
</version>
</capabilities>7.33. Host Network Interface Card States
host_nic_states element lists the available states in which host network interface cards can be placed.
<capabilities>
<version major="3" minor="3">
...
<host_nic_states>
<host_nic_state>down</host_nic_state>
<host_nic_state>up</host_nic_state>
</host_nic_states>
...
</version>
</capabilities>7.34. Data Center States
data_center_states element lists the available states in which data centers can be placed.
<capabilities>
<version major="3" minor="3">
...
<data_center_states>
<data_center_state>uninitialized</data_center_state>
<data_center_state>up</data_center_state>
<data_center_state>maintenance</data_center_state>
<data_center_state>non_operational</data_center_state>
<data_center_state>problematic</data_center_state>
<data_center_state>contend</data_center_state>
</data_center_states>
...
</version>
</capabilities>7.35. Virtual Machine Device Types
vm_device_types element lists the available devices on the virtual machine.
<capabilities>
<version major="3" minor="3">
...
<vm_device_types>
<vm_device_types>floppy</vm_device_types>
<vm_device_types>cdrom</vm_device_types>
</vm_device_types>
...
</version>
</capabilities>
7.36. Watchdog Models
watchdog_models element lists the available watchdog models for virtual machines.
<capabilities>
<version major="3" minor="3">
...
<watchdog_models>
<model>i6300esb</model>
</watchdog_models>
...
</version>
</capabilities>
7.37. Watchdog Actions
watchdog_actions element lists the available actions watchdogs can perform if their timer reaches zero.
<capabilities>
<version major="3" minor="3">
...
<watchdog_actions>
<action>none</action>
<action>reset</action>
<action>poweroff</action>
<action>pause</action>
<action>dump</action>
</watchdog_actions>
...
</version>
</capabilities>
7.38. Gluster Volume Types
gluster_volume_types element lists the available type of Gluster volumes.
<capabilities>
<version major="3" minor="3">
...
<gluster_volume_types>
<gluster_volume_type>distribute</gluster_volume_types>
<gluster_volume_types>replicate</gluster_volume_types>
<gluster_volume_type>distributed_replicate</gluster_volume_types>
<gluster_volume_types>stripe</gluster_volume_types>
<gluster_volume_type>distributed_stripe</gluster_volume_types>
<gluster_volume_types>striped_replicate</gluster_volume_types>
<gluster_volume_type>distributed_striped_replicate</gluster_volume_types>
</gluster_volume_types>
...
</version>
</capabilities>
7.39. Gluster Transport Types
transport_types element lists the available transport types for Gluster volumes.
<capabilities>
<version major="3" minor="3">
...
<transport_types>
<transport_type>tcp</transport_type>
<transport_type>rdma</transport_type>
</transport_types>
...
</version>
</capabilities>
7.40. Permits
permit contains a set of properties.
Table 7.4. Permit properties
| Element | Type | Description |
|---|---|---|
id= | integer | The opaque identifier for a permit. |
name | string | The name of the permit. |
administrative | Boolean: true or false | The permit is assigned to only administrative roles. |
<capabilities>
...
<permits>
<permit id="1">
<name>create_vm</name>
<administrative>false</administrative>
</permit>
<permit id="2">
<name>delete_vm</name>
<administrative>false</administrative>
</permit>
...
</permits>
...
</capabilities>
7.41. Scheduling Policies
scheduling_policies element defines the load-balancing and power-saving modes for hosts in the cluster.
<capabilities>
...
<scheduling_policies>
<policy>evenly_distributed</policy>
<policy>power_saving</policy>
</scheduling_policies>
...
</capabilities>
7.42. Usages
usages element lists the available types of network usages.
<capabilities>
<version major="3" minor="3">
...
<usages>
<usage>display</usage>
<usage>vm</usage>
<usage>migration</usage>
</usages>
...
</version>
</capabilities>7.43. NFS Versions
nfs_versions element lists the available versions of NFS storage.
<capabilities>
<version major="3" minor="3">
...
<nfs_versions>
<nfs_version>auto</nfs_version>
<nfs_version>v3</nfs_version>
<nfs_version>v4</nfs_version>
</nfs_versions>
...
</version>
</capabilities>7.44. Power Management Proxy Types
pm_proxy_types element lists the available types of power management proxies.
<capabilities>
<version major="3" minor="3">
...
<pm_proxy_types>
<pm_proxy_type>cluster</pm_proxy_type>
<pm_proxy_type>dc</pm_proxy_type>
</pm_proxy_types>
...
</version>
</capabilities>7.45. CPU Modes
cpu_modes element lists the available CPU modes.
<capabilities>
<version major="3" minor="3">
...
<cpu_modes>
<cpu_mode>custom</cpu_mode>
<cpu_mode>host_model</cpu_mode>
<cpu_mode>host_passthrough</cpu_mode>
</cpu_modes>
...
</version>
</capabilities>7.46. SCSI Generio I/O Options
sgio_options element lists the available options for SCSI generio I/O.
<capabilities>
<version major="3" minor="3">
...
<sgio_options>
<sgio_option>filtered</sgio_option>
<sgio_option>unfiltered</sgio_option>
</sgio_options>
...
</version>
</capabilities>7.47. Authentication Methods
authentication_methods element lists the available methods for authentication.
<capabilities>
<version major="3" minor="3">
...
<authentication_methods>
<authentication_method>password</authentication_method>
<authentication_method>publickey</authentication_method>
</authentication_methods>
...
</version>
</capabilities>7.48. Step Types
step_types element lists the different types of steps.
<capabilities>
<version major="3" minor="3">
...
<step_types>
<step_type>validating</step_type>
<step_type>executing</step_type>
<step_type>finalizing</step_type>
<step_type>unknown</step_type>
</step_types>
...
</version>
</capabilities>7.49. Payload Encodings
payload_encodings element lists the different encoding that can be applied to payloads.
<capabilities>
<version major="3" minor="3">
...
<payload_encodings>
<payload_encodings>base64</payload_encodings>
<payload_encodings>plaintext</payload_encodings>
</payload_encodings>
...
</version>
</capabilities>7.50. Gluster Volume Types
gluster_volume_types element lists the available types of Gluster volumes.
<capabilities>
<version major="3" minor="3">
...
<gluster_volume_types>
<gluster_volume_type>distribute</gluster_volume_type>
<gluster_volume_type>replicate</gluster_volume_type>
<gluster_volume_type>distributed_replicate</gluster_volume_type>
<gluster_volume_type>stripe</gluster_volume_type>
<gluster_volume_type>distributed_stripe</gluster_volume_type>
<gluster_volume_type>striped_replicate</gluster_volume_type>
<gluster_volume_type>distributed_striped_replicate</gluster_volume_type>
</gluster_volume_types>
...
</version>
</capabilities>7.51. Transport Types
transport_types element lists the available types of transport protocol.
<capabilities>
<version major="3" minor="3">
...
<transport_types>
<transport_type>tcp</transport_type>
<transport_type>rdma</transport_type>
</transport_types>
...
</version>
</capabilities>7.52. Gluster Volume States
gluster_volume_states element lists the available states for Gluster volumes.
<capabilities>
<version major="3" minor="3">
...
<gluster_volume_states>
<state>up</state>
<state>down</state>
</gluster_volume_states>
...
</version>
</capabilities>7.53. Brick States
brick_states element lists the available states for bricks.
<capabilities>
<version major="3" minor="3">
...
<brick_states>
<state>up</state>
<state>down</state>
</brick_states>
...
</version>
</capabilities>7.54. Reported Device Types
reported_device_types element lists the available types of reported devices.
<capabilities>
<version major="3" minor="3">
...
<reported_device_types>
<reported_device_type>network</reported_device_type>
</reported_device_types>
...
</version>
</capabilities>7.55. IP Versions
ip_versions element lists the IP versions of a network device.
<capabilities>
<version major="3" minor="3">
...
<ip_versions>
<ip_version>v4</ip_version>
<ip_version>v6</ip_version>
</ip_versions>
...
</version>
</capabilities>7.56. Snapshot Status
snapshot_statuses element lists the available statuses of snapshots.
<capabilities>
<version major="3" minor="3">
...
<snapshot_statuses>
<snapshot_status>ok</snapshot_status>
<snapshot_status>locked</snapshot_status>
<snapshot_status>in_preview</snapshot_status>
</snapshot_statuses>
...
</version>
</capabilities>7.57. Content Types
content_types element lists the available types of content.
<capabilities>
<version major="3" minor="3">
...
<content_types>
<content_type>text</content_type>
<content_type>binary</content_type>
</content_types>
...
</version>
</capabilities>7.58. Hook States
hook_states element lists the available states for hooks.
<capabilities>
<version major="3" minor="3">
...
<hook_states>
<hook_state>enabled</hook_state>
<hook_state>disabled</hook_state>
<hook_state>missing</hook_state>
</hook_states>
...
</version>
</capabilities>7.59. Stages
stages element lists the available stages.
<capabilities>
<version major="3" minor="3">
...
<stages>
<stage>pre</stage>
<stage>post</stage>
</stages>
...
</version>
</capabilities>Chapter 8. Common Features
8.1. Element Property Icons
Note
Table 8.1. Element property icons
| Property | Description | Icon |
|---|---|---|
| Required for creation | These elements must be included in the client-provided representation of a resource on creation, but are not mandatory for an update of a resource. |
|
| Non-updateable | These elements cannot have their value changed when updating a resource. Include these elements in a client-provided representation on update only if their values are not altered by the API user. If altered, the API reports an error. |
|
| Read-only | These elements are read-only. Values for read-only elements are not created or modified. |
|
8.2. Representations
8.2.1. Representations
<resource id="resource_id" href="/api/collection/resource_id">
<name>Resource-Name</name>
<description>A description of the resource</description>
...
</resource>
In the context of a virtual machine, the representation appears as follows:
<vm id="5b9bbce5-0d72-4f56-b931-5d449181ee06"
href="/api/vms/5b9bbce5-0d72-4f56-b931-5d449181ee06">
<name>RHEL6-Machine</name>
<description>Red Hat Enterprise Linux 6 Virtual Machine</description>
...
</vm>
8.2.2. Common Attributes to Resource Representations
Table 8.2. Common attributes to resource representations
| Attribute | Type | Description | Properties |
|---|---|---|---|
id | GUID | Each resource in the virtualization infrastructure contains an id, which acts as a globally unique identifier (GUID). The GUID is the primary method of resource identification. | |
href | string | The canonical location of the resource as an absolute path. |
8.2.3. Common Elements to Resource Representations
Table 8.3. Common elements to resource representations
| Element | Type | Description | Properties |
|---|---|---|---|
name | string | A user-supplied human readable name for the resource. The name is unique across all resources of its type. | |
description | string | A free-form user-supplied human readable description of the resource. |
8.3. Collections
8.3.1. Collections
hosts collection which contains all virtualization hosts in the environment. An example of a sub-collection is the host.nics collection which contains resources for all network interface cards attached to a host resource.
8.3.2. Listing All Resources in a Collection
GET request on the collection URI obtained from the entry point.
Accept HTTP header to define the MIME type for the response format.
GET /api/[collection] HTTP/1.1 Accept: [MIME type]
8.3.3. Listing Extended Resource Sub-Collections
Accept header includes the detail parameter.
GET /api/collection HTTP/1.1 Accept: application/xml; detail=subcollection
detail parameters:
GET /api/collection HTTP/1.1 Accept: application/xml; detail=subcollection1; detail=subcollection2
detail parameter that separates the sub-collection with the + operator:
GET /api/collection HTTP/1.1 Accept: application/xml; detail=subcollection1+subcollection2+subcollection3
Table 8.4. Collections that use extended sub-collections
| Collection | Extended Sub-Collection Support |
|---|---|
hosts | statistics |
vms | statistics, nics, disks |
Example 8.1. A request for extended statistics, NICs and disks sub-collections in the vms collection
GET /api/vms HTTP/1.1 Accept: application/xml; detail=statistics+nics+disks
8.3.4. Searching Collections with Queries
GET request on a "collection/search" link results in a search query of that collection. The API only returns resources within the collection that satisfy the search query constraints.
GET /api/collection?search={query} HTTP/1.1
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<collection>
<resource id="resource_id" href="/api/collection/resource_id">
...
</resource>
...
</collection>
8.3.5. Maximum Results Parameter
max URL parameter to limit the list of results.
GET /api/collection;max=1 HTTP/1.1
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<collection>
<resource id="resource_id" href="/api/collection/resource_id">
<name>Resource-Name</name>
<description>A description of the resource</description>
...
</resource>
</collection>
Note
8.3.6. Case Sensitivity
Example 8.2. Case insensitive search query
GET /api/collection;case-sensitive=false?search={query} HTTP/1.1
Accept: application/xml
8.3.7. Query Syntax
query with a GET request:
GET /api/collection?search={query} HTTP/1.1
Accept: application/xml
query template value refers to the search query the API directs to the collection. This query uses the same format as Red Hat Enterprise Virtualization Query Language:
(criteria) [sortby (element) asc|desc]
sortby clause is optional and only needed when ordering results.
Table 8.5. Example search queries
| Collection | Criteria | Result |
|---|---|---|
hosts | vms.status=up | Displays a list of all hosts running virtual machines that are up. |
vms | domain=qa.company.com | Displays a list of all virtual machines running on the specified domain. |
vms | users.name=mary | Displays a list of all virtual machines belonging to users with the username mary. |
events | severity>normal sortby time | Displays the list of all events with severity higher than normal and sorted by the time element values. |
events | severity>normal sortby time desc | Displays the list of all events with severity higher than normal and sorted by the time element values in descending order. |
query template to be URL-encoded to translate reserved characters, such as operators and spaces.
Example 8.3. URL-encoded search query
GET /api/vms?search=name%3Dvm1 HTTP/1.1 Accept: application/xml
8.3.8. Wildcards
Example 8.4. Wildcard search query for name=vm*
GET /api/vms?search=name%3Dvm* HTTP/1.1 Accept: application/xml
vm, such as vm1, vm2, vma or vm-webserver.
Example 8.5. Wildcard search query for name=v*1
GET /api/vms?search=name%3Dv*1 HTTP/1.1 Accept: application/xml
v and ending with 1, such as vm1, vr1 or virtualmachine1.
8.3.9. Pagination
page command.
Example 8.6. Paginating resources
GET /api/collection?search=page%201 HTTP/1.1 Accept: application/xml
page value to view the next page of results.
GET /api/collection?search=page%202 HTTP/1.1 Accept: application/xml
page command also in conjunction with other commands in a search query. For example:
GET /api/collection?search=sortby%20element%20asc%20page%202 HTTP/1.1 Accept: application/xml
8.3.10. Creating a Resource in a Collection
POST request to the collection URI containing a representation of the new resource.
POST request requires a Content-Type header. This informs the API of the representation MIME type in the body content as part of the request.
Accept HTTP header to define the MIME type for the response format.
POST /api/[collection] HTTP/1.1 Accept: [MIME type] Content-Type: [MIME type] [body]
8.3.11. Asynchronous Requests
POST requests unless the user overrides them with an Expect: 201-created header.
202 Accepted status. The initial document structure for a 202 Accepted resource also contains a creation_status element and link for creation status updates. For example:
POST /api/collection HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<resource>
<name>Resource-Name</name>
</resource>
HTTP/1.1 202 Accepted
Content-Type: application/xml
<resource id="resource_id" href="/api/collection/resource_id">
<name>Resource-Name</name>
<creation_status>
<state>pending</state>
</creation status>
<link rel="creation_status"
href="/api/collection/resource_id/creation_status/creation_status_id"/>
...
</resource>
GET request to the creation_status link provides a creation status update:
GET /api/collection/resource_id/creation_status/creation_status_id HTTP/1.1
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<creation id="creation_status_id"
href="/api/collection/resource_id/creation_status/creation_status_id">
<status>
<state>complete</state>
</status>
</creation>
Expect: 201-created header:
POST /api/collection HTTP/1.1
Accept: application/xml
Content-Type: application/xml
Expect: 201-created
<resource>
<name>Resource-Name</name>
</resource>
8.4. Resources
8.4.1. Resources
8.4.2. Retrieving a Resource
GET request on a URI obtained from a collection listing.
Accept HTTP header to define the MIME type for the response format.
GET /api/[collection]/[resource_id] HTTP/1.1 Accept: [MIME type]
8.4.3. Updating a Resource
PUT request containing an updated description from a previous GET request for the resource URI. Details on modifiable properties are found in the individual resource type documentation.
PUT request requires a Content-Type: application/xml header. This informs the API of the representation MIME type in the body content as part of the request.
Accept HTTP header to define the MIME type for the response format.
PUT /api/collection/resource_id HTTP/1.1 Accept: [MIME type] Content-Type: [MIME type] [body]
8.4.4. Deleting a Resource
DELETE request sent to its URI.
Accept HTTP header to define the MIME type for the response format.
DELETE /api/[collection]/[resource_id] HTTP/1.1 Accept: [MIME type]
DELETE request to specify additional properties. A DELETE request with optional body content requires a Content-Type header to inform the API of the representation MIME type in the body content. If a DELETE request contains no body content, omit the Content-Type header.
8.4.5. Sub-Collection Relationships
- N:M mappings, where one parent resource can contain several child resources and vice versa. For example, a virtual machine can contain several disks and some disks are shared among multiple virtual machines.
- 1:N mappings, where mapped resources are dependent on a parent resource. Without the parent resource, the dependent resource cannot exist. For example, the link between a virtual machine and snapshots.
- 1:N mappings, where mapped resources exist independently from parent resources but data is still associated with the relationship. For example, the link between a cluster and a network.
link rel= attribute:
GET /api/collection/resource_id HTTP/1.1
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<resource id="resource_id" href="/api/collection/resource_id">
...
<link rel="subcollection"
href="/api/collection/resource_id/subcollection"/>
...
</resource>
GET /api/collection/resource_id/subcollection HTTP/1.1
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<subcollection>
<subresource id="subresource_id"
href="/api/collection/resource_id/subcollection/subresource_id">
...
</subresource>
...
</subcollection>
8.4.6. XML Element Relationships
- Backlinks from a resource in a sub-collection to a parent resource; or
- Links between resources with an arbitrary relationship.
Example 8.7. Backlinking from a sub-collection resource to a resource using an XML element
GET /api/collection/resource_id/subcollection/subresource_id HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/xml
<subcollection>
<subresource id="subresource_id"
href="/api/collection/resource_id/subcollection/subresource_id">
<resource id="resource_id" href="/api/collection/resource_id"/>
...
</subresource>
</subcollection>
8.4.7. Actions
<resource>
...
<actions>
<link rel="start" href="/api/collection/resource_id/start"/>
<link rel="stop" href="/api/collection/resource_id/stop"/>
...
</actions>
...
</resource>
POST request to the supplied URI. The body of the POST requires an action representation encapsulating common and task-specific parameters.
Table 8.6. Common action parameters
| Element | Description |
|---|---|
async | true if the server responds immediately with 202 Accepted and an action representation contains a href link to be polled for completion. |
grace_period | a grace period in milliseconds, which must expire before the action is initiated. |
fault response.
Content-Type: application/xml header since the POST request requires an XML representation in the body content.
202 Accepted response provides a link to monitor the status of the task:
POST /api/collection/resource_id/action HTTP/1.1
Content-Type: application/xml
Accept: application/xml
<action>
<async>true</async>
</action>
HTTP/1.1 202 Accepted
Content-Type: application/xml
<action id="action_id"
href="/api/collection/resource_id/action/action_id">
<async>true</async>
...
<action>
GET on the action URI provides an indication of the status of the asynchronous task.
Table 8.7. Action statuses
| Status | Description |
|---|---|
pending | Task has not yet started. |
in_progress | Task is in operation. |
complete | Task completed successfully. |
failed | Task failed. The returned action representation would contain a fault describing the failure. |
GETs are 301 Moved Permanently redirected back to the target resource.
GET /api/collection/resource_id/action/action_id HTTP/1.1
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<action id="action_id"
href="/api/collection/resource_id/action/action_id">
<status>
<state>pending</state>
</status>
<link rel="parent" /api/collection/resource_id"/>
<link rel="replay" href="/api/collection/resource_id/action"/>
<action>
rel attribute:
Table 8.8. Action relationships
| Type | Description |
|---|---|
parent | A link back to the resource of this action. |
replay | A link back to the original action URI. POSTing to this URI causes the action to be re-initiated. |
8.4.8. Permissions
permissions sub-collection. Each permission contains a user, an assigned role and the specified resource. For example:
GET /api/collection/resource_id/permissions HTTP/1.1
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<permissions>
<permission id="permission-id"
href="/api/collection/resource_id/permissions/permission_id">
<role id="role_id" href="/api/roles/role_id"/>
<user id="user_id" href="/api/users/user_id"/>
<resource id="resource_id" href="/api/collection/resource_id"/>
</permission>
...
</permissions>
POST request with a permission representation and a Content-Type: application/xml header to the resource's permissions sub-collection. Each new permission requires a role and a user:
POST /api/collection/resource_id/permissions HTTP/1.1
Content-Type: application/xml
Accept: application/xml
<permission>
<role id="role_id"/>
<user id="user_id"/>
</permission>
HTTP/1.1 201 Created
Content-Type: application/xml
<permission id="permission_id"
href="/api/resources/resource_id/permissions/permission_id">
<role id="role_id" href="/api/roles/role_id"/>
<user id="user_id" href="/api/users/user_id"/>
<resource id="resource_id" href="/api/collection/resource_id"/>
</permission>
8.4.9. Handling Errors
fault representation in the response entity body. The fault contains a reason and detail strings. Clients must accommodate failed requests via extracting the fault or the expected resource representation depending on the response status code. Such cases are clearly indicated in the individual resource documentation.
PUT /api/collection/resource_id HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<resource>
<id>id-update-test</id>
</resource>
HTTP/1.1 409 Conflict
Content-Type: application/xml
<fault>
<reason>Broken immutability constraint</reason>
<detail>Attempt to set immutable field: id</detail>
</fault>
Chapter 9. Data Centers
9.1. Data Center Elements
datacenters collection provides information about the data centers in a Red Hat Enterprise Virtualization environment. An API user accesses this information through the rel="datacenters" link obtained from the entry point URI.
Table 9.1. Data center elements
| Element | Type | Description | Properties |
|---|---|---|---|
link rel="storagedomains" | relationship | A link to the sub-collection for storage domains attached to this data center. | |
link rel="permissions" | relationship | A link to the sub-collection for data center permissions. | |
link rel="quotas" | relationship | A link to the sub-collection for quotas associated with this data center. | |
storage_type | enumerated | Describes the storage type in this datacenter. A list of enumerated values is available in capabilities. |
|
storage_format | enumerated | Describes the storage format version for the data center. A list of enumerated values are available in capabilities. |
|
version major= minor= | complex | The compatibility level of the data center. |
|
supported_versions | complex | A list of possible version levels for the data center. |
|
status | see below | The data center status. |
|
status contains one of the following enumerative values: uninitialized, up, maintenance, not_operational, problematic and contend. These states are listed in data_center_states under capabilities.
9.2. XML Representation of a Data Center
Example 9.1. An XML representation of a data center
<data_center id="01a45ff0-915a-11e0-8b87-5254004ac988"
href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988">
<name>Default</name>
<description>The default Data Center</description>
<link rel="storagedomains"
href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988/
storagedomains"/>
<link rel="permissions"
href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988/permissions"/>
<link rel="quotas"
href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988/quotas"/>
<storage_type>nfs</storage_type>
<storage_format>v3</storage_format>
<version minor="1" major="3"/>
<supported_versions>
<version minor="1" major="3"/>
</supported_versions>
<status>
<state>up</state>
</status>
</data_center>
9.3. Methods
9.3.1. Creating a New Data Center
name, storage_type and version elements.
Example 9.2. Creating a data center
POST /api/datacenters HTTP/1.1
Accept: application/xml
Content-type: application/xml
<data_center>
<name>NewDatacenter</name>
<storage_type>nfs</storage_type>
<version minor="1" major="3"/>
</data_center>
9.3.2. Updating a Data Center
name, description, storage_type, version and storage_format elements are updatable post-creation.
Example 9.3. Updating a data center
PUT /api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<data_center>
<name>UpdatedName</name>
<description>An updated description for the data center</description>
</data_center>
9.4. Sub-Collections
9.4.1. Storage Domains Sub-Collection
9.4.1.1. Storage Domains Sub-Collection
status and set of actions. States for the status element are listed in storage_domain_states under capabilities.
Important
9.4.1.2. Attaching and Detaching a Storage Domain
POSTs to the data center's storage domains sub-collection.
id or name must be supplied. An example of attaching a storage domain to a data center:
Example 9.5. Attach a storage domain to a data center
POST /api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains HTTP/1.1
Accept: application/xml
Content-type: application/xml
<storage_domain id="fabe0451-701f-4235-8f7e-e20e458819ed"/>
HTTP/1.1 201 Created
Location: /datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed
Content-Type: application/xml
<storage_domain id="fabe0451-701f-4235-8f7e-e20e458819ed"
href="/api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/
fabe0451-701f-4235-8f7e-e20e458819ed">
<name>images0</name>
<type>data</type>
<status>
<state>inactive</state>
</status>
<master>true</master>
<storage>
<type>nfs</type>
<address>172.31.0.6</address>
<path>/exports/RHEVX/images/0</path>
</storage>
<data_center id="d70d5e2d-b8ad-494a-a4d2-c7a5631073c4"
href="/api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4"/>
<actions>
<link rel="activate"
href="/api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/
storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/activate"/>
<link rel="deactivate"
href="/api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/
storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/deactivate"/>
</actions>
</storage_domain>
DELETE request. Include an optional async element for this request to be asynchronous.
Example 9.6. Detach a storage domain from a data center
DELETE /api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed HTTP/1.1 Accept: application/xml Content-type: application/xml <action> <async>true</async> </action>
9.4.1.3. Actions
9.4.1.3.1. Activate Storage Domain Action
Example 9.7. Action to active a storage domain on a datacenter
POST /api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/activate HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
9.4.1.3.2. Deactivate Storage Domain Action
Example 9.8. Action to deactivate a storage domain on a datacenter
POST /api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/deactivate HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
9.4.2. Quotas Sub-Collection
Important
GET method.
Example 9.9. An XML representation of a quota
<quota href="/api/datacenters/56087282-d7a6-11e1-af44-001a4a400e0c
/quotas/e13ff85a-b2ba-4f7b-8010-e0d057c03dfe"
id="e13ff85a-b2ba-4f7b-8010-e0d057c03dfe">
<name>MyQuota</name>
<description>A quota for my Red Hat Enterprise
Virtualization environment</description>
<data_center href= "/api/datacenters/56087282-d7a6-11e1-af44-001a4a400e0c"
id="56087282-d7a6-11e1-af44-001a4a400e0c"/>
</quota>
name and description elements.
Example 9.10. Creating a quota
POST /api/datacenters/56087282-d7a6-11e1-af44-001a4a400e0c/quotas HTTP/1.1
Accept: application/xml
Content-type: application/xml
<quota>
<name>VMQuota</name>
<description>My new quota for virtual machines</description>
</quota>
DELETE request.
Example 9.11. Removing a quota
DELETE /api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988/quotas/e13ff85a-b2ba-4f7b-8010-e0d057c03dfe HTTP/1.1 HTTP/1.1 204 No Content
9.5. Actions
9.5.1. Force Remove Data Center Action
force action to help with these situations.
DELETE method. The request body contains an action representation with the force parameter set to true. The request also requires an additional Content-type: application/xml header to process the XML representation in the body.
Example 9.12. Force remove action on a data center
DELETE /api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988 HTTP/1.1 Accept: application/xml Content-type: application/xml <action> <force>true</force> </action>
- Deletes all database information for
datastorage domains associated the data center; - Deletes all database information for resources, such as virtual machines and templates, on
datastorage domains associated the data center; - Detaches
isoandexportstorage domains from the data center; and - Deletes the database information for the data center.
Important
data storage domains associated with the data center require manual format before reuse. Metadata for iso and export domains require manual cleaning prior to use on another data center.
Chapter 10. Host Clusters
10.1. Host Cluster Elements
clusters collection provides information about host clusters in a Red Hat Enterprise Virtualization environment. An API user accesses this information through the rel="clusters" link obtained from the entry point URI.
Table 10.1. Host cluster elements
| Element | Type | Description | Properties |
|---|---|---|---|
name | string | A user-supplied, human-readable name for the cluster. The name is unique across all cluster resources. |
|
description | string | A free-form, user-supplied, human-readable description of the cluster. | |
link rel="networks" | relationship | A link to the sub-collection for networks associated with this cluster. | |
link rel="permissions" | relationship | A link to the sub-collection for cluster permissions. | |
link rel="glustervolumes" | relationship | A link to the sub-collection for Red Hat Storage volumes associated with this cluster. | |
link rel="glusterhooks" | relationship | A link to the sub-collection for Red Hat Storage volume hooks associated with this cluster. | |
cpu id= | complex | A server CPU reference that defines the CPU type all hosts must support in the cluster. |
|
data_center id= | GUID | A reference to the data center membership of this cluster. |
|
memory_policy | complex | Defines the cluster's policy on host memory utilization. |
|
scheduling_policy | complex | Defines the load-balancing or power-saving modes for hosts in the cluster. |
|
version major= minor= | complex | The compatibility level of the cluster. |
|
supported_versions | complex | A list of possible version levels for the cluster. |
|
error_handling | complex/enumerated | Defines virtual machine handling when a host within a cluster becomes non-operational. Requires a single on_error element containing an enumerated type property listed in capabilities. | |
virt_service | Boolean | Defines whether to expose virtualization services for this cluster. | |
gluster_service | Boolean | Defines whether to expose Red Hat Storage services for this cluster. | |
threads_as_cores | Boolean | Defines whether hosts can run virtual machines with a total number of processor cores greater than the number of cores in the host. | |
tunnel_migration | Boolean | Defines whether virtual machines use a libvirt-to-libvirt tunnel during migration. | |
trusted_service | Boolean | Defines whether an OpenAttestation server is used to verify hosts. | |
ballooning_enabled | Boolean | Defines whether ballooning is enabled for the cluster. |
Note
mom.Controllers.Balloon - INFO Ballooning guest:half1 from 1096400 to 1991580 are logged to /etc/vdsm/mom.conf. /etc/vdsm/mom.conf is the Memory Overcommit Manager log file. An event will also be added to the event log if a virtual machine does not respect a balloon.
10.2. Memory Policy Elements
memory_policy element contains the following elements:
Table 10.2. Memory policy elements
| Element | Type | Description | Properties |
|---|---|---|---|
overcommit percent= | complex | The percentage of host memory allowed in use before no more virtual machines can start on a host. Virtual machines can use more than the available host memory due to memory sharing under KSM. Recommended values include 100 (None), 150 (Server Load) and 200 (Desktop Load). |
|
transparent_hugepages | complex | Define the enabled status of Transparent Hugepages. The status is either true or false. Check capabilities feature set to ensure your version supports transparent hugepages. |
|
10.3. Scheduling Policy Elements
scheduling_policy element contains the following elements:
Table 10.3. Scheduling policy elements
| Element | Type | Description | Properties |
|---|---|---|---|
policy | enumerated | The VM scheduling mode for hosts in the cluster. A list of enumerated types are listed in capabilities. |
|
thresholds low= high= duration= | complex | Defines CPU limits for the host. The high attribute controls the highest CPU usage percentage the host can have before being considered overloaded. The low attribute controls the lowest CPU usage percentage the host can have before being considered underutilized. The duration attribute refers to the number of seconds the host needs to be overloaded before the scheduler starts and moves the load to another host. |
|
10.4. XML Representation of a Host Cluster
Example 10.1. An XML representation of a host cluster
<cluster id="99408929-82cf-4dc7-a532-9d998063fa95"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95">
<name>Default</name>
<description>The default server cluster</description>
<link rel="glustervolumes"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes"/>
<link rel="networks"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks"/>
<link rel="permissions"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/permissions"/>
<cpu id="Intel Penryn Family"/>
<data_center id="01a45ff0-915a-11e0-8b87-5254004ac988"
href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988"/>
<memory_policy>
<overcommit percent="100"/>
<transparent_hugepages>
<enabled>false</enabled>
</transparent_hugepages>
</memory_policy>
<scheduling_policies>
<policy>evenly_distributed</policy>
<thresholds low="10" high="75" duration="120"/>
</scheduling_policies>
<version minor="0" major="3"/>
<supported_versions>
<version minor="0"<usage> major="3"/>
</supported_versions>
<error_handling>
<on_error>migrate</on_error>
</error_handling>
<virt_service>true</virt_service>
<gluster_service>false</gluster_service>
</cluster>
10.5. Methods
10.5.1. Creating a Host Cluster
name, cpu id= and datacenter elements. Identify the datacenter with either the id attribute or name element.
Example 10.2. Creating a host cluster
POST /api/clusters HTTP/1.1
Accept: application/xml
Content-type: application/xml
<cluster>
<name>cluster1</name>
<cpu id="Intel Penryn Family"/>
<data_center id="01a45ff0-915a-11e0-8b87-5254004ac988"/>
</cluster>
10.5.2. Updating a Host Cluster
name, description, cpu id= and error_handling elements are updatable post-creation.
Example 10.3. Updating a host cluster
PUT /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<cluster>
<description>Cluster 1</description>
</cluster>
10.6. Sub-Collections
10.6.1. Networks Sub-Collection
networks sub-collection. Every host within a cluster connects to these associated networks.
network sub-collection is the same as a standard network resource except for the following additional elements:
Table 10.4. Additional network elements
| Element | Type | Description | Properties |
|---|---|---|---|
cluster id= | relationship | A reference to the cluster of which this network is a member. |
|
required | Boolean | Defines required or optional network status. | |
display | Boolean | Defines the display network status. Used for backward compatibility. | |
usages | complex | Defines a set of usage elements for the network. Users can define networks as VM and DISPLAY networks at this level. |
networks sub-collection with the standard REST methods. POSTing a network id or name reference to the networks sub-collection associates the network with the cluster.
Example 10.5. Associating a network resource with a cluster
POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<network id="da05ac09-00be-45a1-b0b5-4a6a2438665f">
<name>rhevm</name>
</network>
HTTP/1.1 201 Created
Location: http://{host}/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks/da05ac09-00be-45a1-b0b5-4a6a2438665f
Content-Type: application/xml
<network id="da05ac09-00be-45a1-b0b5-4a6a2438665f"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks/
da05ac09-00be-45a1-b0b5-4a6a2438665f">
<name>rhevm</name>
<status>
<state>operational</state>
</status>
<description>Display Network</description>
<cluster id="99408929-82cf-4dc7-a532-9d998063fa95"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95"/>
<data_center id="d70d5e2d-b8ad-494a-a4d2-c7a5631073c4"
href="/api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4"/>
<required>true</required>
<usages>
<usage>VM</usage>
</usages>
</network>
PUT request.
Example 10.6. Setting the display network status
PUT /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks/da05ac09-00be-45a1-b0b5-4a6a2438665f HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<network>
<required>false</required>
<usages>
<usage>VM</usage>
<usage>DISPLAY</usage>
</usages>
</network>
PUT request to specify the Boolean value (true or false) of the required element.
Example 10.7. Setting optional network status
PUT /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks/da05ac09-00be-45a1-b0b5-4a6a2438665f HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<network>
<required>false</required>
</network>
DELETE request to the appropriate element in the collection.
Example 10.8. Removing a network association from a cluster
DELETE /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks/da05ac09-00be-45a1-b0b5-4a6a2438665f HTTP/1.1 HTTP/1.1 204 No Content
10.6.2. Storage Volumes Sub-Collection
10.6.2.1. Red Hat Storage Volumes Sub-Collection
Important
glustervolumes sub-collection.
Important
glustervolumes sub-collection is defined using the following elements:
Table 10.5. Gluster volume elements
| Element | Type | Description | Properties |
|---|---|---|---|
volume_type | enumerated | Defines the volume type. See the capabilities collection for a list of volume types. |
|
bricks | relationship | The sub-collection for the Red Hat Storage bricks. When creating a new volume, the request requires a set of brick elements to create and manage in this cluster. Requires the server_id of the Red Hat Storage server and a brick_dir element for the brick directory |
|
transport_types | complex | Defines a set of volume transport_type elements. See the capabilities collection for a list of available transport types. |
|
replica_count | integer | Defines the file replication count for a replicated volume. |
|
stripe_count | integer | Defines the stripe count for a striped volume |
|
options | complex | A set of additional Red Hat Storage option elements. Each option includes an option name and a value. |
|
Example 10.9. An XML representation of a Red Hat Storage volume
<gluster_volume id="99408929-82cf-4dc7-a532-9d998063fa95"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95
/glustervolume/e199f877-900a-4e30-8114-8e3177f47651">
<name>GlusterVolume1</name>
<link rel="bricks"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95
/glustervolume/e199f877-900a-4e30-8114-8e3177f47651/bricks"/>
<volume_type>DISTRIBUTED_REPLICATE</volume_type>
<transport_types>
<transport_type>TCP</transport_type>
</transport_types>
<replica_count>2</replica_count>
<stripe_count>1</stripe_count>
<options>
<option>
<name>cluster.min-free-disk</name>
<value>536870912</value>
</option>
</options>
</gluster_volume>
POST request with the required name, volume_type and bricks to the sub-collection.
Example 10.10. Creating a Red Hat Storage volume
POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<gluster_volume>
<name>GlusterVolume1</name>
<volume_type>DISTRIBUTED_REPLICATE</volume_type>
<bricks>
<brick>
<server_id>server1</server_id>
<brick_dir>/exp1</brick_dir>
</brick>
<bricks>
</gluster_volume>
DELETE request.
Example 10.11. Removing a Red Hat Storage volume
DELETE /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/e199f877-900a-4e30-8114-8e3177f47651 HTTP/1.1 HTTP/1.1 204 No Content
Important
glustervolumes sub-collection cannot be updated.
10.6.2.2. Bricks Sub-Collection
glustervolumes sub-collection contains its own bricks sub-collection to define individual bricks in a Red Hat Storage volume. The representation of a volume's bricks sub-collection is defined using the following elements:
Table 10.6. Brick elements
| Element | Type | Description | Properties |
|---|---|---|---|
server_id | string | A reference to the Red Hat Storage server. |
|
brick_dir | string | Defines a brick directory on the Red Hat Storage server. |
|
replica_count | integer | Defines the file replication count for the brick in the volume. |
|
stripe_count | integer | Defines the stripe count for the brick in the volume |
|
POST request with the required server_id and brick_dir to the sub-collection.
Example 10.12. Adding a brick
POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/e199f877-900a-4e30-8114-8e3177f47651/bricks HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<brick>
<server_id>server1</server_id>
<brick_dir>/exp1</brick_dir>
</brick>
DELETE request.
Example 10.13. Removing a brick
DELETE /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/e199f877-900a-4e30-8114-8e3177f47651/bricks/0a473ebe-01d2-444d-8f58-f565a436b8eb HTTP/1.1 HTTP/1.1 204 No Content
Important
bricks sub-collection cannot be updated.
10.6.2.3. Actions
10.6.2.3.1. Start Action
start action makes a Gluster volume available for use.
Example 10.14. Starting a Volume
POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/e199f877-900a-4e30-8114-8e3177f47651/start HTTP/1.1 Accept: application/xml Content-Type: application/xml <action/>
force Boolean element to force the action for a running volume. This is useful for starting disabled brick processes in a running volume.
10.6.2.3.2. Stop Action
stop action deactivates a Gluster volume.
Example 10.15. Stopping a Volume
POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/e199f877-900a-4e30-8114-8e3177f47651/stop HTTP/1.1 Accept: application/xml Content-Type: application/xml <action/>
force Boolean element to brute force the stop action.
10.6.2.3.3. Set Option Action
setoption action sets a volume option.
Example 10.16. Set an option
POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/e199f877-900a-4e30-8114-8e3177f47651/setoption HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<action>
<option>
<name>cluster.min-free-disk</name>
<value>536870912</value>
</option>
<action>
10.6.2.3.4. Reset Option Action
resetoption action resets a volume option.
Example 10.17. Reset an option
POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/e199f877-900a-4e30-8114-8e3177f47651/resetoption HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<action>
<option>
<name>cluster.min-free-disk</name>
</option>
<action>
10.6.2.3.5. Reset All Options Action
resetalloptions action resets all volume options.
Example 10.18. Reset all options
POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/e199f877-900a-4e30-8114-8e3177f47651/resetalloptions HTTP/1.1 Accept: application/xml Content-Type: application/xml <action/>
Chapter 11. Networks
11.1. Network Elements
networks collection provides information about the logical networks in a Red Hat Enterprise Virtualization environment. An API user accesses this information through the rel="networks" link obtained from the entry point URI.
Table 11.1. Network elements
| Element | Type | Description | Properties |
|---|---|---|---|
data_center id= | GUID | A reference to the data center of which this cluster is a member. |
|
vlan id= | integer | A VLAN tag. | |
mtu | integer | Sets the maximum transmission unit for the logical network. If omitted, the logical network uses the default value. | |
stp | Boolean: true or false | true if Spanning Tree Protocol is enabled on this network. | |
status | One of operational or non_operational | The status of the network. These states are listed in network_states under capabilities. |
|
usages | complex | Defines a set of usage elements for the network. Users can define networks as VM networks at this level. |
Important
11.2. XML Representation of a Network Resource
Example 11.1. An XML representation of a network resource
<network id="00000000-0000-0000-0000-000000000009"
href="/api/networks/00000000-0000-0000-0000-000000000009">
<name>rhevm</name>
<description>Management Network</description>
<data_center id="01a45ff0-915a-11e0-8b87-5254004ac988"
href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988"/>
<mtu>1500</mtu>
<stp>false</stp>
<status>
<state>operational</status>
</status>
<usages>
<usage>VM</usage>
</usages>
</network>
11.3. Methods
11.3.1. Creating a Network Resource
name and datacenter elements.
Example 11.2. Creating a network resource
POST /api/networks HTTP/1.1
Accept: application/xml
Content-type: application/xml
<network>
<name>network 1</name>
<data_center id="01a45ff0-915a-11e0-8b87-5254004ac988"/>
</network>
11.3.2. Updating a Network Resource
name, description, ip, vlan, stp and display elements are updatable post-creation.
Example 11.3. Updating a network resource
PUT /api/networks/e6575a87-377c-4f67-9c1b-7b94eff76b17 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<network>
<description>Network 1</description>
</network>
11.4. Sub-collections
11.4.1. Network VNIC Profile Sub-Collection
vnicprofile contains the following elements:
Table 11.2. Elements for vnic profiles
| Element | Type | Description |
|---|---|---|
name | string | The unique identifier for the profile. |
description | string | A plain text description of the profile. |
network | string | The unique identifier of the logical network to which the profile applies. |
port_mirroring | Boolean: true or false | The default is false. |
Example 11.5. An XML representation of the network's vnicprofile sub-collection
<vnic_profile href= "/api/vnicprofiles/f9c2f9f1-3ae2-4100-a9a5-285ebb755c0d" id="f9c2f9f1-3ae2-4100-a9a5-285ebb755c0d"> <name>Peanuts</name> <description>shelled</description> <network href= "/api/networks/00000000-0000-0000-0000-000000000009" id="00000000-0000-0000-0000-000000000009"/> <port_mirroring>false</port_mirroring> </vnic_profile> </vnic_profiles>
Chapter 12. Storage Domains
12.1. Storage Domain Elements
storagedomains collection provides information about the storage domains in a Red Hat Enterprise Virtualization environment. An API user accesses this information through the rel="storagedomains" link obtained from the entry point URI.
Table 12.1. Storage domain elements
| Element | Type | Description | Properties |
|---|---|---|---|
link rel="permissions" | relationship | A link to the sub-collection for storage domain permissions. | |
link rel="files" | relationship | A link to the files sub-collection for this storage domains. | |
link rel="vms" | relationship | A link to the vms sub-collection for a storage domain with type set to export. | |
link rel="templates" | relationship | A link to the templates sub-collection for a storage domain with type set to export. | |
type | enumerated | The storage domain type. A list of enumerated values are available in capabilities. |
|
master | Boolean: true or false | true if this is the master storage domain of a data center. |
|
host | complex | A reference to the host on which this storage domain should be initialized. The only restriction on this host is that it should have access to the physical storage specified. |
|
storage | complex | Describes the underlying storage of the storage domain. |
|
available | integer | Space available in bytes. |
|
used | integer | Space used in bytes. |
|
committed | integer | Space committed in bytes. |
|
storage_format | enumerated | Describes the storage format version for the storage domain. A list of enumerated values are available in capabilities. |
|
storage_domain_state | enumerated | Defines if the storage domain is currently attached to a data center. A list of enumerated values are available in capabilities. |
|
Important
12.2. XML Representation of a Storage Domain
Example 12.1. An XML representation of a storage domain
<storage_domain id="fabe0451-701f-4235-8f7e-e20e458819ed"
href="/api/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed">
<name>data0</name>
<link rel="permissions"
href="/api/storagedomains/be24cd98-8e23-49c7-b425-1a12bd12abb0/permissions"/>
<link rel="files"
href="/api/storagedomains/be24cd98-8e23-49c7-b425-1a12bd12abb0/files"/>
<type>data</type>
<master>true</master>
<storage>
<type>nfs</type>
<address>172.31.0.6</address>
<path>/exports/RHEVX/images/0</path>
</storage>
<available>156766306304</available>
<used>433791696896</used>
<committed>617401548800</committed>
<storage_format>v1</storage_format>
<storage_domain_state>unattached</storage_domain_state>
</storage_domain>
12.3. Methods
12.3.1. Creating a Storage Domain
name, type, host and storage elements. Identify the host element with the id attribute or name element.
Example 12.2. Creating a storage domain
POST /api/storagedomains HTTP/1.1
Accept: application/xml
Content-type: application/xml
<storage_domain>
<name>data1</name>
<type>data</type>
<host id="2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"/>
<storage>
<type>nfs</type>
<address>172.31.0.6</address>
<path>/exports/RHEVX/images/0</path>
</storage>
</storage_domain>
12.3.2. Updating a Storage Domain
name element is updatable post-creation.
Example 12.3. Updating a storage domain
PUT /api/storagedomains HTTP/1.1
Accept: application/xml
Content-type: application/xml
<storage_domain>
<name>data2</name>
...
</storage_domain>
12.4. Storage Types
12.4.1. Storage Types
storage element contains a type element, which is an enumerated value found under the capabilities collection.
type. The next few sections examine these additional storage type elements.
12.4.2. NFS Storage
nfs specific elements in a storage description.
Table 12.2. NFS specific elements
| Element | Type | Description | Properties |
|---|---|---|---|
address | string | The host name or IP address of the NFS server. |
|
path | string | The path of NFS mountable directory on the server. |
|
12.4.3. PosixFS Storage
posixfs specific elements in a storage description.
Table 12.3. PosixFS specific elements
| Element | Type | Description | Properties |
|---|---|---|---|
address | string | The host name or IP address of the PosixFS server. |
|
path | string | The path of PosixFS mountable directory on the server. |
|
vfs_type | string | The Linux-supported file system type of the PosixFS share. |
|
mount_options | string | The options for mounting the PosixFS share. |
|
12.4.4. iSCSI and FCP Storage
iscsi and fcp specific elements in a storage description.
Table 12.4. iSCSI and FCP specific elements
| Element | Type | Description | Properties |
|---|---|---|---|
logical_unit id= | complex | The id of the logical unit. A storage domain also accepts multiple iSCSI or FCP logical units. |
|
override_luns | Boolean | Defines whether to replace all logical unit settings with new settings. Set to true to override. |
|
logical_unit contains a set of sub-elements.
Table 12.5. Logical unit elements
| Element | Type | Description | Properties |
|---|---|---|---|
address | string | The address of the server containing the storage device. |
|
port | integer | The port number of the server. |
|
target | string | The target IQN for the storage device. |
|
username | string | A CHAP user name for logging into a target. |
|
password | string | A CHAP password for logging into a target. |
|
serial | string | The serial ID for the target. |
|
vendor_id | string | The vendor name for the target. |
|
product_id | string | The product code for the target. |
|
lun_mapping | integer | The Logical Unit Number device mapping for the target. |
|
logical_unit description also contains details of the iSCSI target with the LUN in question, the target performs an automatic login when the storage domain is created.
12.4.5. LocalFS Storage
localfs specific elements in a storage description are:
Table 12.6. Localfs specific elements
| Element | Type | Description | Properties |
|---|---|---|---|
path | string | The path of local storage domain on the host. |
|
localfs storage domain requires a data center with storage_type set to localfs. This data center only contains a single host cluster, and the host cluster only contains a single host.
12.5. Export Storage Domains
12.5.1. Export Storage Domains
type set to export contain vms and templates sub-collections, which list the import candidate VMs and templates stored on that particular storage domain.
Example 12.5. Listing the virtual machines sub-collection of an export storage domain
GET /api/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/vms
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<vms>
<vm id="082c794b-771f-452f-83c9-b2b5a19c0399"
href="/api/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/
vms/082c794b-771f-452f-83c9-b2b5a19c0399">
<name>vm1</name>
...
<storage_domain id="fabe0451-701f-4235-8f7e-e20e458819ed"
href="/api/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed"/>
<actions>
<link rel="import" href="/api/storagedomains/
fabe0451-701f-4235-8f7e-e20e458819ed/vms/
082c794b-771f-452f-83c9-b2b5a19c0399/import"/>
</actions>
</vm>
</vms>
storage_domain reference and an import action.
import action imports a virtual machine or a template from an export storage domain. The destination cluster and storage domain is specified with cluster and storage_domain references.
name element to give the virtual machine or template a specific name.
Example 12.6. Action to import a virtual machine from an export storage domain
POST /api/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/vms/
082c794b-771f-452f-83c9-b2b5a19c0399/import HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<storage_domain>
<name>images0</name>
</storage_domain>
<cluster>
<name>Default</name>
</cluster>
</action>
Example 12.7. Action to import a template from an export storage domain
POST /api/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/templates/
082c794b-771f-452f-83c9-b2b5a19c0399/import HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<storage_domain>
<name>images0</name>
</storage_domain>
<cluster>
<name>Default</name>
</cluster>
</action>
clone Boolean element to import the virtual machine as a new entity.
Example 12.8. Action to import a virtual machine as a new entity
POST /api/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/vms/
082c794b-771f-452f-83c9-b2b5a19c0399/import HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<storage_domain>
<name>images0</name>
</storage_domain>
<cluster>
<name>Default</name>
</cluster>
<clone>true</clone>
<vm>
<name>MyVM</name>
</vm>
...
</action>
disks element to choose which disks to import using individual disk id elements.
Example 12.9. Selecting disks for an import action
POST /api/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/vms/
082c794b-771f-452f-83c9-b2b5a19c0399/import HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<cluster>
<name>Default</name>
</cluster>
<vm>
<name>MyVM</name>
</vm>
...
<disks>
<disk id="4825ffda-a997-4e96-ae27-5503f1851d1b"/>
</disks>
</action>
export storage domain with a DELETE request.
Example 12.10. Delete virtual machine from an export storage domain
DELETE /api/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/vms/ 082c794b-771f-452f-83c9-b2b5a19c0399 HTTP/1.1 Accept: application/xml HTTP/1.1 204 No Content
12.6. Sub-Collections
12.6.1. Files Sub-Collection
files sub-collection under each storage domain provides a way for clients to list available files. This sub-collection is specifically targeted to ISO storage domains, which contain ISO images and virtual floppy disks (VFDs) that an administrator uploads through Red Hat Enterprise Virtualization Manager.
files sub-collection of an ISO storage domain.
Example 12.11. Listing the files sub-collection of an ISO storage domain
GET /api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/files HTTP/1.1
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<files>
<file id="en_winxp_pro_with_sp2.iso"
href="/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/files/
en_winxp_pro_with_sp2.iso">
<name>en_winxp_pro_with_sp2.iso</name>
<type>iso</type>
<storage_domain id="00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da"
href="/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da"/>
</file>
<file id="boot.vfd"
href="/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/files/
boot.vfd">
<name>boot.vfd</name>
<type>vfd</type>
<storage_doman id="00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da"
href="/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da"/>
</file>
</files>
id and href attributes. The name element contains the filename.
12.7. Actions
12.7.1. Importing an Existing Storage Domain
name is not specified.
Example 12.12. Importing an existing export storage domain
POST /api/storagedomains HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<storage_domain>
<type>export</type>
<storage>
<type>nfs</type>
<address>172.31.0.6</address>
<path>/exports/RHEVX/export-domain</path>
</storage>
<host id="2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"/>
</storage_domain>
HTTP/1.1 201 Created
Content-Type: application/xml
<storage_domain id="fabe0451-701f-4235-8f7e-e20e458819ed"
href="/api/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed">
<name>export1</name>
...
</storage_domain>
12.7.2. Deleting a Storage Domain
storage_domain reference is passed in the body of a DELETE request for a storage domain. The storage_domain reference is in the following form:
<storage_domain>
<host id="..."/>
</storage_domain>
<storage_domain>
<host>
<name>...</name>
</host>
</storage_domain>
format element to specify whether or not to format the storage domain after deletion.
Example 12.13. Formatting a storage domain after deletion
<storage_domain>
<host id="..."/>
<format>true</format>
</storage_domain>
format element is passed, the storage domain remains unformatted.
destroy element to logically remove the storage domain and retain the data.
Example 12.14. Logical removal of a storage domain
<storage_domain>
<host id="..."/>
<destroy>true</destroy>
</storage_domain>
Chapter 13. Storage Connections
13.1. Storage Connection Elements
Table 13.1. Storage Connection Base Elements
| Element | Type | Description | Properties |
|---|---|---|---|
type | One of nfs, posixfs, local, or iscsi | The type of storage domain. |
|
address | string | The hostname or IP address of the storage domain. |
(Only required for NFS and iSCSI)
|
host | string | The id or name of the hypervisor. The host is optional. Providing it will attempt a connection to the storage via the host; not providing it will lead to persisting storage details in the database. |
Table 13.2. Storage Connection File-based Storage Elements
| Element | Type | Description | Properties |
|---|---|---|---|
path | string | The mounted file path of the storage domain. The path cannot be updated to one already used by a storage connection. |
|
mount_options | string | The options for mounting the PosixFS share. | |
vfs_type | string | The Linux-supported file system type of the PosixFS share. |
|
nfs_version | string | The version of NFS used. | |
nfs_timeo | integer | The amount of time, in deciseconds, the NFS client will wait for a request to complete. | |
nfs_retrans | integer | The number of retransmissions the NFS client will attempt to complete a request. |
Table 13.3. Storage Connection iSCSI elements
| Element | Type | Description | Properties |
|---|---|---|---|
port | integer | The TCP port used for the iSCSI storage domain. |
|
target | string | The target IQN for the storage device. |
|
username | string | A CHAP user name for logging into a target. | |
password | string | A CHAP password for logging into a target. |
13.2. XML representation of a Storage Connection Resource
Example 13.1. An XML representation of a storage connection resource
<storage_connections>
<storage_connection href= "/api/storageconnections/608c5b96-9939-4331-96b5-197f28aa2e35" id="608c5b96-9939-4331-96b5-197f28aa2e35">
<address>domain.example.com</address>
<type>nfs</type>
<path>/var/lib/exports/iso</path>
</storage_connection>
<storage_connection href= "/api/storageconnections/2ebb3f78-8c22-4666-8df4-e4bb7fec6b3a" id="2ebb3f78-8c22-4666-8df4-e4bb7fec6b3a">
<address>domain.example.com</address>
<type>posixfs</type>
<path>/export/storagedata/username/data</path>
<vfs_type>nfs</vfs_type>
</storage_connection>
</storage_connections>
13.3. Methods
13.3.1. Creating a New Storage Connection
POST request.
id or name is optional; providing it will attempt a connection to the storage via the host.
Example 13.2. Creating a New Storage Connection
POST /api/storageconnections HTTP/1.1
Accept: application/xml
Content-type: application/xml
<storage_connection>
<type>nfs</type>
<address>domain.example.com</address>
<path>/export/storagedata/username/data</path>
<host>
<name>Host_Name</name>
</host>
</storage_connection>
13.3.2. Deleting a Storage Connection
DELETE request. A storage connection can only be deleted if neither storage domain nor LUN disks reference it.
name or id is optional; providing it unmounts the connection from that host.
Example 13.3. Deleting Storage Connection
DELETE /api/storageconnections/Storage_Connection_ID HTTP/1.1 Accept: application/xml Content-type: application/xml <host> <name>Host_Name</name> </host>
13.3.3. Updating a Storage Connection
PUT request.
name or id is optional; if provided, the host attempts a connection to the updated storage details.
Example 13.4. Updating a Storage Connection
PUT /api/storageconnections/Storage_Connection_ID HTTP/1.1
Accept: application/xml
Content-type: application/xml
<storage_connection>
<address>updated.example.domain.com</address>
<host>
<name>Host_name</name>
</host>
</storage_connection>
13.3.4. Adding New Storage Domain with Existing Storage Connection
POST request. This is only applicable with file-based storage domains: NFS, POSIX, and local.
Example 13.5. Adding a New Storage Domain with Existing Storage Connection
POST /api/storagedomains HTTP/1.1
Accept: application/xml
Content-type: application/xml
<storage_domain>
<name>New_Domain</name>
<type>data</type>
<storage id="Storage_Connection_ID"/>
<host>
<name>Host_Name</name>
</host>
</storage_domain>
13.3.5. Attaching an Additional Storage Connection to iSCSI Storage
POST request.
Example 13.6. Attaching an Additional Storage Connection to iSCSI Storage
POST /api/storagedomains/iSCSI_Domain_ID/storageconnections HTTP/1.1 Accept: application/xml Content-type: application/xml <storage_connection id="Storage_Connection_ID"> </storage_connection>
13.3.6. Detaching a Storage Connection from iSCSI Storage
DELETE request.
Example 13.7. Detaching a Storage Connection from iSCSI Storage
DELETE /api/storagedomains/iSCSI_Domain_ID/storageconnections/Storage_Connection_ID HTTP/1.1 Accept: application/xml Content-type: application/xml
Chapter 14. Hosts
14.1. Host Elements
hosts collection provides information about the hosts in a Red Hat Enterprise Virtualization environment. An API user accesses this information through the rel="hosts" link obtained from the entry point URI.
Table 14.1. Host elements
| Element | Type | Description | Properties |
|---|---|---|---|
link rel="storage" | relationship | A link to the storage sub-collection for host storage. |
|
link rel="nics" | relationship | A link to the nics sub-collection for host network interfaces. | |
link rel="tags" | relationship | A link to the tags sub-collection for host tags. | |
link rel="permissions" | relationship | A link to the permissions sub-collection for host permissions. | |
link rel="statistics" | relationship | A link to the statistics sub-collection for host statistics. |
|
type | One of rhel or rhev-h | The host type. |
|
address | string | The IP address or hostname of the host. |
|
certificate | complex | A reference to the host certificate details, including organization and subject. |
|
status | See below | The host status. |
|
cluster id= | GUID | A reference to the cluster that includes this host. | |
port | integer | The listen port of the VDSM daemon running on this host. |
|
storage_manager | complex | Defines an appropriate host to use as the storage pool manager (SPM). Requires a host priority attribute and a Boolean value (true or true). |
|
power_management | complex | Configuration options for host power management. | |
ksm | Boolean: true or false | true if Kernel SamePage Merging (KSM) is enabled. | |
transparent_hugepages | Boolean: true or false | true if Transparent Hugepages is enabled. | |
iscsi | complex | The SCSI initiator for the host. |
|
cpu | complex | Statistics for the host CPU. Includes sub-elements for the CPU's name, topology cores=, topology sockets= and speed. The topology cores= aggregates the total cores while the topology sockets= aggregates the total physical CPUs. The total cores available to virtual machines equals the number of sockets multiplied by the cores per socket. |
|
memory | integer | The total amount of host memory in bytes. |
|
summary | complex | Summary statistics of the virtual machines on the host. Includes sub-elements for numbers of active, migrating and total VMs. |
|
version major= minor= | complex | The compatibility level of the host. |
|
root_password | string | The root password of this host, by convention only included in the client-provided host representation on creation. |
|
libvirt_version | complex | The libvirt compatibility level of the host. |
|
status contains one of the following enumerative values: down, error, initializing, installing, install_failed, maintenance, non_operational, non_responsive, pending_approval, preparing_for_maintenance, connecting, reboot, unassigned and up. These states are listed in host_states under capabilities.
14.2. XML Representation of a Host
Example 14.1. An XML representation of a host
<host id="2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3">
<name>host1</name>
<actions>
<link rel="install"
href="/api/hosts/762f3276-9d1e-11e0-a27c-525400d75548/install"/>
<link rel="activate"
href="/api/hosts/762f3276-9d1e-11e0-a27c-525400d75548/activate"/>
<link rel="fence"
href="/api/hosts/762f3276-9d1e-11e0-a27c-525400d75548/fence"/>
<link rel="deactivate"
href="/api/hosts/762f3276-9d1e-11e0-a27c-525400d75548/deactivate"/>
<link rel="approve"
href="/api/hosts/762f3276-9d1e-11e0-a27c-525400d75548/approve"/>
<link rel="iscsilogin"
href="/api/hosts/762f3276-9d1e-11e0-a27c-525400d75548/iscsilogin"/>
<link rel="iscsidiscover"
href="/api/hosts/762f3276-9d1e-11e0-a27c-525400d75548/iscsidiscover"/>
<link rel="commitnetconfig"
href="/api/hosts/762f3276-9d1e-11e0-a27c-525400d75548/commitnetconfig"/>
</actions>
<link rel="storage"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/storage"/>
<link rel="nics"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics"/>
<link rel="tags"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/tags"/>
<link rel="permissions"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/permissions"/>
<link rel="statistics"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/statistics"/>
<type>rhev-h</type>
<address>host1.example.com</address>
<status>
<state>up</state>
</status>
<cluster id="99408929-82cf-4dc7-a532-9d998063fa95"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95"/>
<port>54321</port>
<storage_manager priority="2">true</storage_manager>
<power_management>
<enabled>false</enabled>
<options/>
</power_management>
<ksm>
<enabled>true</enabled>
</ksm>
<transparent_hugepages>
<enabled>true</enabled>
</transparent_hugepages>
<iscsi>
<initiator>iqn.2001-04.com.example:diskarrays-sn-a8675309</initiator>
</iscsi>
<cpu>
<topology cores="2" sockets="1"/>
<name>Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz</name>
<speed>2993</speed>
</cpu>
<summary>
<active>2</active>
<migrating>0</migrating>
<total>3</total>
</summary>
<version major="3" minor="0"/>
<libvirt_version major="0" minor="10" build="2" revision="0" full_version="libvirt-0.10.2-15.el6"/>
</host>
14.3. Power Management Elements
power_management element provides users with the ability to set a power management configuration, which is required for host fencing. Certain sub-elements are required when configuring power_management.
Table 14.2. Power management options
| Element | Type | Description | Properties |
|---|---|---|---|
type= | fencing device code | A list of valid fencing device codes are available in the capabilities collection. |
|
enabled | Boolean: true or false | Indicates whether power management configuration is enabled or disabled. |
|
address | string | The host name or IP address of the host. |
|
username | string | A valid user name for power management. | |
password | string | A valid, robust password for power management. | |
options | complex | Fencing options for the selected type=. | |
agent | complex | Specifies fencing agent options when multiple fences are used. Subelement concurrent is a True|False Boolean that selects concurrent|sequential configuration respectively. Use the order subelement to prioritize the fencing agents. Other subelements include address, username, password, and options. |
options element requires a list of option sub-elements. Each option requires a name and type attributes. Certain options are only available for specific fencing types as defined in the capabilities collection.
power_management configuration when POSTing to the host resource. The power_management configuration is updatable using a PUT request.
Example 14.2. An XML representation of a host's power management configuration
<host id="2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3">
<name>host1</name>
...
<power_management type="ilo">
<enabled>true</enabled>
<address>192.168.1.107</address>
<username>admin</username>
<password>p@55w0Rd!</password>
<options>
<option name="secure" value="true"/>
<option name="port" value="54345"/>
<option name="slot" value="3"/>
</options>
<agents>
<agent type="rsa">
<address>192.168.1.111</address>
<username>e.xample</username> order="primary"
<password>p@55w0rd!</password>
<options>
<option name="443" value="true"/>
<option name="secure" value "false"/>
</options>
<concurrent>false</concurrent>
<order>1</order>
</agent>
<agent type="ipmi">
<address>192.168.1.112</address>
<username>e.xample</username> order="primary"
<password>p@55w0rd!</password>
<options>
<option name="443" value="true"/>
<option name="secure" value "false"/>
</options>
<concurrent>false</concurrent>
<order>2</order>
</agent>
</agents>
</power_management>
...
</host>
14.4. Memory Management Elements
ksm element.
Example 14.3. Setting KSM memory management
PUT /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3 HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<host id="2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3">
<ksm>true</ksm>
</host>
transparent_hugepages element.
Example 14.4. Setting Transparent Hugepage memory management
PUT /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3 HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<host id="2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3">
<transparent_hugepages>true</transparent_hugepages>
</host>
capabilities collection.
14.5. Methods
14.5.1. Creating a Host
name, address and root_password elements.
Example 14.5. Creating a host
POST /api/hosts HTTP/1.1
Accept: application/xml
Content-type: application/xml
<host>
<name>host2</name>
<address>host2.example.com</address>
<root_password>p@55w0Rd!</root_password>
</host>
root_password element is only included in the client-provided initial representation and is not exposed in the representations returned from subsequent requests.
14.5.2. Updating a Host
name, description, cluster, power_management, transparent_hugepages and ksm elements are updatable post-creation.
Example 14.6. Updating a host
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<host>
<name>host3</name>
</host>
14.6. Sub-Collections
14.6.1. Host Network Interface Sub-Collection
14.6.1.1. Host Network Interface Sub-Collection
nics sub-collection represents a host's physical network interfaces. Each host_nic element in the representation acts as a network interface and contains the following elements:
Table 14.3. Elements for a host's network interfaces
| Element | Type | Description | Properties |
|---|---|---|---|
name | string | The name of the host network interface, e.g. eth0 |
[a]
|
link rel="statistics" | relationship | A link to the statistics sub-collection for a host's network interface statistics. |
|
link rel="master" | relationship | A reference to the master bonded interface, if this is a slave interface. |
|
host id= | GUID | A reference to the host. |
|
network id= | GUID | A reference to the network, if any, that the interface is attached. |
[b] |
mac address= | string | The MAC address of the interface. |
|
ip address= netmask= gateway= mtu= | complex | The IP level configuration of the interface. | |
mtu | complex | The maximum transmission unit for the interface. | |
boot_protocol | enumerated | The protocol for IP address assignment when the host is booting. A list of enumerated values is available in capabilities. | |
speed | integer | The network interface speed in bits per second. |
|
status | enumerated | The link status for the network interface. These states are listed in host_nic_states under capabilities. |
|
vlan id | integer | The VLAN which this interface represents. |
|
bonding | complex | A list of options and slave NICs for bonded interfaces. |
[c]
|
bridged | Boolean | Defines the bridged network status. Set to true for a bridged network and true for a bridgeless network. | |
[a]
Only required when adding bonded interfaces. Other interfaces are read-only and cannot be added.
[b]
Only required when adding bonded interfaces. Other interfaces are read-only and cannot be added.
[c]
Only required when adding bonded interfaces. Other interfaces are read-only and cannot be added.
| |||
Example 14.8. An XML representation of a network interface on a host
<host_nic id="e8f02fdf-3d7b-4135-86e1-1bf185570cd8"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics/
e8f02fdf-3d7b-4135-86e1-1bf185570cd8">
<name>bond0</name>
<link rel="statistics"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics/
e8f02fdf-3d7b-4135-86e1-1bf185570cd8/statistics"/>
<host id="2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"/>
<network id="e657d631-657d-42bb-a536-73501a085d85"
href="/api/networks/e657d631-657d-42bb-a536-73501a085d85"/>
<mac address="D6:76:F1:3A:AF:74"/>
<ip address="192.168.0.128" netmask="255.255.255.0" gateway="192.168.0.1"/>
<mtu>1500</mtu>
<boot_protocol>dhcp</boot_protocol>
<speed>1000000000</speed>
<status>
<state>up</state>
</status>
<bonding>
<options>
...
</options>
<slaves>
<host_nic id="eb14e154-5e73-4f7f-bf6b-7f52609d94ec"/>
<host_nic id="6aede5ca-4c54-4b37-a81b-c0d6b53558ea"/>
</slaves>
</bonding>
<actions>
<link rel="attach"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics/
e8f02fdf-3d7b-4135-86e1-1bf185570cd8/attach"/>
<link rel="detach"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics/
e8f02fdf-3d7b-4135-86e1-1bf185570cd8/detach"/>
</actions>
<bridged>true</bridged>
</host_nic>
network, ip and boot_protocol elements using a PUT request.
name and network elements are required. Identify the network element with the id attribute or name element.
POST /api/hosts HTTP/1.1
Accept: application/xml
Content-type: application/xml
<host_nic>
<name>MyNIC</name>
<network id="e657d631-657d-42bb-a536-73501a085d85">
<name>MyNetwork</name>
</network>
</host_nic>
PUT request.
PUT /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics/
e8f02fdf-3d7b-4135-86e1-1bf185570cd8 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<host_nic>
<ip address="192.168.0.129" netmask="255.255.255.0" gateway="192.168.0.1"/>
</host_nic>
DELETE request.
DELETE /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics/ e8f02fdf-3d7b-4135-86e1-1bf185570cd8 HTTP/1.1 HTTP/1.1 204 No Content
Important
14.6.1.2. Bonded Interfaces
host_nic resource containing a bonding element.
Table 14.4. Bonded interface properties
| Element | Type | Description | Properties |
|---|---|---|---|
options | complex | A list of option elements for a bonded interface. Each option contains property name and value attributes. |
[a]
|
slaves | complex | A list of slave host_nic id= elements for a bonded interface. |
[b]
|
[a]
Only required when adding bonded interfaces. Other interfaces are read-only and cannot be added.
[b]
Only required when adding bonded interfaces. Other interfaces are read-only and cannot be added.
| |||
host_nic (POST) or updating a host_nic (PUT). Use either the id or name elements identify the slave host_nic elements.
Example 14.9. Creating a bonded interface
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<host_nic>
<name>bond4</name>
<network id="e657d631-657d-42bb-a536-73501a085d85"/>
<bonding>
<options>
...
</options>
<slaves>
<host_nic id="eb14e154-5e73-4f7f-bf6b-7f52609d94ec"/>
<host_nic id="6aede5ca-4c54-4b37-a81b-c0d6b53558ea"/>
</slaves>
</bonding>
</host_nic>
Important
bond0, bond1, bond2, bond3 and bond4 are the only valid names for a bonded interface.
DELETE request to a bonded interface URI to delete it.
Important
14.6.1.3. Network Interface Statistics
statistics sub-collection for a host's network interface statistics. Each statistic contains the following elements:
Table 14.5. Elements for a host'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. |
host_nic id= | relationship | A relationship to the containing host_nic resource. |
Table 14.6. Host 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 14.10. An XML representation of a host's network interface statistics sub-collection
<statistics>
<statistic id="ecd0559f-e88f-3330-94b4-1f091b0ffdf7"
href="/api/hosts/25fcdd2e-d452-11e0-bb4d-525400d75548/nics/
c34728e8-4338-4540-ac9b-86b8582e602e/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>
<host_nic id="c34728e8-4338-4540-ac9b-86b8582e602e"
href="/api/hosts/25fcdd2e-d452-11e0-bb4d-525400d75548/nics/
c34728e8-4338-4540-ac9b-86b8582e602e"/>
</statistic>
...
</statistics>
Note
statistics sub-collection is read-only.
14.6.1.4. Actions
14.6.1.4.1. Attach Network Interface Card to Host Action
id or name elements identify the network to which the network interface card will be attached.
Example 14.11. Action to attach a host network interface card to a network
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics/e8f02fdf-3d7b-4135-86e1-1bf185570cd8/attach HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<network id="e657d631-657d-42bb-a536-73501a085d85"/>
</action>Important
14.6.1.4.2. Detach Network Interface Card from Host Action
id or name elements identify the network from which the network interface card will be detached.
Example 14.12. Action to detach a host network interface card from a network
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics/e8f02fdf-3d7b-4135-86e1-1bf185570cd8/detach HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<network id="e657d631-657d-42bb-a536-73501a085d85"/>
</action>Important
14.6.1.4.3. Multiple Network Setup Action
nics collection contains an action to perform setup of multiple network interfaces. Perform a POST request on the setupnetworks action.
Example 14.13. Action to setup multiple host network interfaces
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics/setupnetworks HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<host_nics>
<host_nic id="41561e1c-c653-4b45-b9c9-126630e8e3b9">
<name>em1</name>
<network id="00000000-0000-0000-0000-000000000009"/>
<boot_protocol>dhcp</boot_protocol>
</host_nic<
<host_nic id="3c3f442f-948b-4cdc-9a48-89bb0593cfbd">
<name>em2</name>
<network id="00000000-0000-0000-0000-000000000010"/>
<ip address="10.35.1.247" netmask="255.255.254.0"
gateway="10.35.1.254"/>
<boot_protocol>static</boot_protocol>
</host_nic>
<checkConnectivity>true</checkConnectivity>
<connectivityTimeout>60</connectivityTimeout>
<force>false</false>
</host_nics>
</action>
Table 14.7. Additional elements for multiple host network interface setup
| Element | Type | Description | Properties |
|---|---|---|---|
checkConnectivity | Boolean | Set to true to verify connectivity between the host and the Red Hat Enterprise Virtualization Manager. If the connectivity is lost, Red Hat Enterprise Virtualization Manager reverts the settings. | |
connectivityTimeout | integer | Defines the timeout for loss of connectivity. | |
force | Boolean | Set to true to force changes even if connectivity is lost. |
14.6.2. Storage Sub-Collection
storage sub-collection provides a list of the iSCSI and FCP storage representations available on the host. This storage is used to create storage domains.
storage representation in the sub-collection represents a SCSI LUN.
Example 14.14. An XML representation of the storage sub-collection on a host
<host_storage>
<storage id="82fb123b-321e-40a1-9889-95dcd2654463"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/storage/
82fb123b-321e-40a1-9889-95dcd2654463">
<name>LUN0</name>
<type>iscsi</type>
<logical_unit id="LUN0">
<address>mysan.example.com</address>
<target>iqn.2009-08.com.example:mysan.foobar</target>
</logical_unit>
</storage>
</host_storage>
Note
host_storage collection is read-only.
Important
14.6.3. Host Statistics Sub-Collection
statistics sub-collection for host-specific statistics. Each statistic contains the following elements:
Table 14.8. Elements for host 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. |
host id= | relationship | A relationship to the containing host resource. |
Table 14.9. Host statistic types
|
Name
|
Description
|
|---|---|
memory.total |
Total memory in bytes on the host.
|
memory.used |
Memory in bytes used on the host.
|
memory.free |
Memory in bytes free on the host.
|
memory.buffers |
I/O buffers in bytes.
|
memory.cached |
OS caches in bytes.
|
swap.total |
Total swap memory in bytes on the host.
|
swap.free |
Swap memory in bytes free on the host.
|
swap.used |
Swap memory in bytes used on the host.
|
swap.cached |
Swap memory in bytes also cached in host's memory.
|
ksm.cpu.current |
Percentage of CPU usage for Kernel SamePage Merging.
|
cpu.current.user |
Percentage of CPU usage for users.
|
cpu.current.system |
Percentage of CPU usage for system.
|
cpu.current.idle |
Percentage of idle CPU usage.
|
cpu.load.avg.5m |
CPU load average per five minutes.
|
Example 14.15. An XML representation of the host's statistics sub-collection
<statistics>
<statistic id="4ae97794-f56d-3f05-a9e7-8798887cd1ac"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/
statistics/4ae97794-f56d-3f05-a9e7-8798887cd1ac">
<name>memory.total</name>
<description>Total memory</description>
<unit>BYTES</unit>
<type>GUAGE</type>
<values type="INTEGER">
<value>
<datum>3983540224<datum>
</value>
</values>
<host id="2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"
href="/api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"/>
</statistic>
...
</statistics>
Note
statistics sub-collection is read-only.
14.7. Actions
14.7.1. Install VDSM Action
- Red Hat Enterprise Linux host - This host type requires a
root_passwordelement that refers to the password for the host'srootuser. - Red Hat Enterprise Virtualization Hypervisor host - This host type requires an
imageelement that refers to an ISO file stored on the Red Hat Enterprise Virtualization Manager server.
Example 14.16. Action to install VDSM to a Red Hat Enterprise Linux host
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/install HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<root_password>p@55w0Rd!</root_password>
</action>
Example 14.17. Action to install VDSM to a Red Hat Enterprise Virtualization Hypervisor host
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/install HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<image>/usr/share/rhev-hypervisor/rhev-hypervisor.iso</image>
</action>
14.7.2. Activate Host Action
Example 14.18. Action to activate a host
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/activate HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
14.7.3. Fence Host Action
fence action. The capabilities lists available fence_type options.
Example 14.19. Action to fence a host
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/fence
Accept: application/xml
Content-Type: application/xml
<action>
<fence_type>start</fence_type>
</action>
14.7.4. Deactivate Host Action
Example 14.20. Action to deactivate a host
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/deactivate HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
14.7.5. Approve Host Action
cluster element to define the target cluster for this host.
Example 14.21. Action to approve a host
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/approve HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<cluster id="99408929-82cf-4dc7-a532-9d998063fa95"/>
<action>
14.7.6. Host iSCSI Login Action
iscsilogin action enables a host to login to an iSCSI target. Logging into a target makes the contained LUNs available in the host_storage collection.
Example 14.22. Action to enable a host to login to iSCSI target
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/iscsilogin HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<action>
<iscsi>
<address>mysan.example.com</address>
<target>iqn.2009-08.com.example:mysan.foobar</target>
<username>jimmy</username>
<password>s3kr37</password>
</iscsi>
</action>
14.7.7. Host iSCSI Discover Action
iscsidiscover action enables an iSCSI portal to be queried for its list of LUNs.
Example 14.23. Action to query a list of LUNs for iSCSI portal
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/iscsidiscover HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<action>
<iscsi>
<address>mysan.example.com</address>
<port>3260<port>
</iscsi>
</action>
14.7.8. Commit Host Network Configuration Action
Example 14.24. Action to commit network configuration
POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/commitnetconfig HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
Important
Chapter 15. Virtual Machines
15.1. Virtual Machine Elements
vms collection provides information about virtual machines in a Red Hat Enterprise Virtualization environment. An API user accesses this information through the rel="vms" link obtained from the entry point URI.
Table 15.1. Virtual machine elements
| Element | Type | Description | Properties |
|---|---|---|---|
link rel="disks" | relationship | A link to the disks sub-collection for virtual machine resources. | |
link rel="nics" | relationship | A link to the nics sub-collection for virtual machine resources. | |
link rel="cdroms" | relationship | A link to the cdroms sub-collection for virtual machine resources. | |
link rel="snapshots" | relationship | A link to the snapshots sub-collection for virtual machine resources. | |
link rel="tags" | relationship | A link to the tags sub-collection for virtual machine resources. | |
link rel="permissions" | relationship | A link to the permissions sub-collection for virtual machine permissions. | |
link rel="statistics" | relationship | A link to the statistics sub-collection for virtual machine resources. |
|
link rel="watchdogs" |
relationship
|
A link to the
watchdogs sub-collection for virtual machine resources.
| |
type | enumerated | The virtual machine type. A list of enumerated values are available in capabilities. |
|
status | See below | The virtual machine status. |
|
memory | integer | The amount of memory allocated to the guest in bytes. | |
cpu | complex |
Defines CPU details for the virtual machine. The
topology sub-element sets number of logical sockets available to the guest and the number of cores per socket. The total cores available to the virtual machine equals the number of sockets multiplied by the cores per socket.
The
cputune sub-element maps virtual CPUs to physical host CPUs using a series of vcpupin elements. Each vcpupin elements contains a virtual CPU attribute (vcpu) and an attribute to define which physical to use (cpuset). Set the cpuset to either a single CPU (cpuset="0"), multiple CPUs (cpuset="0,2"), a CPU range (cpuset="0-3") or a CPU range with exclusion (cpuset="0-3,^2").
The
cpu_mode sub-element defines how closely the virtual CPU relates to the host CPU. It has three values: custom is the default if no mode is given, host_model copies the host CPU as best as libvirt can understand, and host_passthrough passes all aspects of the host to the guest, even those that libvirt does not recognize. However, host_passthrough will prevent migration of that virtual machine.
| |
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 the virtual machine is configured to boot. This option supports booting a Linux kernel directly rather than through the BIOS bootloader. | |
os initrd | string | A path to an initrd image to be used with the previously specified kernel. This option supports booting a Linux kernel directly rather than through the BIOS bootloader. | |
os cmdline | string | A kernel command line parameter string to be used with the defined kernel. This option supports booting a Linux kernel directly rather than through the BIOS bootloader. | |
high_availability | complex | Set enabled to true if the virtual machine should be automatically restarted if the virtual machine or its host crashes. A priority element controls the order in which virtual machines 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.
The
smartcard_enabled sub-element is a Boolean (true or false) to specify if a Smartcard attached to a client is passed through to a virtual machine. The default is false.
| |
cluster id= | GUID | A reference to the virtual machine's host cluster. |
|
template id= | GUID | A reference to the template on which this virtual machine is based. |
|
domain id= | GUID | A reference to the virtual machine's domain. |
|
start_time | xsd:dateTime format: YYYY-MM-DDThh:mm:ss | The date and time at which this virtual machine was started. |
|
creation_time | xsd:dateTime format: YYYY-MM-DDThh:mm:ss | The date and time at which this virtual machine was created. |
|
origin | One of rhev, ovirt, vmware or xen | The system from which this virtual machine originated. |
|
stateless | Boolean: true or false | true if the virtual machine is stateless. A stateless virtual machine contains a snapshot of its disk image taken at boot and deleted at shutdown. This means state changes do not persist after a reboot. | |
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. | |
memory_policy | complex | Sets the memory policy for virtual machines. Defines the minimum amount of guaranteed memory on a host in order for the virtual machine to run. | |
quota id= | GUID | Sets a quota for the virtual machine. | |
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. | |
usb | complex | Defines the USB policy for a virtual machine. Requires an enabled element set to a Boolean value and a type element set to either native or legacy. | |
guest_info | complex | A reference to the guest client information. Includes an ip element with an address= attribute. |
|
vmpool | complex | A reference to the virtual machine pool. This element only appears for virtual machines part of a pool. |
|
timezone | tz database format: Area/Location | The the Sysprep timezone setting for a Windows virtual machine. | |
domain | complex | The the Sysprep domain setting for a Windows virtual machine. Requires a name from the domains collection. | |
payloads | complex |
Defines a set of
payload elements to deliver content to a virtual machine upon boot. Each payload requires a type attribute, either cdrom or floppy, and a file element that specifies the name and location using the name attribute. Within the file element is a content element that defines the content to deliver to the file.
The
payloads element is used by the cloud-init feature. When cloud-init is used to configure a virtual machine, a payload is automatically created with the type attribute set to cd-rom and two file sub-elements, openstack/latest/meta_data.json and openstack/latest/user_data, which pass configuration parameters to the virtual machine.
|
status contains one of the following enumerative values: unassigned, down, up, powering_up, powered_down, paused, migrating_from, migrating_to, unknown, not_responding, wait_for_launch, reboot_in_progress, saving_state, restoring_state, suspended, image_illegal, image_locked or powering_down. These states are listed in vm_states under capabilities.
15.2. XML Representation of a Virtual Machine
Example 15.1. An XML representation of a virtual machine
<vm id="082c794b-771f-452f-83c9-b2b5a19c0399"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399">
<name>vm1</name>
<description>Virtual Machine 1</description>
<actions>
<link rel="start"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/start"/>
<link rel="stop"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/stop"/>
<link rel="shutdown"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/shutdown"/>
<link rel="suspend"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/suspend"/>
<link rel="detach"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/detach"/>
<link rel="migrate"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/migrate"/>
<link rel="export"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/export"/>
<link rel="import"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/import"/>
<link rel="move"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/move"/>
<link rel="ticket"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/ticket"/>
</actions>
<link rel="disks"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks"/>
<link rel="nics"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/nics"/>
<link rel="cdroms"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/cdroms"/>
<link rel="snapshots"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/snapshots"/>
<link rel="users"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/users"/>
<link rel="tags"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/tags"/>
<link rel="permissions"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/permissions"/>
<link rel="statistics"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/statistics"/>
<type>desktop</type>
<status>
<state>up</state>
</status>
<memory>536870912</memory>
<cpu>
<topology cores="2" sockets="2"/>
<cpu_tune>
<vcpu_pin vcpu="0" cpu_set="1-4,^2"/>
<vcpu_pin vcpu="1" cpu_set="0,1"/>
<vcpu_pin vcpu="2" cpu_set="2,3"/>
<vcpu_pin vcpu="3" cpu_set="0,4"/>
</cpu_tune>
<cpu_mode>host_passthrough</cpu_mode>
</cpu>
<os type="RHEL5">
<boot dev="hd"/>
<kernel/>
<initrd/>
<cmdline/>
</os>
<highly_available>
<enabled>true</enabled>
<priority>20</priority>
</highly_available>
<display>
<type>vnc</type>
<port>5910</port>
<monitors>1</monitors>
<smartcard_enabled>true</smartcard_enabled>
</display>
<cluster id="99408929-82cf-4dc7-a532-9d998063fa95"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95"/>
<template id="00000000-0000-0000-0000-000000000000"
href="/api/templates/00000000-0000-0000-0000-000000000000"/>
<start_time>2010-18-16T13:14:15</start_time>
<creation_time>2010-08-16T14:24:29</creation_time>
<origin>rhev</origin>
<stateless>false</stateless>
<placement_policy>
<host id="2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"/>
<affinity>migratable</affinity>
</placement_policy>
<memory_policy>
<guaranteed>536870912</guaranteed>
</memory_policy>
<usb>
<enabled>true</enabled>
</usb>
<custom_properties>
<custom_property value="124" name="sndbuf"/>
</custom_properties>
<guest_info>
<ip address="192.168.0.25"/>
</guest_info>
<payloads>
<payload type='cdrom'>
<file name='/etc/hosts'>
<content>
127.0.0.1 localhost myvm.example.com
</content>
</file>
</payload>
</payloads>
</vm>
15.3. Methods
15.3.1. Creating a Virtual Machine
name, template and cluster elements. Identify the template and cluster elements with the id attribute or name element.
Example 15.2. Creating a virtual machine with 512 MB and boots from the virtual hard disk
POST /api/vms HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vm>
<name>vm2</name>
<description>Virtual Machine 2</description>
<type>desktop</type>
<memory>536870912</memory>
<cluster>
<name>default</name>
</cluster>
<template>
<name>Blank</name>
</template>
<os>
<boot dev="hd"/>
</os>
</vm>
Note
15.3.2. Updating a Virtual Machine
name, description, cluster, type, memory, cpu, os, high_availability, display, timezone, domain, stateless, placement_policy, memory_policy, usb, payloads, origin and custom_properties elements are updatable post-creation.
Example 15.3. Updating a virtual machine to contain 1 GB of memory
PUT /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vm>
<memory>1073741824</memory>
</vm>
Note
15.3.3. Removing a Virtual Machine
DELETE request.
Example 15.4. Removing a virtual machine
DELETE /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399 HTTP/1.1 HTTP/1.1 204 No Content
15.3.4. Removing a Virtual Machine but not the Virtual Disk
DELETE request.
Example 15.5. Removing a virtual machine
DELETE /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<vm>
<disks>
<detach_only>true</detach_only>
</disks>
</vm>
</action>
15.4. Sub-Collections
15.4.1. Disks Sub-Collection
15.4.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. |
|
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. |
|
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. | |
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. | |
lunStorage | complex | A reference to a direct LUN mapping for storage usage. Requires a storage element that contains iSCSI or FCP device details. |
|
active | Boolean | Defines if the disk is connected to the virtual machine. |
|
[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.6. An XML representation of a disk device
<disk id="ed7feafe-9aaf-458c-809a-ed789cdbd5b4"
href="/api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/disks/
ed7feafe-9aaf-458c-809a-ed789cdbd5b4">
<link rel="statistics"
href="/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks/
ed7feafe-9aaf-458c-809a-ed789cdbd5b4/statistics"/>
<storage_domains>
<storage_domain id="fabe0451-701f-4235-8f7e-e20e458819ed"/>
</storage_domains>
<size>10737418240</size>
<type>system</type>
<status>
<state>ok</state>
</status>
<interface>virtio</interface>
<format>raw</format>
<bootable>true</bootable>
<shareable>true</shareable>
<vm id="cdc0b102-fbfe-444a-b9cb-57d2af94f401"
href="/api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401"/>
<lunStorage>
<storage>
<logical_unit id="lun1">
...
</logical_unit>
<storage>
</lunStorage>
</disk>
size element is required. Also the API requires the storage_domains element when the disk is added to a virtual machine and not itself created from a template.
Example 15.7. Creating a new a 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>
<size>8589934592</size>
<type>system</type>
<interface>virtio</interface>
<format>cow</format>
<bootable>true</bootable>
</disk>
name, description, storage_domains, interface, bootable, shareable, wipe_after_delete and propagate_errors elements are updatable post-creation.
Example 15.8. 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>
DELETE request.
Example 15.9. 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.4.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.10. 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.4.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.11. 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.4.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.12. 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.13. Detach a disk from a virtual machine
DELETE /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399/disks/
d135f1c5-b5e1-4238-9381-b3277f5a3742HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<detach>true</detach>
</action>
15.4.1.5. Disk Activate and Deactivate Actions
activate and deactivate actions to add and remove disks from a virtual machine.
Example 15.14. 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.15. 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.4.2. Network Interfaces Sub-Collection
15.4.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.16. 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.17. 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.18. 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.19. 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.4.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.20. 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.4.3. 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.8. Elements for virtual machine CD-ROMs
| Element | Type | Description | Properties |
|---|---|---|---|
file id= | string/filename | A reference to an ISO image. |
Example 15.21. 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>
POST request with a file id element to add a new CD-ROM resource.
Example 15.22. Adding a new CD-ROM file
POST /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.23. 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.24. Changing a CD-ROM file during a current session
POST /api/vms/cdc0b102-fbfe-444a-b9cb-57d2af94f401/cdroms/00000000-0000-0000-0000-000000000000;current HTTP/1.1
Accept: application/xml
Content-type: application/xml
<cdrom>
<file id="fedora-15-x86_64-dvd.iso"/>
</cdrom>
Note
15.4.4. Snapshots Sub-Collection
15.4.4.1. Snapshots Sub-Collection
rel="snapshot" sub-collection that behaves similar to other collections.
snapshot element that contains the following sub-elements:
Table 15.9. 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. |
|
date | xsd:dateTime format: YYYY-MM-DDThh:mm:ss | The date and time at which this snapshot was created. |
|
link rel="prev" | relationship | A link to the previous snapshot of this virtual machine. |
|
description element is specified.
Note
PUT.
Example 15.25. An XML representation of a virtual machine snapshot
<snapshot id="f5288fd5-5178-4b7d-b87c-c01a40e40168"
href="/api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/snapshots/
f5288fd5-5178-4b7d-b87c-c01a40e40168">
<description>Virtual Machine 1 - Snapshot A</description>
<actions>
<link rel="restore"
href="/api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/snapshots/
f5288fd5-5178-4b7d-b87c-c01a40e40168/restore"/>
</actions>
<link rel="prev"
href="/api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/snapshots/
ce411b3e-e4e0-4482-8b2f-d1ed998b9130"/>
<vm id="5114bb3e-a4e6-44b2-b783-b3eea7d84720"
href="/api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720"/>
<date>2010-08-16T14:24:29</date>
</snapshot>
rel="restore" action link in the snapshot representation.
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/snapshots/f5288fd5-5178-4b7d-b87c-c01a40e40168/restore HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
Note
15.4.4.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.26. Clone Virtual Machine from Snapshot
POST /api/vms HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vm>
...
<snapshots>
<snapshot id="id="3f68ee63-0016-4f8c-9b8a-11d9f28f7c9e"/>
</snapshots>
...
</vm>
15.4.5. Statistics Sub-Collection
statistics sub-collection for virtual machine-specific statistics. Each statistic contains the following elements:
Table 15.10. 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.11. 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.27. 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.5. Actions
15.5.1. Start Virtual Machine Action
Example 15.28. Action to start a virtual machine
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/start HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
vm element to be provided as a parameter. If a vm element is provided, the virtual machine uses the values from the provided element and overrides system settings at start time. These settings persist until a user stops the virtual machine. Examples of these elements include os, domain, placement_policy, cdroms, stateless and display type.
Example 15.29. Action to start a virtual machine with overridden parameters
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/start HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<pause>true</pause>
<vm>
<stateless>true</stateless>
<display>
<type>spice</type>
</display>
<os>
<boot dev="cdrom"/>
</os>
<cdroms>
<cdrom>
<file id="windows-xp.iso"/>
</cdrom>
</cdroms>
<domain>
<name>domain.example.com</name>
<user>
<user_name>domain_user</user_name>
<password>domain_password</password>
</user>
</domain>
<placement_policy>
<host id="02447ac6-bcba-448d-ba2b-f0f453544ed2"/>
</placement_policy>
</vm>
</action>
Note
domain element when overriding parameters on boot with the start action. The domain element determines the domain that the Windows virtual machine joins. If the domain does not exist in the domains collection, this element requires additional user authentication details, including a user_name and password. If the domain exists in the domains collection, the action requires no additional user authentication details.
15.5.2. Stop Virtual Machine Action
Example 15.30. Action to stop a virtual machine
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/stop HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
15.5.3. Shutdown Virtual Machine Action
Example 15.31. Action to send a shutdown request to a virtual machine
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/shutdown HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
15.5.4. Suspend Virtual Machine Action
Example 15.32. Action to save virtual machine state and suspend the machine
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/suspend HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
15.5.5. Detach Virtual Machine from Pool Action
Example 15.33. Action to detach a virtual machine
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/detach HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
15.5.6. Migrate Virtual Machine Action
host element is an optional element as Red Hat Enterprise Virtualization Manager automatically selects a default host for migration. If an API user requires a specific host, the user can specify the host with either an id or name parameter.
Example 15.34. Action to migrate a virtual machine to another host
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/migrate HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<host id="2ab5e1da-b726-4274-bbf7-0a42b16a0fc3"/>
</action>
15.5.7. Cancel Virtual Machine Migration Action
Example 15.35. Action to cancel migration of a virtual machine to another host
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/cancelmigration HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
15.5.8. Export Virtual Machine Action
export storage domain. A destination storage domain must be specified with a storage_domain reference.
exclusive parameter to true to change this behavior and overwrite any existing virtual machine.
discard_snapshots parameter to true.
Example 15.36. Action to export a virtual machine to an export storage domain
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/export HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<storage_domain>
<name>export1</name>
</storage_domain>
<exclusive>true</exclusive>
<discard_snapshots>true</discard_snapshots>
</action>
15.5.9. Virtual Machine Ticket Action
action optionally includes a ticket representation containing a value (if the token string needs to take on a particular form) and/or an expiry time in minutes. In any case, the response specifies the actual ticket value and expiry used.
Example 15.37. Action to generate authentication token for a virtual machine
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/ticket HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<ticket>
<expiry>120</expiry>
</ticket>
</action>
200 OK
Content-Type: application/xml
<action id="94e07552-14ba-4c27-8ce6-2cc75190d3ef"
href="/api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/ticket/
94e07552-14ba-4c27-8ce6-2cc75190d3ef">
<status>
<state>complete</state>
</status>
<ticket>
<value>5c7CSzK8Sw41</value>
<expiry>120</expiry>
</ticket>
<link rel="parent"
href="/api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720"/>
<link rel="replay"
href="/api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/ticket"/>
</action>
15.5.10. Force Remove Virtual Machine Action
force action. This action requires a DELETE method. The request body contains an action representation with the force parameter set to true. The request also requires an additional Content-type: application/xml header to process the XML representation in the body.
Example 15.38. Force remove action on a virtual machine
DELETE /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<force>true</force>
</action>
Chapter 16. Floating Disks
16.1. Floating Disk Elements
disks collection provides information about all disks in a Red Hat Enterprise Virtualization environment. A user attaches and detaches disks from any virtual machine and floats them between virtual machines. An API user accesses this information through the rel="disks" link obtained from the entry point URI.
disks resource representation.
Table 16.1. Elements for floating disks
| Element | Type | Description | Properties |
|---|---|---|---|
link rel="statistics" | relationship | A link to the statistics sub-collection for a virtual machine's disk statistics. |
|
image_id | GUID | 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. |
|
size | integer | Size of the disk in bytes. |
|
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. | |
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. | |
quota id= | GUID | Sets a quota for the disk. | |
lunStorage | complex | A reference to a direct LUN mapping for storage usage. Requires a storage element that contains iSCSI or FCP device details. |
|
active | Boolean | Defines if the disk is connected to the virtual machine. |
|
Important
alias search parameter instead of name.
16.2. XML Representation of a Floating Disk
Example 16.1. An XML representation of a disk device
<disk id="ed7feafe-9aaf-458c-809a-ed789cdbd5b4"
href="/api/disks/ed7feafe-9aaf-458c-809a-ed789cdbd5b4">
<link rel="statistics"
href="/api/disks/ed7feafe-9aaf-458c-809a-ed789cdbd5b4/statistics"/>
<storage_domains>
<storage_domain id="fabe0451-701f-4235-8f7e-e20e458819ed"/>
</storage_domains>
<size>10737418240</size>
<type>system</type>
<status>
<state>ok</state>
</status>
<interface>virtio</interface>
<format>raw</format>
<bootable>true</bootable>
<shareable>true</shareable>
<lunStorage>
<storage>
<logical_unit id="lun1">
...
</logical_unit>
<storage>
</lunStorage>
</disk>
16.3. Methods
16.3.1. Creating a Floating Disk
size and storage_domains elements.
Example 16.2. Creating a new a floating disk device
POST /api/disks HTTP/1.1
Accept: application/xml
Content-type: application/xml
<disk>
<storage_domains>
<storage_domain id="fabe0451-701f-4235-8f7e-e20e458819ed"/>
</storage_domains>
<size>8589934592</size>
<type>system</type>
<interface>virtio</interface>
<format>cow</format>
</disk>
16.4. Sub-Collections
16.4.1. Statistics Sub-Collection
statistics sub-collection for disk-specific statistics. Each statistic contains the following elements:
Table 16.2. 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 16.3. 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 16.3. An XML representation of a virtual machine's statistics sub-collection
<statistics>
<statistic id="33b9212b-f9cb-3fd0-b364-248fb61e1272"
href="/api/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/disks/f28ec14c-fc85-43e1-818d-96b49d50e27b"/>
</statistic>
...
</statistics>
Note
statistics sub-collection is read-only.
Chapter 17. Templates
17.1. Virtual Machine Template Elements
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.
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. |
17.2. XML Representation of a Virtual Machine Template
Example 17.1. An XML representation of a virtual machine template
<template id="00000000-0000-0000-0000-000000000000"
href="/api/templates/00000000-0000-0000-0000-000000000000">
<name>Blank</name>
<description>Blank template</description>
<actions>
<link rel="export"
href="/api/templates/00000000-0000-0000-0000-000000000000/export"/>
</actions>
<link rel="disks"
href="/api/templates/00000000-0000-0000-0000-000000000000/disks"/>
<link rel="nics"
href="/api/templates/00000000-0000-0000-0000-000000000000/nics"/>
<link rel="cdroms"
href="/api/templates/00000000-0000-0000-0000-000000000000/cdroms"/>
<link rel="permissions"
href="/api/templates/00000000-0000-0000-0000-000000000000/permissions"/>
<type>server</type>
<status>
<state>ok</state>
</status>
<memory>536870912</memory>
<cpu>
<topology cores="1" sockets="1"/>
</cpu>
<os>
<boot dev="hd"/>
<kernel/>
<initrd/>
<cmdline/>
</os>
<cluster id="99408929-82cf-4dc7-a532-9d998063fa95"
href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95"/>
<creation_time>2010-08-16T14:24:29</creation_time>
<origin>rhev</origin>
<highly_available>
<enabled>true</enabled>
<priority>100</priority>
</highly_available>
<display>
<type>vnc</type>
<port>5910</port>
<monitors>1</monitors>
</display>
<stateless>false</stateless>
<usb>
<enabled>true</enabled>
</usb>
</template>
17.3. Methods
17.3.1. Creating a New Template
name and vm elements. Identify the vm with the id attribute or name element.
Example 17.2. Creating a template from a virtual machine
POST /api/templates HTTP/1.1
Accept: application/xml
Content-type: application/xml
<template>
<name>template1</name>
<vm id="082c794b-771f-452f-83c9-b2b5a19c0399"/>
</template>
17.3.2. Updating a Template
name, description, type, memory, cpu topology, os, high_availability, display, stateless, usb and timezone elements are updatable post-creation.
Example 17.3. Updating a virtual machine template to contain 1 GB of memory
PUT /api/templates/a03dca95-98cb-430d-89dc-b11482543748 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<template>
<memory>1073741824</memory>
</template>
17.4. Actions
17.4.1. Export Template Action
templates collection contains an export action.
Export storage domain. A destination storage domain is specified with a storage_domain reference.
exclusive parameter to true to change this behavior and overwrite any existing virtual machine template.
Example 17.5. Action to export a template to an export storage domain
POST /api/templates/a03dca95-98cb-430d-89dc-b11482543748/export HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
<storage_domain id="fabe0451-701f-4235-8f7e-e20e458819ed"/>
<exclusive>true<exclusive/>
</action>
Chapter 18. Virtual Machine Pools
18.1. Virtual Machine Pool Elements
vmpools collection provides information about the virtual machine pools in a Red Hat Enterprise Virtualization environment. An API user accesses this information through the rel="vmpools" link obtained from the entry point URI.
Table 18.1. Virtual machine pool elements
| Element | Type | Description | Properties |
|---|---|---|---|
name | string | A user-supplied, human readable name for the pool. The name is unique across all pool resources. |
|
description | string | A user-supplied, human readable description of the virtual machine pool. | |
link rel="permissions" | relationship | A link to the permissions sub-collection for virtual machine pool permissions. | |
size | integer | The number of virtual machines in the pool. | |
cluster id= | GUID | A reference to the cluster resource in which virtual machines in this pool run. |
|
template id= | GUID | A reference to the template resource on which virtual machines in this pool are based. |
|
prestarted_vms | integer | The number of prestarted virtual machines in the virtual machine pool. | |
max_user_vms | integer | The maximum number of virtual machines any one user can take from the virtual machine pool. |
Important
18.2. XML Representation of a Virtual Machine Pool
Example 18.1. An XML representation of a virtual machine pool
<vmpool href="/api/vmpools/2d2d5e26-1b6e-11e1-8cda-001320f76e8e">
id="2d2d5e26-1b6e-11e1-8cda-001320f76e8e"
<actions>
<link href="/api/vmpools/2d2d5e26-1b6e-11e1-8cda-001320f76e8e/allocatevm"
rel="allocatevm"/>
</actions>
<name>VMPool1</name>
<description>Virtual Machine Pool 1</description>
<size>2</size>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95"/>
id="99408929-82cf-4dc7-a532-9d998063fa95"
<template href="/api/templates/00000000-0000-0000-0000-000000000000"/>
id="00000000-0000-0000-0000-000000000000"
<prestarted_vms>0</prestarted_vms>
<max_user_vms>1</max_user_vms>
</vmpool>18.3. Methods
18.3.1. Creating a New Virtual Machine Pool
name, cluster and template elements. Identify the cluster and template with the id attribute or name element.
Example 18.2. Creating a virtual machine pool
POST /api/vmpools HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vmpool>
<name>VM Pool A</name>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95"/>
id="99408929-82cf-4dc7-a532-9d998063fa95"
<template href="/api/templates/00000000-0000-0000-0000-000000000000"/>
id="00000000-0000-0000-0000-000000000000"
</vmpool>18.3.2. Updating a Virtual Machine Pool
name, description, size, prestarted_vms and max_user_vms can be updated after the virtual machine has been created.
Example 18.3. Updating a virtual machine pool
PUT /api/vmpools/2d2d5e26-1b6e-11e1-8cda-001320f76e8e HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vmpool>
<name>VM Pool B</name>
<description>Virtual Machine Pool B</description>
<size>3</size>
<prestarted_vms>1</size>
<max_user_vms>2</size>
</vmpool>18.4. Actions
18.4.1. Allocate Virtual Machine Action
Example 18.5. Action to allocate a virtual machine from a virtual machine pool
POST /api/vmpools/2d2d5e26-1b6e-11e1-8cda-001320f76e8e/allocatevm HTTP/1.1 Accept: application/xml Content-type: application/xml <action/>
Chapter 19. Domains
19.1. Domain Elements
domains collection. Domain information is referenced with the rel="domains" link.
Table 19.1. Domain elements
| Element | Type | Description |
|---|---|---|
name | string | The domain name. |
link rel="users" | relationship | A link to the sub-collection for users associated with this domain. |
link rel="groups" | relationship | A link to the sub-collection for groups associated with this domain. |
users and groups sub-collections also accept search queries.
Note
domains collection and its sub-collections are read-only.
19.2. XML Representation of a Domain Resource
Example 19.1. An XML representation of a domain resource
<domain id="77696e32-6b38-7268-6576-2e656e676c61"
href="/api/domains/77696e32-6b38-7268-6576-2e656e676c61">
<name>domain.example.com</name>
<link rel="users"
href="/api/domains/77696e32-6b38-7268-6576-2e656e676c61/users"/>
<link rel="groups"
href="/api/domains/77696e32-6b38-7268-6576-2e656e676c61/groups"/>
<link rel="users/search"
href="/api/domains/77696e32-6b38-7268-6576-2e656e676c61/
users?search={query}"/>
<link rel="groups/search"
href="/api/domains/77696e32-6b38-7268-6576-2e656e676c61/
groups?search={query}"/>
</domain>
19.3. Sub-Collections
19.3.1. Domain Users Sub-Collection
users sub-collection contains all users in the directory service. This information is used to add new users to the Red Hat Enterprise Virtualization environment.
Table 19.2. Domain user elements
| Element | Type | Description |
|---|---|---|
name | string | The name of the user. |
last_name | string | The surname of the user. |
user_name | string | The user name from directory service. |
domain id | GUID | The containing directory service domain. |
groups | complex | A list of directory service groups for this user. |
Example 19.2. An XML representation of a user in the users sub-collection
<user id="225f15cd-e891-434d-8262-a66808fcb9b1"
href="/api/domains/77696e32-6b38-7268-6576-2e656e676c61/users/
d3b4e7be-5f57-4dac-b937-21e1771a501f">
<name>RHEV-M Admin</name>
<user_name>rhevmadmin@domain.example.com</user_name>
<domain id="77696e32-6b38-7268-6576-2e656e676c61"
href="/api/domains/77696e32-6b38-7268-6576-2e656e676c61"/>
<groups>
<group>
<name>domain.example.com/Users/Enterprise Admins</name>
</group>
<group>
<name>domain.example.com/Users/Domain Admins</name>
</group>
...
</groups>
</user>
19.3.2. Domain Groups Sub-Collection
groups sub-collection contains all groups in the directory service. A domain group resource contains a set of elements.
Table 19.3. Domain group elements
| Element | Type | Description |
|---|---|---|
name | string | The name of the group. |
domain id | GUID | The containing directory service domain. |
Example 19.3. An XML representation of a group in the groups sub-collection
<group id="85bf8d97-273c-4a5c-b801-b17d58330dab"
href="/api/domains/77696e32-6b38-7268-6576-2e656e676c61/groups/
85bf8d97-273c-4a5c-b801-b17d58330dab">
<name>example.com/Users/Enterprise Admins</name>
<domain id="77696e32-6b38-7268-6576-2e656e676c61"
href="/api/domains/77696e32-6b38-7268-6576-2e656e676c61"/>
</group>
Chapter 20. Groups
20.1. Imported Group Elements
groups collection contains imported groups from directory services. A group resource contains a set of elements.
Table 20.1. Imported group elements
| Element | Type | Description |
|---|---|---|
link rel="tags" | relationship | A link to the tags sub-collection for tags attached to this group. |
link rel="permissions" | relationship | A link to the permissions sub-collection for permissions attached to this group. |
link rel="roles" | relationship | A link to the roles sub-collection for roles attached to this group. |
20.2. XML Representation of a Group Resource
Example 20.1. An XML representation of a group resource
<group id="85bf8d97-273c-4a5c-b801-b17d58330dab"
href="/api/groups/85bf8d97-273c-4a5c-b801-b17d58330dab">
<name>Everyone</name>
<link rel="tags"
href="/api/groups/85bf8d97-273c-4a5c-b801-b17d58330dab/tags"/>
<link rel="permissions"
href="/api/groups/85bf8d97-273c-4a5c-b801-b17d58330dab/permissions"/>
<link rel="roles"
href="/api/groups/85bf8d97-273c-4a5c-b801-b17d58330dab/roles"/>
</group>
20.3. Adding a Group from a Directory Service
POST request to the groups collection.
Example 20.2. Adding a group from a directory service
POST /api/group HTTP/1.1
Content-Type: application/xml
Accept: application/xml
<group>
<name>www.example.com/accounts/groups/mygroup</name>
</group>
Chapter 21. Roles
21.1. Role Elements
rel="roles" link obtained from the entry point URI provides access to a static set of system roles. Each individual role element contains the following:
Table 21.1. Role elements
| Element | Type | Description | Properties |
|---|---|---|---|
link="permits" | relationship | A link to the permits sub-collection for role permits. |
|
mutable | Boolean: true or false | Defines the ability to update or delete the role. Roles with mutable set to false are roles built into the Red Hat Enterprise Virtualization environment. |
|
administrative | Boolean: true or false | Defines the role as administrative-only. |
21.2. XML Representation of the Roles Collection
Example 21.1. An XML representation of the roles collection
<roles>
<role id="00000000-0000-0000-0000-000000000001"
href="/api/roles/00000000-0000-0000-0000-000000000001">
<name>SuperUser</name>
<description>Roles management administrator</description>
<link rel="permits"
href="/api/roles/00000000-0000-0000-0000-000000000001/permits"/>
<mutable>false</mutable>
<administrative>true</administrative>
</role>
<role id="00000000-0000-0000-0001-000000000001"
href="/api/roles/00000000-0000-0000-0001-000000000001">
<name>RHEVMUser</name>
<description>RHEVM user</description>
<link rel="permits"
href="/api/roles/00000000-0000-0000-0001-000000000001/permits"/>
<mutable>false</mutable>
<administrative>false</administrative>
</role>
<role id="00000000-0000-0000-0001-000000000002"
href="/api/roles/00000000-0000-0000-0001-000000000002">
<name>RHEVMPowerUser</name>
<description>RHEVM power user</description>
<link rel="permits"
href="/api/roles/00000000-0000-0000-0001-000000000002/permits"/>
<mutable>false</mutable>
<administrative>false</administrative>
</role>
</roles>
21.3. Methods
21.3.1. Creating a Role
name, administrative and a list of initial permits.
Example 21.2. Creating a role
POST /api/roles HTTP/1.1
Accept: application/xml
Content-type: application/xml
<role>
<name>Finance Role</name>
<administrative>true</administrative>
<permits>
<permit id="1"/>
</permits>
</role>
21.3.2. Updating a Role
name, description and administrative elements are updatable post-creation.
Example 21.3. Updating a role
PUT /api/roles/8de42ad7-f307-408b-80e8-9d28b85adfd7 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<role>
<name>Engineering Role</name>
<description>Standard users in the Engineering Role</description>
<administrative>false</administrative>
</role>
21.4. Roles Permits Sub-Collection
21.4.1. Roles Permits Sub-Collection
permits, which the API lists in capabilities. For more information on access to permits.
permits are listed as a sub-collection:
Example 21.5. Listing a role's permits
GET /api/roles/b67dfbe2-0dbc-41e4-86d3-a2fbef02cfa9/permits HTTP/1.1
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<permits>
<permit id="1"
href="/api/roles/b67dfbe2-0dbc-41e4-86d3-a2fbef02cfa9/permits/1">
<name>create_vm</name>
<administrative>false</administrative>
<role id="b67dfbe2-0dbc-41e4-86d3-a2fbef02cfa9"
href="/api/roles/b67dfbe2-0dbc-41e4-86d3-a2fbef02cfa9"/>
</permit>
...
</permits>
21.4.2. Assign a Permit to a Role
permit to a role with a POST request to the permits sub-collection. Use either an id attribute or a name element to specify the permit to assign.
Example 21.6. Assign a permit to a role
POST /api/roles/b67dfbe2-0dbc-41e4-86d3-a2fbef02cfa9/permits HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<permit id="1"/>
HTTP/1.1 201 Created
Content-Type: application/xml
<permits>
<permit id="1"
href="/api/roles/b67dfbe2-0dbc-41e4-86d3-a2fbef02cfa9/permits/1">
<name>create_vm</name>
<administrative>false</administrative>
<role id="b67dfbe2-0dbc-41e4-86d3-a2fbef02cfa9"
href="/api/roles/b67dfbe2-0dbc-41e4-86d3-a2fbef02cfa9"/>
</permit>
</permits>
Chapter 22. Users
22.1. User Elements
rel="users" link. Individual user elements contain the following:
Table 22.1. User elements
| Element | Type | Description | Properties |
|---|---|---|---|
user_name | string | The user principal name (UPN). The UPN is used as a more convenient identifier when adding a new user. |
|
link rel="tags" | relationship | A link to the tags sub-collection for user resources. | |
link rel="roles" | relationship | A link to the roles sub-collection for user resources. | |
name | string | A free-text name for the user. |
|
domain | string | The containing directory service domain. |
|
groups | complex | A list of directory service groups for this user. |
|
22.2. XML representation of a User Resource
Example 22.1. An XML representation of a user resource
GET /api/users HTTP/1.1
Accept: application/xml
<user id="225f15cd-e891-434d-8262-a66808fcb9b1"
href="/api/users/225f15cd-e891-434d-8262-a66808fcb9b1">
<name>RHEV-M Admin</name>
<actions/>
<link rel="roles"
href="/api/users/225f15cd-e891-434d-8262-a66808fcb9b1/roles"/>
<link rel="tags"
href="/api/users/225f15cd-e891-434d-8262-a66808fcb9b1/tags"/>
<domain>domain.example.com</domain>
<logged_in>false</logged_in>
<user_name>rhevmadmin@domain.example.com</user_name>
<groups>
<group>Group Policy Creator Owners@domain.example.com/Users</group>
<group>Domain Admins@domain.example.com/Users</group>
<group>Enterprise Admins@domain.example.com/Users</group>
<group>Schema Admins@domain.example.com/Users</group>
<group>Administrators@domain.example.com/Builtin</group>
</groups>
</user>
22.3. Methods
22.3.1. Adding a User
POST request to the users collection. The client-provided new user representation includes an embedded roles list with at least one initial role to assign to the user. For example, the following request assigns two initial roles to the user joe@domain.example.com:
Example 22.2. Adding a user from directory service and assigning two roles
POST /api/users HTTP/1.1
Content-Type: application/xml
Accept: application/xml
<user>
<user_name>joe@domain.example.com</user_name>
<roles>
<role>
<name>RHEVMPowerUser</name>
</role>
<role id="00000000-0000-0000-0001-000000000003"/>
</roles>
</user>
Note
domains collection prior to creation of the user.
22.3.2. Adding Roles to a User
POST or DELETE requests to the roles sub-collection of an individual user. The example below illustrates how the API adds the RHEVMVDIUser role to the role assignments for a particular user.
Note
user element is only used for the initial creation. All interactions post-creation with the user's role assignments go through the roles sub-collection.
Example 22.3. Adding roles to a user
POST /api/users/225f15cd-e891-434d-8262-a66808fcb9b1/roles HTTP/1.1
Content-Type: application/xml
Accept: application/xml
<role>
<name>RHEVMVDIUser</name>
</role>
Chapter 23. Tags
23.1. Tag Elements
tags collection provides information about tags in a Red Hat Enterprise Virtualization environment. An API user accesses this information through the rel="tags" link obtained from the entry point URI.
Table 23.1. Tag elements
| Element | Type | Description | Properties |
|---|---|---|---|
host | GUID | A reference to the host which the tag is attached. |
|
user | GUID | A reference to the user which the tag is attached. |
|
vm | GUID | A reference to the VM which the tag is attached. |
|
parent | complex | A reference to the VM which the tag is attached. |
23.2. XML Representation of a Tag Resource
Example 23.1. An XML representation of a tag resource
<tag id="f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e"
href="/api/tags/f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e">
<name>Finance</name>
<description>Resources for the Finance department</description>
<parent>
<tag id="-1" href="/api/tags/-1"/>
</parent>
</tag>
23.3. Associating Tags
23.3.1. Associating Tags With a Host, User or VM
link rel="tags" from a host, user or vms represents the set of tags associated with the entity.
tag representations also contain a host id, user id or vm id reference to the entity in question.
POSTing a tag reference (identifying the tag either by its id or name) to the collection.
Example 23.2. Associating a tag with a virtual machine
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/tags HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<tag>
<name>Finance</name>
</tag>
HTTP/1.1 201 Created
Content-Type: application/xml
<tag id="f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e"
href="/api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/tags/
f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e">
<name>Finance</name>
<description>Resources for the Finance department</description>
<vm id="5114bb3e-a4e6-44b2-b783-b3eea7d84720"
href="/api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720"/>
</tag>
23.3.2. Removing a Tag
DELETE request to the appropriate element in the collection.
Example 23.3. Removing a tag from a virtual machine
DELETE /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/tags/f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e HTTP/1.1 HTTP/1.1 204 No Content
23.3.3. Querying a Collection for Tagged Resources
collection/search URI template for the appropriate collection should be used to search for entities matching tag=MyTag.
Example 23.4. Querying a collection for tagged resources
GET /api/vms?search=tag%3DFinance HTTP/1.1
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<vms>
<vm id="5114bb3e-a4e6-44b2-b783-b3eea7d84720"
href="/api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720">
...
</vm>
...
</vms>
23.4. Parent Tags
23.4.1. Parent Tags
parent element to a tag to create a hierarchical link to a parent tag. The tags are presented as a flat collection, which descends from the root tag, with tag representations containing a link element to a parent tag
Note
root tag is a special pseudo-tag assumed as the default parent tag if no parent tag is specified. The root tag cannot be deleted nor assigned a parent tag.
Example 23.5. Tag Hierarchy
<tags>
<tag id="-1" href="/api/tags/-1">
<name>root</name>
<description>root</description>
<parent>
<tag id="-1" href="/api/tags/-1"/>
</parent>
</tag>
<tag id="f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e"
href="/api/tags/f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e">
<name>Finance</name>
<description>Resources for the Finance department</description>
<parent>
<tag id="-1" href="/api/tags/-1"/>
</parent>
</tag>
<tag id="ac18dabf-23e5-12be-a383-a38b165ca7bd"
href="/api/tags/ac18dabf-23e5-12be-a383-a38b165ca7bd">
<name>Billing</name>
<description>Billing Resources</description>
<parent>
<tag id="f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e"
href="/api/tags/f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e"/>
</parent>
</tag>
</tags>
root (id: -1)
- Finance (id: f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e)
- Billing (id: ac18dabf-23e5-12be-a383-a38b165ca7bd)
23.4.2. Setting a Parent Tag
POSTing a new tag with a parent element creates an association with a parent tag, using either the id attribute or the name element to reference the parent tag
Example 23.6. Setting an association with a parent tag with the id attribute
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/tags HTTP/1.1
Accept: application/xml
Content-Type: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<tag>
<name>Billing</name>
<description>Billing Resources</description>
<parent>
<tag id="f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e"/>
</parent>
</tag>
Example 23.7. Setting an association with a parent tag with the name element
POST /api/vms/5114bb3e-a4e6-44b2-b783-b3eea7d84720/tags HTTP/1.1
Accept: application/xml
Content-Type: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
<tag>
<name>Billing</name>
<description>Billing Resources</description>
<parent>
<tag>
<name>Finance</name>
</tag>
</parent>
</tag>
23.4.3. Changing a Parent Tag
PUT request:
Example 23.8. Changing the parent tag
PUT /api/tags/ac18dabf-23e5-12be-a383-a38b165ca7bd HTTP/1.1
Accept: application/xml
Content-Type: application/xml
<tag>
<parent>
<tag id="f436ebfc-67f2-41bd-8ec6-902b6f7dcb5e"/>
</parent>
</tag>
Chapter 24. Events
24.1. Event Elements
rel="events" link obtained from the entry point URI accesses the events collection and lists system events from Red Hat Enterprise Virtualization Manager.
Table 24.1. Event elements
| Element | Type | Description |
|---|---|---|
description | string | A description of the system event |
code | integer | The integer event code. |
severity | One of normal, warning, error or alert | The level of severity for the event. |
time | xsd:dateTime format: YYYY-MM-DDThh:mm:ss | The timestamp indicating when the event happened. |
user id | GUID | The identification code for the user who triggered the event. |
Note
events collection is read-only.
24.2. XML Representation of the Events Collection
Example 24.1. An XML representation of the events collection
<events>
<event id="537" href="/api/events/537">
<description>User vdcadmin logged in.</description>
<code>30</code>
<severity>normal</severity>
<time>2011-01-12T10:48:27.827+02:00</time>
<user id="9b9002d1-ec33-4083-8a7b-31f6b8931648"
href="/api/users/9b9002d1-ec33-4083-8a7b-31f6b8931648"/>
</event>
...
</events>
24.3. XML Representation of a Virtual Machine Creation Event
user, an event representation also contains a set of XML element relationships to resources relevant to the event.
Example 24.2. An XML representation of a virtual machine creation event
<event id="635" href="/api/events/635">
<description>VM bar was created by rhevadmin.</description>
<code>34</code>
<severity>normal</severity>
<time>2011-07-11T16:32:03.172+02:00</time>
<user id="4621b611-43eb-4d2b-ae5f-1180850268c4"
href="/api/users/4621b611-43eb-4d2b-ae5f-1180850268c4"/>
<vm id="9b22d423-e16b-4dd8-9c06-c8e9358fbc66"
href="/api/vms/9b22d423-e16b-4dd8-9c06-c8e9358fbc66"/>
<storage_domain id="a8a0e93d-c570-45ab-9cd6-3c68ab31221f"
href="/api/storagedomains/a8a0e93d-c570-45ab-9cd6-3c68ab31221f"/>
</event>
24.4. Searching Events
events collection provides search queries similar to other resource collections. An additional feature when searching the events collection is the ability to search from a certain event. This queries all of events since a specified event.
from parameter added before the search query. This from argument references an event id code.
Example 24.3. Searching from an event
GET /api/events;from=1012?search=type%3D30 HTTP/1.1 Accept: application/xml
type set to 30 since id="1012"
HTTP/1.1 200 OK
Content-Type: application/xml
<events>
<event id="1018" href="/api/events/1018">
<description>User admin logged in.</description>
<code>30</code>
<severity>normal</severity>
<time>2011-07-11T14:03:22.485+10:00</time>
<user id="80b71bae-98a1-11e0-8f20-525400866c73"
href="/api/users/80b71bae-98a1-11e0-8f20-525400866c73"/>
</event>
<event id="1016" href="/api/events/1016">
<description>User admin logged in.</description>
<code>30</code>
<severity>normal</severity>
<time>2011-07-11T14:03:07.236+10:00</time>
<user id="80b71bae-98a1-11e0-8f20-525400866c73"
href="/api/users/80b71bae-98a1-11e0-8f20-525400866c73"/>
</event>
<event id="1014" href="/api/events/1014">
<description>User admin logged in.</description>
<code>30</code>
<severity>normal</severity>
<time>2011-07-11T14:02:16.009+10:00</time>
<user id="80b71bae-98a1-11e0-8f20-525400866c73"
href="/api/users/80b71bae-98a1-11e0-8f20-525400866c73"/>
</event>
</events>
Important
from argument previously used the following format:
/api/events?search=type%3D30&from=1012
24.5. Paginating Events
page command in a search query.
page value in combination with the sortby clause:
sortby time asc page 1
sortby clause defines the base element to order of the results and whether the results are ascending or descending. For search queries of events, set the base element to time and the order to ascending (asc) so the API displays all events from the creation of your virtualization environment.
page condition defines the page number. One page equals the default number of events to list. Pagination begins at page 1. To view more pages, increase the page value:
sortby time asc page 2
sortby time asc page 3
sortby time asc page 4
Example 24.4. Paginating events
event resources. The URL-encoded request is:
GET /api/events?search=sortby%20time%20asc%20page%201 HTTP/1.1 Accept: application/xml
page value to view the next page of results.
GET /api/events?search=sortby%20time%20asc%20page%202 HTTP/1.1 Accept: application/xml
from argument to set the starting id.
GET /api/events?search=sortby%20time%20asc%20page%202&from=30 HTTP/1.1 Accept: application/xml
Part III. Python Sofware Development Kit
Table of Contents
- 25. Software Development Kit Overview
- 26. Using the Software Development Kit
- 26.1. Connecting to the API using Python
- 26.2. Resources and Collections
- 26.3. Retrieving Resources from a Collection
- 26.4. Retrieving a Specific Resource from a Collection
- 26.5. Retrieving a List of Resources from a Collection
- 26.6. Adding a Resource to a Collection
- 26.7. Updating a Resource in a Collection
- 26.8. Removing a Resource from a Collection
- 26.9. Handling Errors
- 27. Python Reference Documentation
Chapter 25. Software Development Kit Overview
25.1. Introduction to the Red Hat Enterprise Virtualization Software Development Kit
25.2. Software Development Kit Prerequisites
- A system with Red Hat Enterprise Linux 6.3, or later, installed. Both the Server and Workstation variants are supported.
- A subscription to Red Hat Enterprise Virtualization entitlements.
Important
25.3. Installing the Software Development Kit
Procedure 25.1. Installing the Python SDK
- Ensure that your system has the required entitlements:
- When using certificate-based Red Hat Network you must subscribe to the
Red Hat Enterprise Virtualizationentitlement to install the rhevm-sdk package. - When using Red Hat Network classic you must ensure subscribe to the
Red Hat Enterprise Virtualization Managerchannel to install the rhevm-sdk package. Refer to the Red Hat Enterprise Virtualization Manager Release Notes for specific channel names current to your system.
- Ensure that you are logged in as the
rootuser. - Install the rhevm-sdk package using the
yumcommand.# yum install rhevm-sdk
Chapter 26. Using the Software Development Kit
- 26.1. Connecting to the API using Python
- 26.2. Resources and Collections
- 26.3. Retrieving Resources from a Collection
- 26.4. Retrieving a Specific Resource from a Collection
- 26.5. Retrieving a List of Resources from a Collection
- 26.6. Adding a Resource to a Collection
- 26.7. Updating a Resource in a Collection
- 26.8. Removing a Resource from a Collection
- 26.9. Handling Errors
26.1. Connecting to the API using Python
API class from the ovirtsdk.api module. To be able to do this it is necessary to first import the class at the start of the script:
from ovirtsdk.api import API
API class takes a number of arguments. Supported arguments are:
- url
- Specifies the URL of the Manager to connect to, including the
/apipath. This parameter is mandatory. - username
- Specifies the user name to connect using, in User Principal Name (UPN) format. This parameter is mandatory.
- password
- Specifies the password for the user name provided by the
usernameparameter. This parameter is mandatory. - key_file
- Specifies a PEM formatted key file containing the private key associated with the certificate specified by
cert_file. This parameter is optional. - cert_file
- Specifies a PEM formatted client certificate to be used for establishing the identity of the client on the server. This parameter is optional.
- ca_file
- Specifies the certificate file of the certificate authority for the server. This parameter is mandatory unless the
insecureparameter is set toTrue. - port
- Specifies the port to connect using, where it has not been provided as component of the
urlparameter. This parameter is optional. - timeout
- Specifies the amount of time in seconds that is allowed to pass before a request is to be considered as having timed out. This parameter is optional.
- persistent_auth
- Specifies whether persistent authentication is enabled for this connection. Valid values are
TrueandFalse. This parameter is optional and defaults toFalse. - insecure
- Allows a connection via SSL without certificate authority. Valid values are
TrueandFalse. If theinsecureparameter is set toFalse- which is the default - then theca_filemust be supplied to secure the connection.This option should be used with caution, as it may allow man-in-the-middle (MITM) attackers to spoof the identity of the server. - filter
- Specifies whether or not user permission based filter is on or off. Valid values are
TrueandFalse. If thefilterparameter is set toFalse- which is the default - then the authentication credentials provided must be those of an administrative user. If thefilterparameter is set toTruethen any user can be used and the Manager will filter the actions available to the user based on their permissions. - debug
- Specifies whether debug mode is enabled for this connection. Valid values are
TrueandFalse. This parameter is optional.
API class, checks that the connection is working using the test() method, and disconnects using the disconnect() method.
from ovirtsdk.api import API api_instance = API ( url="https://rhevm31.demo.redhat.com", username="admin@internal", password="Redhat123", ca_file="/etc/pki/ovirt-engine/ca.pem") print "Connected successfully!" api_instance.disconnect()
API class refer to the PyDoc output for the ovirtsdk.api package.
26.2. Resources and Collections
- Collections
- A collection is a set of resources of the same type. The API provides both top-level collections and sub-collections. An example of a top-level collection is the
hostscollection which contains all virtualization hosts in the environment. An example of a sub-collection is thehost.nicscollection which contains resources for all network interface cards attached to a host resource.The interface for interacting with collections provides methods for adding resources (add), getting resources (get), and listing resources (list). - Resources
- A resource in a RESTful API is an object with a fixed interface that also contains a set of attributes that are relevant to the specific type of resource being represented. The interface for interacting with resources provides methods for updating (
update) and deleting (delete) resources. Additionally some resources support actions specific to the resource type. An example is theapprovemethod ofHostresources.
26.3. Retrieving Resources from a Collection
get and list methods.
- get
- Retrieves a single resource from the collection. The item to retrieve is determined based on the name provided as an argument. The
getmethod takes these arguments:name- The name of the resource to retrieve from the collection.id- The globally unique identifier (GUID) of the resource to retrieve from the collection.
- list
- Retrieves any number of resources from the collection. The items to retrieve are determined based on the criteria provided. The
listmethod takes these arguments:**kwargs- A dictionary of additional arguments allowing keyword based filtering.query- A query written in the same format as that used for searches executed using the Red Hat Enterprise Virtualization user interfaces.max- The maximum number of resources to retrieve.case_sensitive- Whether or not search terms are to be treated as case sensitive (TrueorFalse, the default isTrue).
26.4. Retrieving a Specific Resource from a Collection
get method.
Example 26.1. Retrieving a Specific Resource by Name
Default data center from the datacenters collection using the name parameter of the get method:
dc = api.datacenters.get("Default")
dc = api.datacenters.get(name="Default")
26.5. Retrieving a List of Resources from a Collection
list method.
Example 26.2. Retrieving a List of all Resources in a Collection
datacenters collection. The query parameter of the list method allows the use of engine based queries. In this way the SDK supports the use of queries in the same format as those executed in the Administration and User Portals. The query parameter is also the mechanism for providing pagination arguments while iterating through the collection.
dc_list = [] dc_page_index = 1 dc_page_current = api.datacenters.list(query="page %s" % dc_page_index) while(len(dc_page_current) != 0): dc_list = dc_list + dc_page_current dc_page_index = dc_page_index + 1 dc_page_current = api.datacenters.list(query="page %s" % dc_page_index)
datacenters collection is ultimately stored in the locally defined dc_list list variable.
Warning
list method of a collection is restricted to returning only as many elements as allowed by the SearchResultsLimit Red Hat Enterprise Virtualization Manager configuration key.
list are returned it is recommended that you paginate through the results as illustrated in this example.
max parameter of the list method to the maximum number of records that you wish to retrieve.
Example 26.3. Retrieving a List of Resources in a Collection Matching a Keyword Based Filter
datacenters collection that have a storage type of nfs. In this example both the query parameter and **kwargs parameter are supplied. The query is used for pagination in the same way as illustrated in the previous example. The **kwargs parameter is used to filter based on the storage type of the data center.
dc_list = [] dc_page_index = 1 dc_page_current = api.datacenters.list(query="page %s" % dc_page_index, **{"storage_type": "nfs"}) while(len(dc_page_current) != 0): dc_list = dc_list + dc_page_current dc_page_index = dc_page_index + 1 dc_page_current = api.datacenters.list(query="page %s" % dc_page_index, **{"storage_type": "nfs"})
datacenters collection with a storage type of nfs is ultimately stored in the locally defined dc_list list variable.
26.6. Adding a Resource to a Collection
add method of a collection adds a resource. The resource to be added is created based on the parameters provided. Parameters are provided to the add method using an instance of an object from the ovirtsdk.xml.params module. Which specific class from the module needs to be used varies based on the type of resource being created.
Example 26.4. Adding a Resource to a Collection
vm_params = params.VM(name="DemoVM", cluster=api.clusters.get("Default"), template=api.templates.get("Blank"), memory=536870912) vm = api.vms.add(vm_params)
- Create an instance of the parameter object for the type of resource being created.
- Identify the collection to which the resource will be added.
- Call the
addmethod of the collection passing the parameter object as a parameter.
Example 26.5. Complex Parameters
ovirtsdk.xml.params.Version object. Then this is used as a parameter when creating an instance of a ovirtsdk.xml.params.DataCenter object containing parameters of the data center to be created. The resource is then created using the add method of the datacenters collection.
v_params = params.Version(major=3, minor=2) dc_params = params.DataCenter(name="DemoDataCenter", storage_type="NFS", version=v_params) dc = api.datacenters.add(dc_params)
26.7. Updating a Resource in a Collection
update method for the resource to save the changes. Parameter modification is performed by using the set_* methods of the retrieved resource.
Example 26.6. Updating a Resource
DemoDataCenter has its description updated.
dc = api.datacenters.get("DemoDataCenter") dc.set_description("This data center description provided using the Python SDK") dc.update()
26.8. Removing a Resource from a Collection
delete method of the resource.
Example 26.7. Removing a Resource from a Collection
DemoVM from the vms collection:
vm = api.vms.get("DemoVM") vm.delete()
26.9. Handling Errors
ovirtsdk.infrastructure.errors module:
- ConnectionError
- Raised when a transport layer error has occurred.
- DisconnectedError
- Raised when attempting to use sdk after it was explicitly disconnected.
- ImmutableError
- Raised when initiating sdk while an sdk instance already exists under the same domain. Applicable to sdk <3.2.
- NoCertificatesError
- Raised when no CA is provided and --insecure is 'False'.
- RequestError
- Raised at any kind of oVirt server error.
- UnsecuredConnectionAttemptError
- Raised when HTTP protocol is used while server is running HTTPS.
- MissingParametersError
- Raised when you are trying to use get() method without providing either id or name.
Example 26.8. Catching a ConnectionError Exception
from ovirtsdk.api import API from ovirtsdk.xml import params try: api = API(url="https://HOST", user="USER, pass="PASS, ca_file="/etc/pki/ovirt-engine/ca.pem") except ConnectionError, err: print "Connection failed: %s" % err
Chapter 27. Python Reference Documentation
27.1. Python Reference Documentation
- ovirtsdk.api
- ovirtsdk.infrastructure.brokers
$ pydoc [MODULE]
Part IV. Java Software Development Kit
Table of Contents
- 28. Software Development Kit Overview
- 29. Using the Software Development Kit
- 29.1. Connecting to the Red Hat Enterprise Virtualization Manager
- 29.2. Listing Entities
- 29.3. Modifying the Attributes of Resources
- 29.4. Getting a Resource
- 29.5. Adding Resources
- 29.6. Performing Actions on Resources
- 29.7. Listing Sub-Resources
- 29.8. Getting Sub-Resources
- 29.9. Adding Sub-Resources to a Resource
- 29.10. Modifying Sub-Resources
- 29.11. Performing Actions on Sub-Resources
- 29.12. Java SDK Best Practices
- 29.13. Working with SSL (Secure Socket Layer)
Chapter 28. Software Development Kit Overview
28.1. Java Software Development Kit Introduction
Red Hat Enterprise Virtualization entitlement pool if using certificate-based Red Hat Network, or the Red Hat Enterprise Virtualization Manager channel if using Red Hat Network classic. See the Red Hat Enterprise Virtualization Installation Guide for more information on subscribing your system(s) to download software from these locations.
- A networked installation of Red Hat Enterprise Virtualization Manager.
- A networked and configured Red Hat Enterprise Virtualization Hypervisor.
28.2. Downloading the Java Software Development Kit
Procedure 28.1. Downloading the Java Software Development Kit
- Open a terminal.
- Run the following commands:
# yum install rhevm-sdk-java # yum install rhevm-sdk-java-javadoc
/usr/share/java/rhevm-sdk-java directory and can now be added to Java projects.
Chapter 29. Using the Software Development Kit
- 29.1. Connecting to the Red Hat Enterprise Virtualization Manager
- 29.2. Listing Entities
- 29.3. Modifying the Attributes of Resources
- 29.4. Getting a Resource
- 29.5. Adding Resources
- 29.6. Performing Actions on Resources
- 29.7. Listing Sub-Resources
- 29.8. Getting Sub-Resources
- 29.9. Adding Sub-Resources to a Resource
- 29.10. Modifying Sub-Resources
- 29.11. Performing Actions on Sub-Resources
- 29.12. Java SDK Best Practices
- 29.13. Working with SSL (Secure Socket Layer)
rhevm-sdk-java and rhevm-sdk-java-javadoc .jar files must be added to that project as external libraries. The following .jar files are also required to ensure all classes function correctly:
apache-commons-loggingcommons-beanutilscommons-codechttpclienthttpcore
29.1. Connecting to the Red Hat Enterprise Virtualization Manager
Api class acts as the gateway through which you connect to and manipulate objects in the Red Hat Enterprise Virtualization Manager. You must declare an instance of this class each time you interact with the Manager in a project.
Api class, first import the Api class into your project:
import org.ovirt.engine.sdk.Api;
Api api = new Api("[your manager's address]", "[user name]@[domain]", "[password]", "[path to certificate]");import org.ovirt.engine.sdk.Api;
import java.io.IOException;
public class Main
{
private static final String URL = "https://localhost:443/api";
@SuppressWarnings("unused");
public static void main(String[] args) throws ClientProtocolException,
ServerException, UnsecuredConnectionAttemptError, IOException
{
// #1 Authenticate using the user name and password
Api api = new Api(URL, "admin@interal", "123456", "/home/user/.ovirtsdk/");
...
}
}29.2. Listing Entities
getVMs() method of the Api class.
Procedure 29.1. Listing Entities
- Declare a
Listof the type of entity to be listed and use the corresponding method to get the list of entities:List<VM> vms = api.getVMs().list();
29.3. Modifying the Attributes of Resources
Procedure 29.2. Modifying the Attributes of a Resource
- Declare an instance of the resource whose attributes are to be modified:
VM vm = api.getVMs().get("test"); - Set the new value of the attribute:
vm.setDescription("java_sdk"); - Update the virtual machine to apply the change:
VM newVM = vm.update();
29.4. Getting a Resource
name, and UUID. Both return an object with the specified attribute if that object exists.
name attribute:
VM vm = api.getVMs().get("test");UUID attribute:
VM vm = api.getVMs().get(UUID.fromString("5a89a1d2-32be-33f7-a0d1-f8b5bc974ff6"));29.5. Adding Resources
VM class is declared to represent the new virtual machine to be added. Next, the attributes of that virtual machine set to the preferred values. Finally, the new virtual machine is added to the Manager.
org.ovirt.engine.sdk.entities.VM vmParams = new org.ovirt.engine.sdk.entities.VM();
vmParams.setName("myVm");
vmParams.setCluster(api.getClusters().get("myCluster"));
vmParams.setTemplate(api.getTemplates().get("myTemplate"));
...VM vm = api.getVMs().add(vmParams);
VM class is declared in the same way as Example 1. However, rather than using the get method to reference existing objects in the Manager, each attribute is referenced by declaring an instance of that attribute. Finally, the new virtual machine is added to the Manager.
org.ovirt.engine.sdk.entities.VM vmParams = new org.ovirt.engine.sdk.entities.VM();
vmParams.setName("myVm");
org.ovirt.engine.sdk.entities.Cluster clusterParam = new Cluster();
clusterParam.setName("myCluster");
vmParams.setCluster(clusterParam);
org.ovirt.engine.sdk.entities.Template templateParam = new Template();
templateParam.setName("myTemplate");
vmParams.setTemplate(templateParam);
...VM vm = api.getVMs().add(vmParams);
29.6. Performing Actions on Resources
Procedure 29.3. Performing an Action on a Resource
- Declare an instance of the resource:
VM vm = api.getVMs().get("test"); - Declare action parameters to send to the resource:
Action actionParam = new Action(); org.ovirt.engine.sdk.entities.VM vmParam = new org.ovirt.engine.sdk.entities.VM(); actionParam.setVm(vmParam);
- Perform the action:
Action res = vm.start(actionParam);
Action res = vm.start(new Action()
{
{
setVm(new org.ovirt.engine.sdk.entities.VM());
}
});
29.7. Listing Sub-Resources
Procedure 29.4. Listing Sub-Resources
- Declare an instance of the resource whose sub-resources are to be listed:
VM vm = api.getVMs().get("test"); - List the sub-resources:
List<VMDisk> disks = vm.getDisks().list();
29.8. Getting Sub-Resources
Procedure 29.5. Getting the Sub-Resources of a Resource
- Declare an instance of the resource whose sub-resources are to be referenced:
VM vm = api.getVMs().get("test"); - Declare an instance of the sub-resource to be referenced:
VMDisk disk = vm.getDisks().get("my disk");
29.9. Adding Sub-Resources to a Resource
Procedure 29.6. Adding a Sub-Resource to a Resource
- Declare an instance of the resource to which sub-resources are to be added:
VM vm = api.getVMs().get("test"); - Create parameters to define the attributes of the resource:
Disk diskParam = new Disk(); diskParam.setProvisionedSize(1073741824L); diskParam.setInterface("virtio"); diskParam.setFormat("cow"); - Add the sub-resource:
Disk disk = vm.getDisks().add(diskParam);
29.10. Modifying Sub-Resources
Procedure 29.7. Updating a Sub-Resource
- Declare an instance of the resource whose sub-resource is to be modified:
VM vm = api.getVMs().get("test"); - Declare an instance of the sub-resource to be modified:
VMDisk disk = vm.getDisks().get("test_Disk1"); - Set the new value of the attribute:
disk.setAlias("test_Disk1_updated"); - Update the sub-resource:
VMDisk updateDisk = disk.update();
29.11. Performing Actions on Sub-Resources
Procedure 29.8. Performing an Action on a Sub-Resource
- Declare an instance of the resource containing the sub-resource on which the action is to be performed:
VM vm = api.getVMs().get("test"); - Declare an instance of the sub-resource:
VMDisk disk = vm.getDisks().get("test_Disk1"); - Declare action parameters to send to the sub-resource:
Action actionParam = new Action();
- Perform the action:
Action result = disk.activate(actionParam);
29.12. Java SDK Best Practices
Api class should be shut down in a finally block to free daemon resources:
Api api = new Api(URL, USER, PASSWORD);
try {
api.getDataCenters().add(new DataCenter());
...
}
finally {
api.shutdown();
}
29.13. Working with SSL (Secure Socket Layer)
Procedure 29.9. Configuring a Java SDK Keystore
- Download the certificate for the Red Hat Enterprise Virtualization Manager from the following address:
https://[your manager's address]:[port]/ca.crt
- Generate the keystore:
keytool -import -alias "server.crt truststore" -file ca.crt -keystore server.truststore
- Make the Java SDK aware of the keystore via one of the following methods:
- Create a keystore lookup path:
mkdir ~/.ovirtsdk/ cp server.truststore ~/.ovirtsdk/ovirtsdk-keystore.truststore
Once ovirtsdk-keystore.truststore is copied to the~/.ovirtsdkdirectory, it will be used for host identity validation upon handshake with the destination host. - Use the following signature when declaring instances of the
Apiclass to specify a custom truststore:Api api = new Api(url, user, password, "/path/server.truststore");
Note
Api class:
Api api = new Api(url, user, password, true);
A.1. API Usage with cURL
A.2. Installing cURL
yum install curl
A.3. Using cURL
Usage: curl [options] uriuri refers to target HTTP address to send the request. This is a location on your Red Hat Enterprise Virtualization Manager host within the API entry point path (/api).
cURL options
- -X COMMAND, --request COMMAND
- The request command to use. In the context of the REST API, use
GET,POST,PUTorDELETE.Example:-X GET - -H LINE, --header LINE
- HTTP header to include with the request. Use multiple header options if more than one header is required.Example:
-H "Accept: application/xml" -H "Content-Type: application/xml" - -u USERNAME:PASSWORD, --user USERNAME:PASSWORD
- The user name and password of the Red Hat Enterprise Virtualization user. This attribute acts as a convenient replacement for the
Authorization:header.Example:-u admin@internal:p@55w0rd! - --cacert CERTIFICATE
- The location of the certificate file for SSL communication to the REST API. The certificate file is saved locally on the client machine. Use the
-kattribute to bypass SSL.Example:--cacert ~/Certificates/rhevm.cer - -d BODY, --data BODY
- The body to send for requests. Use with
POST,PUTandDELETErequests. Ensure to specify theContent-Type: application/xmlheader if a body exists in the request.Example:-d "<cdrom><file id='rhel-server-6.0-x86_64-dvd.iso'/></cdrom>"
A.4. Examples
A.4.1. GET Request with cURL
Example A.1. GET request
GET request lists the virtual machines in the vms collection. Note that a GET request does not contain a body.
GET /api/vms HTTP/1.1 Accept: application/xml
GET), header (Accept: application/xml) and URI (https://[RHEVM-Host]:443/api/vms) into the following cURL command:
$ curl -X GET -H "Accept: application/xml" -u [USER:PASS] --cacert [CERT] https://[RHEVM-Host]:443/api/vms
vms collection displays.
A.4.2. POST Request with cURL
Example A.2. POST request
POST request creates a virtual machine in the vms collection. Note that a POST request requires a body.
POST /api/vms HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vm>
<name>vm1</name>
<cluster>
<name>default</name>
</cluster>
<template>
<name>Blank</name>
</template>
<memory>536870912</memory>
<os>
<boot dev="hd"/>
</os>
</vm>
POST), headers (Accept: application/xml and Content-type: application/xml), URI (https://[RHEVM-Host]:443/api/vms) and request body into the following cURL command:
$ curl -X POST -H "Accept: application/xml" -H "Content-type: application/xml" -u [USER:PASS] --cacert [CERT] -d "<vm><name>vm1</name><cluster><name>default</name></cluster><template><name>Blank</name></template><memory>536870912</memory><os><boot dev='hd'/></os></vm>" https://[RHEVM-Host]:443/api/vms
A.4.3. PUT Request with cURL
Example A.3. PUT request
PUT request updates the memory of a virtual machine resource. Note that a PUT request requires a body.
PUT /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399 HTTP/1.1
Accept: application/xml
Content-type: application/xml
<vm>
<memory>1073741824</memory>
</vm>
PUT), headers (Accept: application/xml and Content-type: application/xml), URI (https://[RHEVM-Host]:443/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399) and request body into the following cURL command:
$ curl -X PUT -H "Accept: application/xml" -H "Content-type: application/xml" -u [USER:PASS] --cacert [CERT] -d "<vm><memory>1073741824</memory></vm>" https://[RHEVM-Host]:443//api/vms/082c794b-771f-452f-83c9-b2b5a19c039
A.4.4. DELETE Request with cURL
Example A.4. DELETE request
DELETE request removes a virtual machine resource.
DELETE /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399 HTTP/1.1
DELETE) and URI (https://[RHEVM-Host]:443/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399) into the following cURL command:
$ curl -X DELETE -u [USER:PASS] --cacert [CERT] https://[RHEVM-Host]:443//api/vms/082c794b-771f-452f-83c9-b2b5a19c039
Accept: application/xml request header is optional due to the empty result of DELETE requests.
A.4.5. DELETE Request Including Body with cURL
Example A.5. DELETE request with body
DELETE request force removes a virtual machine resource as indicated with the optional body.
DELETE /api/vms/082c794b-771f-452f-83c9-b2b5a19c0399 HTTP/1.1 Accept: application/xml Content-type: application/xml <action> <force>true</force> </action>
DELETE), headers (Accept: application/xml and Content-type: application/xml), URI (https://[RHEVM-Host]:443/api/vms/082c794b-771f-452f-83c9-b2b5a19c0399) and request body into the following cURL command:
$ curl -X DELETE -H "Accept: application/xml" -H "Content-type: application/xml" -u [USER:PASS] --cacert [CERT] -d "<action><force>true</force></action>" https://[RHEVM-Host]:443//api/vms/082c794b-771f-452f-83c9-b2b5a19c039
B.1. Installing Red Hat Support Plugin
Procedure B.1. Installing the Red Hat Support Plugin
Note
- Use yum to install the redhat-support-plugin-rhev plugin:
#yum install redhat-support-plugin-rhev
C.1. Creating SSL/TLS Certificates
openssl. To install this tool, run the following command on your host:
# yum install openssl
Procedure C.1. Creating a Certificate Authority
- Run the following command:
# openssl req -new -x509 -keyout ca.key -out ca.crt -days 3650
This command requests a new CA pair valid for 3650 days. - Enter a password to protect your CA:
Generating a 2048 bit RSA private key ......................................................................................................................................+++ ..................................................................................................+++ writing new private key to 'ca.key' Enter PEM pass phrase: Verifying - Enter PEM pass phrase:
- Enter the following details about your organization:
Country Name (2 letter code) [XX]:AU State or Province Name (full name) []:Queensland Locality Name (eg, city) [Default City]:Brisbane Organization Name (eg, company) [Default Company Ltd]:Red Hat Organizational Unit Name (eg, section) []:Engineering Content Services Common Name (eg, your name or your server's hostname) []:www.example.com Email Address []:dmacpher@redhat.com
This information forms the Distinguished Name (DN) in your certificate.
openssl creates two files: ca.key, which is a key administrators use to sign certificates, and ca.crt, which is the public CA certificate that users obtain to verify the validity of signed certificates they receive. Make sure users accessing your host have a copy of the ca.crt so they can import it into their client's trusted CA store.
C.2. Creating an SSL Certificate
openssl. To install this tool, run the following command on your host:
# yum install openssl
Procedure C.2. Creating an SSL Certificate
- Create a key for your host:
# openssl genrsa -out ssl.key
This creates anssl.keykey file. - Use the key to create a signing request for your certificate:
# openssl req -new -key ssl.key -out ssl.csr
The signing request asks for some organization details to form the Distinguished Name (DN) in your certificate.Country Name (2 letter code) [XX]:AU State or Province Name (full name) []:Queensland Locality Name (eg, city) [Default City]:Brisbane Organization Name (eg, company) [Default Company Ltd]:Red Hat Organizational Unit Name (eg, section) []:Engineering Content Services Common Name (eg, your name or your server's hostname) []:www.example.com Email Address []:dmacpher@redhat.com
This creates anssl.csrsigning request file. - Create the signed SSL certificate:
# openssl ca -cert ca.crt -keyfile ca.key -out ssl.crt -infiles ssl.csr
opensslasks for your CA key's password.This creates a certificate file namedssl.crt.Important
The above command may result in the following error:Using configuration from /etc/pki/tls/openssl.cnf Enter pass phrase for ca.key: /etc/pki/CA/index.txt: No such file or directory unable to open '/etc/pki/CA/index.txt' 139883256969032:error:02001002:system library:fopen:No such file or directory:bss_file.c:355:fopen('/etc/pki/CA/index.txt','r') 139883256969032:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:357:Procedure C.3. Resolving this error
- Create the index.txt file.
# touch /etc/pki/CA/index.txt
- Create a serial file to label the CA and all subsequent certificates.
# echo '1000' > /etc/pki/CA/serial
You will only need to do this the first time you set up the SSL certificate. Re-run the command:# openssl ca -cert ca.crt -keyfile ca.key -out ssl.crt -infiles ssl.csr
ssl.crt and ssl.key form the certificate pair that your host uses to encrypt data via HTTPS.
openssl creates two files: ca.key, which is a key administrators use to sign certificates, and ca.crt, which is the public CA certificate that users obtain to verify the validity of signed certificates they receive. Make sure users accessing your host have a copy of the ca.crt so they can import it into their client's trusted CA store.
C.3. Configuring HTTPS Communication
Procedure C.4. Configuring HTTPS Communication
- Edit the
/etc/httpd/conf.d/ssl.conffile and modify the following settings:SSLCertificateFile [location of your ssl.crt] SSLCertificateKeyFile [location of your ssl.key]
- After editing these settings, restart your web server:
#service httpd restart
C.4. Network Security Services (NSS) Database
rhevm.cer certificate into the local NSS Database.
rhevm.cer certificate using the following command:
$ certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "Red Hat Enterprise Virtualization Manager" -i rhevm.cerrhevm.cer certificate as root using the following command:
# certutil -d sql:/etc/pki/nssdb -A -t TC -n "Red Hat Enterprise Virtualization Manager" -i rhevm.cerC.5. Java Keystores
Procedure C.5. Import a certificate into a new Java keystore
rhevm.cer certificate into a Java keystore. This procedure requires the keytool management utility from the Java Development Kit (JDK) available for Linux and Windows systems.
- Access your client machine and locate the
rhevm.cercertificate. - Import the
rhevm.cercertificate using the Java keytool management utility.keytool -importcert -v -trustcacerts -keystore restapi.jks -noprompt -alias rhevm -file rhevm.cer
The keytool utility creates a new keystore file namedrestapi.jks. - keytool asks for the keystore password. Enter a password and keytool asks to verify it.
- keytool adds the
rhevm.cercertificate to therestapi.jkskeystore. Use keytool -list command to view the certificate's entry in the keystore:keytool -list -keystore restapi.jks -storepass [password]
Important
openssl x509 -in rhevm.cer -out rhevm.new -outform [pem|der]This creates a file called
rhevm.new to use in place of rhevm.cer.
D.1. Enumerated Value Translation
Table D.1. Enumerated Value Translations
|
Resource Type
|
API Enumerable Type
|
API Enumerable Value
|
Query Language Property
|
Query Language Value
|
|---|---|---|---|---|
|
Data Centers
| data_center_states | not_operational | status | notoperational |
|
Hosts
| host_states | non_responsive | status | nonresponsive |
install_failed | installfailed | |||
preparing_for_maintenance | preparingformaintenance | |||
non_operational | nonoperational | |||
pending_approval | pendingapproval | |||
|
Virtual Machines
| vm_states | powering_up | status | poweringup |
powering_down | poweringdown | |||
migrating | migratingfrom | |||
migrating | migratingto | |||
not_responding | notresponding | |||
wait_for_launch | waitforlaunch | |||
reboot_in_progress | rebootinprogress | |||
saving_state | savingstate | |||
restoring_state | restoringstate | |||
image_locked | imagelocked |
E.1. Event Codes
Table E.1. Event codes
| Code | Description |
|---|---|
0 | UNASSIGNED |
1 | VDC_START |
2 | VDC_STOP |
12 | HOST_FAILURE |
13 | HOST_DETECTED |
14 | HOST_RECOVER |
15 | HOST_MAINTENANCE |
16 | HOST_ACTIVATE |
17 | HOST_MAINTENANCE_FAILED |
18 | HOST_ACTIVATE_FAILED |
19 | HOST_RECOVER_FAILED |
20 | USER_HOST_START |
21 | USER_HOST_STOP |
22 | IRS_FAILURE |
26 | IRS_DISK_SPACE_LOW |
30 | USER_VDC_LOGIN |
31 | USER_VDC_LOGOUT |
32 | USER_RUN_VM |
33 | USER_STOP_VM |
34 | USER_ADD_VM |
35 | USER_UPDATE_VM |
36 | USER_REMOVE_VM |
37 | USER_ADD_VM_STARTED |
38 | USER_CHANGE_DISK_VM |
39 | USER_PAUSE_VM |
40 | USER_RESUME_VM |
41 | USER_HOST_RESTART |
42 | USER_ADD_HOST |
43 | USER_UPDATE_HOST |
44 | USER_REMOVE_HOST |
45 | USER_CREATE_SNAPSHOT |
46 | USER_TRY_BACK_TO_SNAPSHOT |
47 | USER_RESTORE_FROM_SNAPSHOT |
48 | USER_ADD_VM_TEMPLATE |
49 | USER_UPDATE_VM_TEMPLATE |
50 | USER_REMOVE_VM_TEMPLATE |
51 | USER_ADD_VM_TEMPLATE_FINISHED_SUCCESS |
52 | USER_ADD_VM_TEMPLATE_FINISHED_FAILURE |
53 | USER_ADD_VM_FINISHED_SUCCESS |
54 | USER_FAILED_RUN_VM |
55 | USER_FAILED_PAUSE_VM |
56 | USER_FAILED_STOP_VM |
57 | USER_FAILED_ADD_VM |
58 | USER_FAILED_UPDATE_VM |
59 | USER_FAILED_REMOVE_VM |
60 | USER_ADD_VM_FINISHED_FAILURE |
61 | VM_DOWN |
62 | VM_MIGRATION_START |
63 | VM_MIGRATION_DONE |
64 | VM_MIGRATION_ABORT |
65 | VM_MIGRATION_FAILED |
66 | VM_FAILURE |
68 | USER_CREATE_SNAPSHOT_FINISHED_SUCCESS |
69 | USER_CREATE_SNAPSHOT_FINISHED_FAILURE |
70 | USER_RUN_VM_AS_STATELESS_FINISHED_FAILURE |
71 | USER_TRY_BACK_TO_SNAPSHOT_FINISH_SUCCESS |
72 | USER_CHANGE_FLOPPY_VM |
73 | USER_INITIATED_SHUTDOWN_VM |
74 | USER_FAILED_SHUTDOWN_VM |
75 | USER_FAILED_CHANGE_FLOPPY_VM |
76 | USER_STOPPED_VM_INSTEAD_OF_SHUTDOWN |
77 | USER_FAILED_STOPPING_VM_INSTEAD_OF_SHUTDOWN |
78 | USER_ADD_DISK_TO_VM |
79 | USER_FAILED_ADD_DISK_TO_VM |
80 | USER_REMOVE_DISK_FROM_VM |
81 | USER_FAILED_REMOVE_DISK_FROM_VM |
82 | USER_MOVED_VM |
83 | USER_FAILED_MOVE_VM |
84 | USER_MOVED_TEMPLATE |
85 | USER_FAILED_MOVE_TEMPLATE |
86 | USER_COPIED_TEMPLATE |
87 | USER_FAILED_COPY_TEMPLATE |
88 | USER_UPDATE_VM_DISK |
89 | USER_FAILED_UPDATE_VM_DISK |
90 | USER_HOST_SHUTDOWN |
91 | USER_MOVED_VM_FINISHED_SUCCESS |
92 | USER_MOVED_VM_FINISHED_FAILURE |
93 | USER_MOVED_TEMPLATE_FINISHED_SUCCESS |
94 | USER_MOVED_TEMPLATE_FINISHED_FAILURE |
95 | USER_COPIED_TEMPLATE_FINISHED_SUCCESS |
96 | USER_COPIED_TEMPLATE_FINISHED_FAILURE |
97 | USER_ADD_DISK_TO_VM_FINISHED_SUCCESS |
98 | USER_ADD_DISK_TO_VM_FINISHED_FAILURE |
99 | USER_TRY_BACK_TO_SNAPSHOT_FINISH_FAILURE |
100 | USER_RESTORE_FROM_SNAPSHOT_FINISH_SUCCESS |
101 | USER_RESTORE_FROM_SNAPSHOT_FINISH_FAILURE |
102 | USER_FAILED_CHANGE_DISK_VM |
103 | USER_FAILED_RESUME_VM |
104 | USER_FAILED_ADD_HOST |
105 | USER_FAILED_UPDATE_HOST |
106 | USER_FAILED_REMOVE_HOST |
107 | USER_FAILED_HOST_RESTART |
108 | USER_FAILED_ADD_VM_TEMPLATE |
109 | USER_FAILED_UPDATE_VM_TEMPLATE |
110 | USER_FAILED_REMOVE_VM_TEMPLATE |
111 | USER_STOP_SUSPENDED_VM |
112 | USER_STOP_SUSPENDED_VM_FAILED |
113 | USER_REMOVE_VM_FINISHED |
114 | USER_VDC_LOGIN_FAILED |
115 | USER_FAILED_TRY_BACK_TO_SNAPSHOT |
116 | USER_FAILED_RESTORE_FROM_SNAPSHOT |
117 | USER_FAILED_CREATE_SNAPSHOT |
118 | USER_FAILED_HOST_START |
119 | VM_DOWN_ERROR |
120 | VM_MIGRATION_FAILED_FROM_TO |
121 | SYSTEM_HOST_RESTART |
122 | SYSTEM_FAILED_HOST_RESTART |
123 | HOST_SLOW_STORAGE_RESPONSE_TIME |
124 | VM_IMPORT |
125 | VM_IMPORT_FAILED |
126 | VM_NOT_RESPONDING |
127 | HOST_RUN_IN_NO_KVM_MODE |
128 | VM_MIGRATION_TRYING_RERUN |
129 | VM_CLEARED |
130 | USER_FAILED_HOST_SHUTDOWN |
131 | USER_EXPORT_VM |
132 | USER_EXPORT_VM_FAILED |
133 | USER_EXPORT_TEMPLATE |
134 | USER_EXPORT_TEMPLATE_FAILED |
135 | TEMPLATE_IMPORT |
136 | TEMPLATE_IMPORT_FAILED |
137 | USER_FAILED_HOST_STOP |
138 | VM_PAUSED_ENOSPC |
139 | VM_PAUSED_ERROR |
140 | VM_MIGRATION_FAILED_DURING_MOVE_TO_MAINTANANCE |
141 | HOST_VERSION_NOT_SUPPORTED_FOR_CLUSTER |
142 | VM_SET_TO_UNKNOWN_STATUS |
143 | VM_WAS_SET_DOWN_DUE_TO_HOST_REBOOT_OR_MANUAL_FENCE |
144 | VM_IMPORT_INFO |
145 | VM_BLK_VIRTIO_NO_CACHE |
149 | USER_ADD |
150 | USER_INITIATED_RUN_VM |
151 | USER_INITIATED_RUN_VM_FAILED |
152 | USER_RUN_VM_ON_NON_DEFAULT_HOST |
153 | USER_STARTED_VM |
182 | USER_FAILED_ATTACH_USER_TO_VM |
201 | IRS_DISK_SPACE_LOW_ERROR |
204 | IRS_HOSTED_ON_HOST |
250 | USER_UPDATE_VM_CLUSTER_DEFAULT_HOST_CLEARED |
251 | USER_REMOVE_VM_TEMPLATE_FINISHED |
300 | USER_ADD_VM_POOL |
301 | USER_ADD_VM_POOL_FAILED |
302 | USER_ADD_VM_POOL_WITH_VMS |
303 | USER_ADD_VM_POOL_WITH_VMS_FAILED |
304 | USER_REMOVE_VM_POOL |
305 | USER_REMOVE_VM_POOL_FAILED |
306 | USER_ADD_VM_TO_POOL |
307 | USER_ADD_VM_TO_POOL_FAILED |
308 | USER_REMOVE_VM_FROM_POOL |
309 | USER_REMOVE_VM_FROM_POOL_FAILED |
310 | USER_ATTACH_USER_TO_POOL |
311 | USER_ATTACH_USER_TO_POOL_FAILED |
312 | USER_DETACH_USER_FROM_POOL |
313 | USER_DETACH_USER_FROM_POOL_FAILED |
314 | USER_UPDATE_VM_POOL |
315 | USER_UPDATE_VM_POOL_FAILED |
316 | USER_ATTACH_USER_TO_VM_FROM_POOL |
317 | USER_ATTACH_USER_TO_VM_FROM_POOL_FAILED |
318 | USER_ATTACH_USER_TO_VM_FROM_POOL_FINISHED_SUCCESS |
319 | USER_ATTACH_USER_TO_VM_FROM_POOL_FINISHED_FAILURE |
320 | USER_ADD_VM_POOL_WITH_VMS_ADD_HOST_FAILED |
325 | USER_REMOVE_ADUSER |
326 | USER_FAILED_REMOVE_ADUSER |
327 | USER_FAILED_ADD_ADUSER |
328 | USER_ATTACH_USER_TO_TIME_LEASED_POOL |
329 | USER_ATTACH_USER_TO_TIME_LEASED_POOL_FAILED |
330 | USER_DETACH_USER_FROM_TIME_LEASED_POOL |
331 | USER_DETACH_USER_FROM_TIME_LEASED_POOL_FAILED |
332 | USER_ATTACH_AD_GROUP_TO_TIME_LEASED_POOL |
333 | USER_ATTACH_AD_GROUP_TO_TIME_LEASED_POOL_FAILED |
334 | USER_DETACH_AD_GROUP_FROM_TIME_LEASED_POOL |
335 | USER_DETACH_AD_GROUP_FROM_TIME_LEASED_POOL_FAILED |
336 | USER_UPDATE_USER_TO_TIME_LEASED_POOL |
337 | USER_UPDATE_USER_TO_TIME_LEASED_POOL_FAILED |
338 | USER_UPDATE_AD_GROUP_TO_TIME_LEASED_POOL |
339 | USER_UPDATE_AD_GROUP_TO_TIME_LEASED_POOL_FAILED |
342 | USER_MERGE_SNAPSHOT |
343 | USER_FAILED_MERGE_SNAPSHOT |
344 | USER_UPDATE_VM_POOL_WITH_VMS |
345 | USER_UPDATE_VM_POOL_WITH_VMS_FAILED |
346 | USER_PASSWORD_CHANGED |
347 | USER_PASSWORD_CHANGE_FAILED |
348 | USER_CLEAR_UNKNOWN_VMS |
349 | USER_FAILED_CLEAR_UNKNOWN_VMS |
350 | USER_ADD_BOOKMARK |
351 | USER_ADD_BOOKMARK_FAILED |
352 | USER_UPDATE_BOOKMARK |
353 | USER_UPDATE_BOOKMARK_FAILED |
354 | USER_REMOVE_BOOKMARK |
355 | USER_REMOVE_BOOKMARK_FAILED |
356 | USER_MERGE_SNAPSHOT_FINISHED_SUCCESS |
357 | USER_MERGE_SNAPSHOT_FINISHED_FAILURE |
360 | USER_DETACH_USER_FROM_VM |
361 | USER_FAILED_DETACH_USER_FROM_VM |
400 | USER_ATTACH_VM_TO_AD_GROUP |
401 | USER_ATTACH_VM_TO_AD_GROUP_FAILED |
402 | USER_DETACH_VM_TO_AD_GROUP |
403 | USER_DETACH_VM_TO_AD_GROUP_FAILED |
404 | USER_ATTACH_VM_POOL_TO_AD_GROUP |
405 | USER_ATTACH_VM_POOL_TO_AD_GROUP_FAILED |
406 | USER_DETACH_VM_POOL_TO_AD_GROUP |
407 | USER_DETACH_VM_POOL_TO_AD_GROUP_FAILED |
408 | USER_REMOVE_AD_GROUP |
409 | USER_REMOVE_AD_GROUP_FAILED |
430 | USER_UPDATE_TAG |
431 | USER_UPDATE_TAG_FAILED |
432 | USER_ADD_TAG |
433 | USER_ADD_TAG_FAILED |
434 | USER_REMOVE_TAG |
435 | USER_REMOVE_TAG_FAILED |
436 | USER_ATTACH_TAG_TO_USER |
437 | USER_ATTACH_TAG_TO_USER_FAILED |
438 | USER_ATTACH_TAG_TO_USER_GROUP |
439 | USER_ATTACH_TAG_TO_USER_GROUP_FAILED |
440 | USER_ATTACH_TAG_TO_VM |
441 | USER_ATTACH_TAG_TO_VM_FAILED |
442 | USER_ATTACH_TAG_TO_HOST |
443 | USER_ATTACH_TAG_TO_HOST_FAILED |
444 | USER_DETACH_HOST_FROM_TAG |
445 | USER_DETACH_HOST_FROM_TAG_FAILED |
446 | USER_DETACH_VM_FROM_TAG |
447 | USER_DETACH_VM_FROM_TAG_FAILED |
448 | USER_DETACH_USER_FROM_TAG |
449 | USER_DETACH_USER_FROM_TAG_FAILED |
450 | USER_DETACH_USER_GROUP_FROM_TAG |
451 | USER_DETACH_USER_GROUP_FROM_TAG_FAILED |
452 | USER_ATTACH_TAG_TO_USER_EXISTS |
453 | USER_ATTACH_TAG_TO_USER_GROUP_EXISTS |
454 | USER_ATTACH_TAG_TO_VM_EXISTS |
455 | USER_ATTACH_TAG_TO_HOST_EXISTS |
456 | USER_LOGGED_IN_VM |
457 | USER_LOGGED_OUT_VM |
458 | USER_LOCKED_VM |
459 | USER_UNLOCKED_VM |
460 | USER_DETACH_USER_FROM_TIME_LEASED_POOL_INTERNAL |
461 | USER_DETACH_USER_FROM_TIME_LEASED_POOL_FAILED_INTERNAL |
462 | USER_DETACH_AD_GROUP_FROM_TIME_LEASED_POOL_INTERNAL |
463 | USER_DETACH_AD_GROUP_FROM_TIME_LEASED_POOL_FAILED_INTERNAL |
467 | UPDATE_TAGS_VM_DEFAULT_DISPLAY_TYPE |
468 | UPDATE_TAGS_VM_DEFAULT_DISPLAY_TYPE_FAILED |
470 | USER_ATTACH_VM_POOL_TO_AD_GROUP_INTERNAL |
471 | USER_ATTACH_VM_POOL_TO_AD_GROUP_FAILED_INTERNAL |
472 | USER_ATTACH_USER_TO_POOL_INTERNAL |
473 | USER_ATTACH_USER_TO_POOL_FAILED_INTERNAL |
494 | HOST_MANUAL_FENCE_STATUS |
495 | HOST_MANUAL_FENCE_STATUS_FAILED |
496 | HOST_FENCE_STATUS |
497 | HOST_FENCE_STATUS_FAILED |
498 | HOST_APPROVE |
499 | HOST_APPROVE_FAILED |
500 | HOST_FAILED_TO_RUN_VMS |
501 | USER_SUSPEND_VM |
502 | USER_FAILED_SUSPEND_VM |
503 | USER_SUSPEND_VM_OK |
504 | HOST_INSTALL |
505 | HOST_INSTALL_FAILED |
506 | HOST_INITIATED_RUN_VM |
507 | HOST_INITIATED_RUN_VM_FAILED |
509 | HOST_INSTALL_IN_PROGRESS |
510 | HOST_INSTALL_IN_PROGRESS_WARNING |
511 | HOST_INSTALL_IN_PROGRESS_ERROR |
512 | USER_SUSPEND_VM_FINISH_SUCCESS |
513 | HOST_RECOVER_FAILED_VMS_UNKNOWN |
514 | HOST_INITIALIZING |
515 | HOST_CPU_LOWER_THAN_CLUSTER |
516 | HOST_CPU_RETRIEVE_FAILED |
517 | HOST_SET_NONOPERATIONAL |
518 | HOST_SET_NONOPERATIONAL_FAILED |
519 | HOST_SET_NONOPERATIONAL_NETWORK |
520 | USER_ATTACH_USER_TO_VM |
521 | USER_SUSPEND_VM_FINISH_FAILURE |
522 | HOST_SET_NONOPERATIONAL_DOMAIN |
523 | HOST_SET_NONOPERATIONAL_DOMAIN_FAILED |
524 | AUTO_SUSPEND_VM |
524 | HOST_DOMAIN_DELAY_INTERVAL |
525 | AUTO_SUSPEND_VM_FINISH_SUCCESS |
526 | AUTO_SUSPEND_VM_FINISH_FAILURE |
527 | AUTO_FAILED_SUSPEND_VM |
528 | USER_EJECT_VM_DISK |
529 | USER_EJECT_VM_FLOPPY |
530 | HOST_MANUAL_FENCE_FAILED_CALL_FENCE_SPM |
531 | HOST_LOW_MEM |
555 | USER_MOVE_TAG |
556 | USER_MOVE_TAG_FAILED |
600 | USER_HOST_MAINTENANCE |
601 | CPU_FLAGS_NX_IS_MISSING |
602 | USER_HOST_MAINTENANCE_MIGRATION_FAILED |
603 | HOST_SET_NONOPERATIONAL_IFACE_DOWN |
800 | IMAGES_SYNCRONIZER_DESKTOP_NOT_EXIST_IN_VDC |
801 | IMAGES_SYNCRONIZER_TEMPLATE_NOT_EXIST_IMAGE_EXIST |
802 | IMAGES_SYNCRONIZER_SNAPSHOT_NOT_EXIST_IN_VDC |
803 | IMAGES_SYNCRONIZER_SNAPSHOTS_NOT_ATTACHED_TO_VM_IN_VDC |
804 | IMAGES_SYNCRONIZER_TEMPLATE_NOT_EXIST_IN_VDC |
805 | IMAGES_SYNCRONIZER_DESKTOP_NOT_EXIST_IN_IRS |
806 | IMAGES_SYNCRONIZER_SNAPSHOT_NOT_EXIST_IN_IRS |
807 | IMAGES_SYNCRONIZER_DESKTOP_WITHOUT_TEMPLATE_VDC |
808 | IMAGES_SYNCRONIZER_IMAGE_TEMPLATE_NOT_EXIST |
809 | USER_ADD_HOST_GROUP |
810 | USER_ADD_HOST_GROUP_FAILED |
811 | USER_UPDATE_HOST_GROUP |
812 | USER_UPDATE_HOST_GROUP_FAILED |
813 | USER_REMOVE_HOST_GROUP |
814 | USER_REMOVE_HOST_GROUP_FAILED |
815 | USER_VDC_LOGOUT_FAILED |
816 | MAC_POOL_EMPTY |
817 | CERTIFICATE_FILE_NOT_FOUND |
818 | RUN_VM_FAILED |
819 | HOST_REGISTER_ERROR_UPDATING_HOST |
820 | HOST_REGISTER_ERROR_UPDATING_HOST_ALL_TAKEN |
821 | HOST_REGISTER_HOST_IS_ACTIVE |
822 | HOST_REGISTER_ERROR_UPDATING_NAME |
823 | HOST_REGISTER_ERROR_UPDATING_NAMES_ALL_TAKEN |
824 | HOST_REGISTER_NAME_IS_ACTIVE |
825 | HOST_REGISTER_AUTO_APPROVE_PATTERN |
826 | HOST_REGISTER_FAILED |
827 | HOST_REGISTER_EXISTING_HOST_UPDATE_FAILED |
828 | HOST_REGISTER_SUCCEEDED |
829 | VM_MIGRATION_ON_CONNECT_CHECK_FAILED |
830 | VM_MIGRATION_ON_CONNECT_CHECK_SUCCEEDED |
831 | USER_DEDICATE_VM_TO_POWERCLIENT |
832 | USER_DEDICATE_VM_TO_POWERCLIENT_FAILED |
833 | MAC_ADDRESS_IS_IN_USE |
835 | SYSTEM_UPDATE_HOST_GROUP |
836 | SYSTEM_UPDATE_HOST_GROUP_FAILED |
850 | USER_ADD_PERMISSION |
851 | USER_ADD_PERMISSION_FAILED |
852 | USER_REMOVE_PERMISSION |
853 | USER_REMOVE_PERMISSION_FAILED |
854 | USER_ADD_ROLE |
855 | USER_ADD_ROLE_FAILED |
856 | USER_UPDATE_ROLE |
857 | USER_UPDATE_ROLE_FAILED |
858 | USER_REMOVE_ROLE |
859 | USER_REMOVE_ROLE_FAILED |
860 | USER_ATTACHED_ACTION_GROUP_TO_ROLE |
861 | USER_ATTACHED_ACTION_GROUP_TO_ROLE_FAILED |
862 | USER_DETACHED_ACTION_GROUP_FROM_ROLE |
863 | USER_DETACHED_ACTION_GROUP_FROM_ROLE_FAILED |
864 | USER_ADD_ROLE_WITH_ACTION_GROUP |
865 | USER_ADD_ROLE_WITH_ACTION_GROUP_FAILED |
900 | AD_COMPUTER_ACCOUNT_SUCCEEDED |
901 | AD_COMPUTER_ACCOUNT_FAILED |
920 | NETWORK_ATTACH_NETWORK_TO_HOST |
921 | NETWORK_ATTACH_NETWORK_TO_HOST_FAILED |
922 | NETWORK_DETACH_NETWORK_FROM_HOST |
923 | NETWORK_DETACH_NETWORK_FROM_HOST_FAILED |
924 | NETWORK_ADD_BOND |
925 | NETWORK_ADD_BOND_FAILED |
926 | NETWORK_REMOVE_BOND |
927 | NETWORK_REMOVE_BOND_FAILED |
928 | NETWORK_HOST_NETWORK_MATCH_CLUSTER |
929 | NETWORK_HOST_NETWORK_NOT_MATCH_CLUSTER |
930 | NETWORK_REMOVE_VM_INTERFACE |
931 | NETWORK_REMOVE_VM_INTERFACE_FAILED |
932 | NETWORK_ADD_VM_INTERFACE |
933 | NETWORK_ADD_VM_INTERFACE_FAILED |
934 | NETWORK_UPDATE_VM_INTERFACE |
935 | NETWORK_UPDATE_VM_INTERFACE_FAILED |
936 | NETWORK_ADD_TEMPLATE_INTERFACE |
937 | NETWORK_ADD_TEMPLATE_INTERFACE_FAILED |
938 | NETWORK_REMOVE_TEMPLATE_INTERFACE |
939 | NETWORK_REMOVE_TEMPLATE_INTERFACE_FAILED |
940 | NETWORK_UPDATE_TEMPLATE_INTERFACE |
941 | NETWORK_UPDATE_TEMPLATE_INTERFACE_FAILED |
942 | NETWORK_ADD_NETWORK |
943 | NETWORK_ADD_NETWORK_FAILED |
944 | NETWORK_REMOVE_NETWORK |
945 | NETWORK_REMOVE_NETWORK_FAILED |
946 | NETWORK_ATTACH_NETWORK_TO_HOST_GROUP |
947 | NETWORK_ATTACH_NETWORK_TO_HOST_GROUP_FAILED |
948 | NETWORK_DETACH_NETWORK_TO_HOST_GROUP |
949 | NETWORK_DETACH_NETWORK_TO_HOST_GROUP_FAILED |
950 | USER_ADD_STORAGE_POOL |
951 | USER_ADD_STORAGE_POOL_FAILED |
952 | USER_UPDATE_STORAGE_POOL |
953 | USER_UPDATE_STORAGE_POOL_FAILED |
954 | USER_REMOVE_STORAGE_POOL |
955 | USER_REMOVE_STORAGE_POOL_FAILED |
956 | USER_ADD_STORAGE_DOMAIN |
957 | USER_ADD_STORAGE_DOMAIN_FAILED |
958 | USER_UPDATE_STORAGE_DOMAIN |
959 | USER_UPDATE_STORAGE_DOMAIN_FAILED |
960 | USER_REMOVE_STORAGE_DOMAIN |
961 | USER_REMOVE_STORAGE_DOMAIN_FAILED |
962 | USER_ATTACH_STORAGE_DOMAIN_TO_POOL |
963 | USER_ATTACH_STORAGE_DOMAIN_TO_POOL_FAILED |
964 | USER_DETACH_STORAGE_DOMAIN_FROM_POOL |
965 | USER_DETACH_STORAGE_DOMAIN_FROM_POOL_FAILED |
966 | USER_ACTIVATED_STORAGE_DOMAIN |
967 | USER_ACTIVATE_STORAGE_DOMAIN_FAILED |
968 | USER_DEACTIVATED_STORAGE_DOMAIN |
969 | USER_DEACTIVATE_STORAGE_DOMAIN_FAILED |
970 | SYSTEM_DEACTIVATED_STORAGE_DOMAIN |
971 | SYSTEM_DEACTIVATE_STORAGE_DOMAIN_FAILED |
972 | USER_EXTENDED_STORAGE_DOMAIN |
973 | USER_EXTENDED_STORAGE_DOMAIN_FAILED |
974 | USER_REMOVE_VG |
975 | USER_REMOVE_VG_FAILED |
976 | USER_ACTIVATE_STORAGE_POOL |
977 | USER_ACTIVATE_STORAGE_POOL_FAILED |
978 | SYSTEM_FAILED_CHANGE_STORAGE_POOL_STATUS |
979 | SYSTEM_CHANGE_STORAGE_POOL_STATUS_NO_HOST_FOR_SPM |
980 | SYSTEM_CHANGE_STORAGE_POOL_STATUS_PROBLEMATIC |
981 | USER_FORCE_REMOVE_STORAGE_DOMAIN |
982 | USER_FORCE_REMOVE_STORAGE_DOMAIN_FAILED |
983 | RECONSTRUCT_MASTER_FAILED_NO_MASTER |
984 | RECONSTRUCT_MASTER_DONE |
985 | RECONSTRUCT_MASTER_FAILED |
986 | SYSTEM_CHANGE_STORAGE_POOL_STATUS_PROBLEMATIC_SEARCHING_NEW_SPM |
987 | SYSTEM_CHANGE_STORAGE_POOL_STATUS_PROBLEMATIC_WITH_ERROR |
988 | USER_CONNECT_HOSTS_TO_LUN_FAILED |
989 | SYSTEM_CHANGE_STORAGE_POOL_STATUS_PROBLEMATIC_FROM_NON_OPERATIONAL |
990 | SYSTEM_MASTER_DOMAIN_NOT_IN_SYNC |
991 | RECOVERY_STORAGE_POOL |
992 | RECOVERY_STORAGE_POOL_FAILED |
993 | SYSTEM_CHANGE_STORAGE_POOL_STATUS_RESET_IRS |
994 | CONNECT_STORAGE_SERVERS_FAILED |
995 | CONNECT_STORAGE_POOL_FAILED |
996 | STORAGE_DOMAIN_ERROR |
1100 | NETWORK_UPDATE_DISPLAY_TO_HOST_GROUP |
1101 | NETWORK_UPDATE_DISPLAY_TO_HOST_GROUP_FAILED |
1102 | NETWORK_UPDATE_NETWORK_TO_HOST_INTERFACE |
1103 | NETWORK_UPDATE_NETWORK_TO_HOST_INTERFACE_FAILED |
1104 | NETWORK_COMMINT_NETWORK_CHANGES |
1105 | NETWORK_COMMINT_NETWORK_CHANGES_FAILED |
1106 | NETWORK_HOST_USING_WRONG_CLUSER_VLAN |
1107 | NETWORK_HOST_MISSING_CLUSER_VLAN |
1150 | IMPORTEXPORT_EXPORT_VM |
1151 | IMPORTEXPORT_EXPORT_VM_FAILED |
1152 | IMPORTEXPORT_IMPORT_VM |
1153 | IMPORTEXPORT_IMPORT_VM_FAILED |
1154 | IMPORTEXPORT_REMOVE_TEMPLATE |
1155 | IMPORTEXPORT_REMOVE_TEMPLATE_FAILED |
1156 | IMPORTEXPORT_EXPORT_TEMPLATE |
1157 | IMPORTEXPORT_EXPORT_TEMPLATE_FAILED |
1158 | IMPORTEXPORT_IMPORT_TEMPLATE |
1159 | IMPORTEXPORT_IMPORT_TEMPLATE_FAILED |
1160 | IMPORTEXPORT_REMOVE_VM |
1161 | IMPORTEXPORT_REMOVE_VM_FAILED |
1162 | IMPORTEXPORT_STARTING_EXPORT_VM |
1163 | IMPORTEXPORT_STARTING_IMPORT_TEMPLATE |
1164 | IMPORTEXPORT_STARTING_EXPORT_TEMPLATE |
1165 | IMPORTEXPORT_STARTING_IMPORT_VM |
1166 | IMPORTEXPORT_STARTING_REMOVE_TEMPLATE |
1167 | IMPORTEXPORT_STARTING_REMOVE_VM |
1168 | IMPORTEXPORT_FAILED_TO_IMPORT_VM |
1169 | IMPORTEXPORT_FAILED_TO_IMPORT_TEMPLATE |
9000 | HOST_ALERT_FENCING_IS_NOT_CONFIGURED |
9001 | HOST_ALERT_FENCING_TEST_FAILED |
9002 | HOST_ALERT_FENCING_OPERATION_FAILED |
9003 | HOST_ALERT_FENCING_OPERATION_SKIPPED |
9004 | HOST_ALERT_FENCING_NO_PROXY_HOST |
9500 | TASK_STOPPING_ASYNC_TASK |
9501 | TASK_CLEARING_ASYNC_TASK |
F.1. Timezones
Table F.1. Accepted tz database codes
| tz database Format | Windows Standard Format |
|---|---|
Africa/Cairo | Egypt Standard Time |
Africa/Casablanca | Morocco Standard Time |
Africa/Johannesburg | South Africa Standard Time |
Africa/Lagos | W. Central Africa Standard Time |
Africa/Nairobi | E. Africa Standard Time |
Africa/Reykjavik | Greenwich Standard Time |
Africa/Windhoek | Namibia Standard Time |
America/Anchorage | Alaskan Standard Time |
America/Bogota | SA Pacific Standard Time |
America/Buenos_Aires | Argentina Standard Time |
America/Caracas | Venezuela Standard Time |
America/Chicago | Central Standard Time |
America/Chihuahua | Mexico Standard Time |
America/Chihuahua | Mountain Standard Time |
America/Denver | Mountain Standard Time |
America/Godthab | Greenland Standard Time |
America/Guatemala | Central America Standard Time |
America/Halifax | Atlantic Standard Time |
America/La_Paz | SA Western Standard Time |
America/Los_Angeles | Pacific Standard Time |
America/Manaus | Central Brazilian Standard Time |
America/Mexico_City | Central Standard Time |
America/Mexico_City | Mexico Standard Time |
America/Montevideo | Montevideo Standard Time |
America/New_York | Eastern Standard Time |
America/Phoenix | US Mountain Standard Time |
America/Regina | Canada Central Standard Time |
America/Santiago | Pacific SA Standard Time |
America/Sao_Paulo | E. South America Standard Time |
America/St_Johns | Newfoundland Standard Time |
America/Tijuana | Pacific Standard Time |
Asia/Amman | Jordan Standard Time |
Asia/Baghdad | Arabic Standard Time |
Asia/Baku | Azerbaijan Standard Time |
Asia/Bangkok | SE Asia Standard Time |
Asia/Beirut | Middle East Standard Time |
Asia/Calcutta | India Standard Time |
Asia/Colombo | Sri Lanka Standard Time |
Asia/Dhaka | Central Asia Standard Time |
Asia/Dubai | Arabian Standard Time |
Asia/Irkutsk | North Asia East Standard Time |
Asia/Jerusalem | Israel Standard Time |
Asia/Kabul | Afghanistan Standard Time |
Asia/Karachi | Pakistan Standard Time |
Asia/Katmandu | Nepal Standard Time |
Asia/Krasnoyarsk | North Asia Standard Time |
Asia/Novosibirsk | N. Central Asia Standard Time |
Asia/Rangoon | Myanmar Standard Time |
Asia/Riyadh | Arab Standard Time |
Asia/Seoul | Korea Standard Time |
Asia/Shanghai | China Standard Time |
Asia/Singapore | Singapore Standard Time |
Asia/Taipei | Taipei Standard Time |
Asia/Tashkent | West Asia Standard Time |
Asia/Tehran | Iran Standard Time |
Asia/Tokyo | Tokyo Standard Time |
Asia/Vladivostok | Vladivostok Standard Time |
Asia/Yakutsk | Yakutsk Standard Time |
Asia/Yekaterinburg | Ekaterinburg Standard Time |
Asia/Yerevan | Armenian Standard Time |
Asia/Yerevan | Caucasus Standard Time |
Atlantic/Azores | Azores Standard Time |
Atlantic/Cape_Verde | Cape Verde Standard Time |
Atlantic/South_Georgia | Mid-Atlantic Standard Time |
Australia/Adelaide | Cen. Australia Standard Time |
Australia/Brisbane | E. Australia Standard Time |
Australia/Darwin | AUS Central Standard Time |
Australia/Hobart | Tasmania Standard Time |
Australia/Perth | W. Australia Standard Time |
Australia/Sydney | AUS Eastern Standard Time |
Etc/GMT-3 | Georgian Standard Time |
Etc/GMT+12 | Dateline Standard Time |
Etc/GMT+3 | SA Eastern Standard Time |
Etc/GMT+5 | US Eastern Standard Time |
Europe/Berlin | W. Europe Standard Time |
Europe/Budapest | Central Europe Standard Time |
Europe/Istanbul | GTB Standard Time |
Europe/Kiev | FLE Standard Time |
Europe/London | GMT Standard Time |
Europe/Minsk | E. Europe Standard Time |
Europe/Moscow | Russian Standard Time |
Europe/Paris | Romance Standard Time |
Europe/Warsaw | Central European Standard Time |
Indian/Mauritius | Mauritius Standard Time |
Pacific/Apia | Samoa Standard Time |
Pacific/Auckland | New Zealand Standard Time |
Pacific/Fiji | Fiji Standard Time |
Pacific/Guadalcanal | Central Pacific Standard Time |
Pacific/Honolulu | Hawaiian Standard Time |
Pacific/Port_Moresby | West Pacific Standard Time |
Pacific/Tongatapu | Tonga Standard Time |
| Revision History | |||||
|---|---|---|---|---|---|
| Revision 3.3-25 | Tue 19 May 2015 | ||||
| |||||
| Revision 3.3-24.1 | Tue 29 Apr 2014 | ||||
| |||||
| Revision 3.3-24 | Tue 25 Feb 2014 | ||||
| |||||
| Revision 3.3-23 | Wed 19 Feb 2014 | ||||
| |||||
| Revision 3.3-22 | Tue 11 Feb 2014 | ||||
| |||||
| Revision 3.3-21 | Thu 06 Feb 2014 | ||||
| |||||
| Revision 3.3-20 | Tue 21 Jan 2014 | ||||
| |||||
| Revision 3.3-19 | Mon 20 Jan 2014 | ||||
| |||||
| Revision 3.3-18 | Fri 17 Jan 2014 | ||||
| |||||
| Revision 3.3-17 | Fri 17 Jan 2014 | ||||
| |||||
| Revision 3.3-16 | Tue 17 Dec 2013 | ||||
| |||||
| Revision 3.3-15 | Fri 13 Dec 2013 | ||||
| |||||
| Revision 3.3-14 | Thu 12 Dec 2013 | ||||
| |||||
| Revision 3.3-13 | Fri 06 Dec 2013 | ||||
| |||||
| Revision 3.3-12 | Wed 04 Dec 2013 | ||||
| |||||
| Revision 3.3-11 | Tue 26 Nov 2013 | ||||
| |||||
| Revision 3.3-10 | Fri 22 Nov 2013 | ||||
| |||||
| Revision 3.3-9 | Thu 21 Nov 2013 | ||||
| |||||
| Revision 3.3-8 | Fri 15 Nov 2013 | ||||
| |||||
| Revision 3.3-7 | Thu 14 Nov 2013 | ||||
| |||||
| Revision 3.3-6 | Thu 14 Nov 2013 | ||||
| |||||
| Revision 3.3-5 | Tue 15 Oct 2013 | ||||
| |||||
| Revision 3.3-4 | Fri 11 Oct 2013 | ||||
| |||||
| Revision 3.3-3 | Tue 20 Aug 2013 | ||||
| |||||
| Revision 3.3-2 | Fri 09 Aug 2013 | ||||
| |||||
| Revision 3.3-1 | Thu 18 Jul 2013 | ||||
| |||||


