3.8. 示例:创建 NFS ISO 存储
NFS ISO 存储域是附加到数据中心挂载的 NFS 共享,并为 DVD/CD-ROM ISO 和虚拟软盘磁盘(VFD)镜像文件提供存储。创建新存储域需要
POST
请求,其中包含存储域表示,发送到存储域集合的 URL。
您可以在存储域中默认启用 wipe after delete 选项。要配置此功能,请在
POST
请求中指定 < wipe_after_delete
>。可以在创建域后编辑此选项,但是这样做不会在删除已存在的磁盘属性后更改擦除。
例 3.8. 创建 NFS ISO 存储域
request:
POST /ovirt-engine/api/storagedomains HTTP/1.1 Accept: application/xml Content-type: application/xml <storage_domain> <name>iso1</name> <type>iso</type> <storage> <type>nfs</type> <address>192.168.0.10</address> <path>/iso1</path> </storage> <host> <name>hypervisor</name> </host> </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><type>iso</type> \ <storage><type>nfs</type><address>192.168.0.10</address> \ <path>/iso1</path></storage> \ <host><name>hypervisor</name></host></storage_domain>" \ https://[RHEVM Host]:443/ovirt-engine/api/storagedomains
API 创建一个称为
iso1
的 NFS iso 存储域,其导出路径为 192.168.0.10:/iso1,并通过 虚拟机监控程序主机
访问存储域。API 也返回新创建的存储域资源的以下表示。
结果:
HTTP/1.1 200 OK Accept: application/xml <storage_domain id="00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da" href="/ovirt-engine/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da"> <name>iso1</name> <link rel="permissions" href="/ovirt-engine/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/ permissions"/> <link rel="files" href="/ovirt-engine/api/storagedomains/00f0d9ce-da15-4b9e-9e3e-3c898fa8b6da/files"/> <type>iso</type> <host id="" href=""> <master>false</master> <storage> <type>nfs</type> <address>192.168.0.10</address> <path>/iso1</path> </storage> <available>82678120448</available> <used>18253611008</used> <committed>0</committed> <storage_format>v1</storage_format> <host id="0656f432-923a-11e0-ad20-5254004ac988" href="/ovirt-engine/api/hosts/0656f432-923a-11e0-ad20-5254004ac988"> </storage_domain>