12.6. 导出存储域
12.6.1. 导出存储域
注意
导出存储域已弃用。存储数据域可以从数据中心取消附加,并导入到同一环境中或不同环境中的其他数据中心。然后,可以将虚拟机、浮动虚拟磁盘镜像和模板从导入的存储域上传到附加的数据中心。有关 导入存储域 的信息,请参阅 Red Hat Virtualization 管理指南中的 导入现有存储域部分。
设置为
export
的存储域包含 vms
和 templates
子集合,它列出了存储在该特定存储域上的导入候选虚拟机和模板。
例 12.6. 列出导出存储域的虚拟机子集合
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>
这些集合中的虚拟机和模板在顶级虚拟机和模板集合中对应部分具有相似的表示,但它们还包含
storage_domain
引用和 导入操作
。
导入操作
从 导出存储域
导入虚拟机或模板。目标集群和存储域使用 cluster
和 storage_domain
引用来指定。
包括一个可选
name
元素,为虚拟机或模板指定特定名称。
例 12.7. 从导出存储域导入虚拟机的操作
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>
例 12.8. 从导出存储域导入模板的操作
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>
包含可选的
克隆
布尔值元素,以导入虚拟机为新实体。
例 12.9. 将虚拟机导入为新实体的操作
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>
包括一个可选的
disk 元素,用于选择使用独立磁盘 id
元素导入的 磁盘
。
例 12.10. 为导入操作选择磁盘
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
请求从 导出存储域中
删除虚拟机或模板。
例 12.11. 从导出存储域中删除虚拟机
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