12.7. Glance イメージストレージドメイン

12.7.1. Glance イメージストレージドメイン

タイプが Image に設定されたストレージドメインは、外部プロバイダーとして Red Hat Enterprise Virtualization 環境に追加された OpenStack の Image Service のインスタンスを表します。これらの Glance イメージストレージドメインには、Glance イメージストレージドメインへエクスポートされた仮想マシンイメージまたはこのドメインからインポート可能な仮想マシンイメージを含む images サブコレクションが含まれています。

例12.12 Glance イメージストレージドメインのイメージサブコレクションの一覧表示

GET /api/storagedomains/00000000-0000-0000-0000-000000000000/images
Accept: application/xml

HTTP/1.1 200 OK
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<images>
  <image href="/api/storagedomains/00000000-0000-0000-0000-000000000000/images/
    00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000">
    <actions>
      <link href="/api/storagedomains/00000000-0000-0000-0000-000000000000/images/
        00000000-0000-0000-0000-000000000000/import" rel="import"/>
    </actions>
    <name>RHEL_65_Disk_001</name>
    <storage_domain href="/api/storagedomains/00000000-0000-0000-0000-000000000000"
      id="00000000-0000-0000-0000-000000000000"/>
  </image>
  <image href="/api/storagedomains/00000000-0000-0000-0000-000000000000/images/
    00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000">
    <actions>
      <link href="/api/storagedomains/00000000-0000-0000-0000-000000000000/images/
        00000000-0000-0000-0000-000000000000/import" rel="import"/>
    </actions>
    <name>RHEL_65_Disk_002</name>
    <storage_domain href="/api/storagedomains/00000000-0000-0000-0000-000000000000"
      id="00000000-0000-0000-0000-000000000000"/>
  </image>
</images>
import アクションは、Glance イメージストレージドメインから仮想マシンのイメージをインポートします。インポート先のストレージドメインは、storage_domain 参照で、インポート先のクラスターは cluster で指定します。
仮想マシンまたはテンプレートに固有の名前を付ける場合は、オプションの name 要素を追加します。

例12.13 Glance イメージストレージドメインから仮想マシンをインポートするアクション

POST /api/storagedomains/00000000-0000-0000-000000000000/images/
00000000-0000-0000-000000000000/import HTTP/1.1
Accept: application/xml
Content-type: application/xml

<action>
    <storage_domain>
        <name>images0</name>
    </storage_domain>
    <cluster>
        <name>images0</name>
    </cluster>
</action>
また、import_as_template 参照を指定して、イメージをテンプレートとしてインポートすることも可能です。

例12.14 Glance イメージストレージドメインから仮想マシンをテンプレートとしてインポートするアクション

POST /api/storagedomains/00000000-0000-0000-000000000000/images/
00000000-0000-0000-000000000000/import HTTP/1.1
Accept: application/xml
Content-type: application/xml

<action>
    <storage_domain>
        <name>images0</name>
    </storage_domain>
    <cluster>
        <name>images0</name>
    </cluster>
    </import_as_template>true</import_as_template>
</action>