3.10. 实例:为数据中心附加存储域
以下实例把
data1 和 iso1 存储域附加到 Default 数据中心。
例 3.10. 为 Default 数据中心附加 data1 存储域
请求:
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 命令:
# 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
例 3.11. 为 Default 数据中心附加 iso1 存储域
请求:
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 命令:
# 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 请求在 Default 数据中的 storagedomains 子集合中放置两个新 storage_domain 资源。这意味着 storagedomains 子集合包括了附加到数据中心中的存储域。