3.2. 格式
目前支持 原生
、qcow
和 raw
格式。
您可以使用 native
格式在 Red Hat Ceph Storage 集群中描述作为源镜像的原生 RBD 镜像。source-spec
JSON 文档以以下方式进行编码:
语法
{ "type": "native", ["cluster_name": "<cluster-name>",] (specify if image in another cluster, requires<cluster-name>.conf
file) ["client_name": "<client-name>",] (for connecting to another cluster, default isclient.admin
) "pool_name": "POOL_NAME", ["pool_id": "POOL_ID",] (optional, alternative to "POOL_NAME" key) ["pool_namespace": "POOL_NAMESPACE",] (optional) "image_name": "IMAGE_NAME>", ["image_id": "IMAGE_ID",] (specify if image is in trash) "snap_name": "SNAP_NAME", ["snap_id": "SNAP_ID",] (optional, alternative to "SNAP_NAME" key) }
请注意,native
格式不包括 stream 对象,因为它使用了原生 Ceph 操作。例如,若要从镜像 rbd/ns1/image1@snap1
导入,可以使用 source-spec
进行编码:
示例
{ "type": "native", "pool_name": "rbd", "pool_namespace": "ns1", "image_name": "image1", "snap_name": "snap1" }
您可以使用 qcow
格式描述 QEMU copy-on-write(QCOW)块设备。目前支持 QCOW v1 和 v2 格式,除了压缩、加密、备份文件和外部数据文件等高级功能外。您可以将 qcow
格式数据链接到任何支持的流源:
示例
{ "type": "qcow", "stream": { "type": "file", "file_path": "/mnt/image.qcow" } }
您可以使用 raw
格式来描述 thick-provisioned 原始块设备导出,它是 rbd export –export-format 1 SNAP_SPEC
。您可以将 raw
格式数据链接到任何支持的流源:
示例
{ "type": "raw", "stream": { "type": "file", "file_path": "/mnt/image-head.raw" }, "snapshots": [ { "type": "raw", "name": "snap1", "stream": { "type": "file", "file_path": "/mnt/image-snap1.raw" } }, ] (optional oldest to newest ordering of snapshots) }
包括 snapshots
数组是可选的,目前只支持 thick-provisioned raw 快照导出。