API 为用户提供了在不需要对存储设备进行重新格式化,就可以从一个 Red Hat Enterprise Virtualization Manager 实例上删除一个 ISO 存储域或导出存储域,并把它导入到其它实例上的功能。导入操作和添加新存储域的过程相似,唯一的不同是不需要指定 name
。
例 12.16. 导入一个存在的存储域。
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>
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>
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
在 DELETE
请求的内容中使用 storage_domain
指定要被删除的存储域。storage_domain
使用以下格式:
<storage_domain>
<host id="..."/>
</storage_domain>
<storage_domain>
<host id="..."/>
</storage_domain>
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
或
<storage_domain>
<host>
<name>...</name>
</host>
</storage_domain>
<storage_domain>
<host>
<name>...</name>
</host>
</storage_domain>
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
格式化存储域
API 包括了一个可选的 format
项来指定在删除后是否对存储域进行格式化。
例 12.17. 在删除后格式化存储域
<storage_domain>
<host id="..."/>
<format>true</format>
</storage_domain>
<storage_domain>
<host id="..."/>
<format>true</format>
</storage_domain>
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
如果没有使用 format
项,存储域将不会被格式化。
逻辑删除存储域
API 提供了一个逻辑删除存储域的功能(存储域的数据会被保存,并可以被用来进行其它的导入操作)。使用 destroy
项来逻辑删除存储域并保留它上面的数据。
例 12.18. 逻辑删除一个存储域
<storage_domain>
<host id="..."/>
<destroy>true</destroy>
</storage_domain>
<storage_domain>
<host id="..."/>
<destroy>true</destroy>
</storage_domain>
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow