4.6. NFS データストレージの作成

NFS データストレージドメインは、データセンターに接続されたエクスポートされた NFS 共有であり、仮想化ゲストイメージのストレージを提供します。新規ストレージドメインを作成するには、ストレージドメイン表現が含まれる POST 要求をストレージドメインコレクションの URL に送信する必要があります。

ストレージドメインでは、デフォルトで削除後にワイプオプションを有効にできます。これを設定するには、POST 要求で wipe_after_delete を指定します。このオプションは、ドメインの作成後に編集できますが、その場合はすでに存在している wipe after delete プロパティーは変更されません。

要求は以下のようになります。

POST /ovirt-engine/api/storagedomains HTTP/1.1
Accept: application/xml
Content-type: application/xml

また、リクエスト本文は以下のようになります。

<storage_domain>
  <name>mydata</name>
  <type>data</type>
  <description>My data</description>
  <storage>
    <type>nfs</type>
    <address>mynfs.example.com</address>
    <path>/exports/mydata</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>mydata</name>
  <description>My data</description>
  <type>data</type>
  <storage>
    <type>nfs</type>
    <address>mynfs.example.com</address>
    <path>/exports/mydata</path>
  </storage>
  <host>
    <name>myhost</name>
  </host>
</storage_domain>
' \
https://myengine.example.com/ovirt-engine/api/storagedomains

サーバーはホスト myhost を使用して、mynfs.example.com:/exports/mydata のエクスポートパスで mydata という名前の NFS データストレージドメインを作成します。API は (StorageDomain タイプの) 新規作成されたストレージドメインリソースについて以下の表現も返します。

<storage_domain href="/ovirt-engine/api/storagedomains/005" id="005">
  <name>mydata</name>
  <description>My data</description>
  <available>42949672960</available>
  <committed>0</committed>
  <master>false</master>
  <status>unattached</status>
  <storage>
    <address>mynfs.example.com</address>
    <path>/exports/mydata</path>
    <type>nfs</type>
  </storage>
  <storage_format>v3</storage_format>
  <type>data</type>
  <used>9663676416</used>
</storage_domain>