4.7. 创建 NFS ISO 存储
NFS ISO 存储域是连接到数据中心的已挂载 NFS 共享,为 DVD/CD-ROM ISO 和虚拟软盘(VFD)镜像文件提供存储。创建新存储域需要 POST 请求
,其中包含存储域表示法,并将其发送到存储域集合的 URL:
请求应类似如下:
POST /ovirt-engine/api/storagedomains HTTP/1.1 Accept: application/xml Content-type: application/xml
请求正文应类似如下:
<storage_domain> <name>myisos</name> <description>My ISOs</description> <type>iso</type> <storage> <type>nfs</type> <address>mynfs.example.com</address> <path>/exports/myisos</path> </storage> <host> <name>myhost</name> </host> </storage_domain>
同一个请求,使用 curl
命令:
# curl \ --cacert '/etc/pki/ovirt-engine/ca.pem' \ --user 'admin@internal:mypassword' \ --request POST \ --header 'Version: 4' \ --header 'Content-Type: application/xml' \ --header 'Accept: application/xml' \ --data ' <storage_domain> <name>myisos</name> <description>My ISOs</description> <type>iso</type> <storage> <type>nfs</type> <address>mynfs.example.com</address> <path>/exports/myisos</path> </storage> <host> <name>myhost</name> </host> </storage_domain> ' \ https://myengine.example.com/ovirt-engine/api/storagedomains
服务器使用主机 myhost
创建名为 myisos
的 NFS ISO 存储域,其导出路径为 mynfs.example.com:/exports/myisos
。该 API 还返回以下表示新创建的存储域资源(类型为 StorageDomain):
<storage_domain href="/ovirt-engine/api/storagedomains/006" id="006"> <name>myiso</name> <description>My ISOs</description> <available>42949672960</available> <committed>0</committed> <master>false</master> <status>unattached</status> <storage> <address>mynfs.example.com</address> <path>/exports/myisos</path> <type>nfs</type> </storage> <storage_format>v1</storage_format> <type>iso</type> <used>9663676416</used> </storage_domain>