12.7. Glance 镜像存储域
12.7.1. Glance 镜像存储域
类型被设置为
Image
的存储域代表了一个 OpenStack 镜像服务实例,它己经被添加到 Red Hat Enterprise Virtualization 环境中作为一个外部供应商。这些 Glance 镜像存储域包括了一个 images
子集合,它包括了可以导出到 Glance 镜像存储域或从 Glance 镜像存储域导入的虚拟机镜像。
例 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>