The following table shows specific elements contained in a data center resource representation.
9.1. Storage Domains Sub-Collection
Each data center contains a sub-collection for attached storages domain. A data center is only ready for use when at least one storage domain is attached, which an API user accomplishes when POST
ing a representation of the desired storage domain to the data center's storage domains sub-collection.
An attached storage domain has a similar representation to a top-level storage domain, with the exception that it has a data center specific status and set of actions.
When attaching a storage domain, its ID or name must be supplied. An example of attaching a storage domain to a data center:
Example 9.4. Attach a storage domain to a data center
POST /rhevm-api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains HTTP/1.1
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="/rhevm-api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/
fabe0451-701f-4235-8f7e-e20e458819ed">
<name>images0</name>
<type>data</type>
<status>INACTIVE</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="/rhevm-api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4"/>
<actions>
<link rel="activate"
href="/rhevm-api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/
storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/activate"/>
<link rel="deactivate"
href="/rhevm-api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/
storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/deactivate"/>
</actions>
</storage_domain>
There are two possible actions for attached storage domains: activate
and deactivate
.
An attached storage domain is activated on a data center before use. The activate action does not take any action specific parameters.
Example 9.5. Action to active a storage domain on a datacenter
POST /rhevm-api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/activate HTTP/1.1
Content-type: application/xml
An attached storage domain is deactivated on a data center before removal. The deactivate action does not take any action specific parameters.
Example 9.6. Action to deactive a storage domain on a datacenter
POST /rhevm-api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/deactivate HTTP/1.1
Content-type: application/xml
9.1.3. Export Storage Domains
Storage domains with type
set to export
contain vms
and templates
sub-collections which list the import candidate VMs and templates stored on that particular storage domain.
VMs and templates in these collections have a similar representation to their counterparts in the top-level VMs and templates collection, except they also contain a
storage_domain
reference and an
import
action (see
Section 14.6.8, “ Import Action ”).
Example 9.7. Listing the virtual machines sub-collection of an export storage domain on a datacenter
GET /rhevm-api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/vms
Accept: application/xml
<vms>
<vm id="082c794b-771f-452f-83c9-b2b5a19c0399"
href="/rhevm-api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/
fabe0451-701f-4235-8f7e-e20e458819ed/vms/082c794b-771f-452f-83c9-b2b5a19c0399">
<name>vm1</name>
...
<storage_domain id="082c794b-771f-452f-83c9-b2b5a19c0399"
href="/rhevm-api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/
storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed"/>
<actions>
<link rel="import" href="/rhevm-api/datacenters/
d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/
fabe0451-701f-4235-8f7e-e20e458819ed/vms/
082c794b-771f-452f-83c9-b2b5a19c0399/import"/>
</actions>
</vm>
</vms>