此内容没有您所选择的语言版本。
12.6. Export Storage Domains
12.6.1. Export Storage Domains 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Note
The export storage domain is deprecated. Storage data domains can be unattached from a data center and imported to another data center in the same environment, or in a different environment. Virtual machines, floating virtual disk images, and templates can then be uploaded from the imported storage domain to the attached data center. See the Importing Existing Storage Domains section in the Red Hat Virtualization Administration Guide for information on importing 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.
Example 12.6. Listing the virtual machines sub-collection of an export storage domain
GET /ovirt-engine/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="/ovirt-engine/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="/ovirt-engine/api/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed"/>
<actions>
<link rel="import" href="/ovirt-engine/api/storagedomains/
fabe0451-701f-4235-8f7e-e20e458819ed/vms/
082c794b-771f-452f-83c9-b2b5a19c0399/import"/>
</actions>
</vm>
</vms>
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.
The
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.
Include an optional
name element to give the virtual machine or template a specific name.
Example 12.7. Action to import a virtual machine from an export storage domain
POST /ovirt-engine/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.8. Action to import a template from an export storage domain
POST /ovirt-engine/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>
Include an optional
clone Boolean element to import the virtual machine as a new entity.
Example 12.9. Action to import a virtual machine as a new entity
POST /ovirt-engine/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>
Include an optional
disks element to choose which disks to import using individual disk id elements.
Example 12.10. Selecting disks for an import action
POST /ovirt-engine/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>
Delete a virtual machine or template from an
export storage domain with a DELETE request.
Example 12.11. Delete virtual machine from an export storage domain
DELETE /ovirt-engine/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