此操作用来创建克隆卷。
前提条件:用于创建克隆卷的快照,其状态必须是Normal。
说明
系统支持的最大克隆卷数:100000。
单个快照可创建的最大克隆卷数:512。
系统支持的最大克隆深度:16。
请求语法
单机版
POST /rest/v1/block/lun/clone HTTP/1.1
Date:date
Content-Type: application/json; charset=utf-8
Content-Length: length
Host: ip:port
Authorization: authorization
{
"lunName": lunName,
"snapshotName": snapshotName,
"targetName": targetName,
"capacity": capacity,
"config": {
"sectorSize": sectorSize,
"writePolicy": writePolicy,
"qosPolicy": {
"qosName": qosName,
"IOPS": IPOS,
"readIOPS": readIOPS,
"writeIOPS": writeIOPS,
"Bps": Bps,
"readBps": readBps,
"writeBps": writeBps,
"IOPSBurst": IOPSBurst,
"readIOPSBurst": readIOPSBurst,
"writeIOPSBurst": writeIOPSBurst,
"BpsBurst": BpsBurst,
"readBpsBurst": readBpsBurst,
"writeBpsBurst": writeBpsBurst,
"IOPSBurstSecs": IOPSBurstSecs,
"readIOPSBurstSecs": readIOPSBurstSecs,
"writeIOPSBurstSecs": writeIOPSBurstSecs,
"BpsBurstSecs": BpsBurstSecs,
"readBpsBurstSecs": readBpsBurstSecs,
"writeBpsBurstSecs": writeBpsBurstSecs
},
"path": path
}
}集群版
POST /rest/v1/block/lun/clone HTTP/1.1
Date:date
Content-Type: application/json; charset=utf-8
Content-Length: length
Host: ip:port
Authorization: authorization
{
"lunName": lunName,
"snapshotName": snapshotName,
"targetName": targetName,
"capacity": capacity,
"config": {
"localStorageClass": localStorageClass,
"minReplica": minReplica,
"ECfragmentSize": ECfragmentSize,
"redundancyOverlap": redundancyOverlap,
"sectorSize": sectorSize,
"cachePool": poolName,
"pool": poolName,
"highAvailability": highAvailability,
"writePolicy": writePolicy,
"serverAffinity": {
"autoFailback": autoFailback,
"priority": [
SeverID,ServerID…
]
},
"qosPolicy": {
"qosName": qosName,
"IOPS": IPOS,
"readIOPS": readIOPS,
"writeIOPS": writeIOPS,
"Bps": Bps,
"readBps": readBps,
"writeBps": writeBps,
"IOPSBurst": IOPSBurst,
"readIOPSBurst": readIOPSBurst,
"writeIOPSBurst": writeIOPSBurst,
"BpsBurst": BpsBurst,
"readBpsBurst": readBpsBurst,
"writeBpsBurst": writeBpsBurst,
"IOPSBurstSecs": IOPSBurstSecs,
"readIOPSBurstSecs": readIOPSBurstSecs,
"writeIOPSBurstSecs": writeIOPSBurstSecs,
"BpsBurstSecs": BpsBurstSecs,
"readBpsBurstSecs": readBpsBurstSecs,
"writeBpsBurstSecs": writeBpsBurstSecs
}
}
}参数 | 类型 | 描述 | 是否必须 |
|---|---|---|---|
lunName | String | 克隆卷名称。 | 是 |
| snapshotName | String | 指定克隆卷关联的快照名称。 | 是 |
| targetName | String | 指定克隆卷关联的iSCSI target名称,可以跟源卷的iSCSI target不同。 说明 创建卷时,如果指定的target名称不存在,那么同时创建iSCSI target,新创建iSCSI target的回收策略默认为Delete。 取值:长度范围是1~16,可以由小写字母、数字、句点(.)和短横线(-)组成,且仅支持以字母或数字开头。 | 是 |
| capacity | Integer | 指定克隆卷的容量。 | 否 |
| config.localStorageClass | String | 指定克隆卷的冗余模式(仅集群版支持)。 注意 如果设置了克隆卷的minReplica或redundancyOverlap,则必须同时指定该参数。 取值:
说明(以下场景均为集群可用的前提下):
| 否 |
config.minReplica | Integer | 指定克隆卷的最小副本数(仅集群版支持)。 注意 如果指定该参数,则必须指定克隆卷的localStorageClass。 对于副本模式的卷,假设卷副本数为X,最小副本数为Y(Y必须≤X),该卷每次写入时,至少Y份数据写入成功,才视为本次写入成功。对于EC N+M模式的卷,假设该卷最小副本数设置为Y(必须满足N≤Y≤N+M),必须满足总和至少为Y的数据块和校验块写入成功,才视为本次写入成功。 取值:
| 否 |
config.ECfragmentSize | Integer | 指定克隆卷的纠删码模式分片大小(仅集群版支持)。 | 否 |
| config.redundancyOverlap | Integer | 指定克隆卷的折叠副本数(仅集群版支持)。在数据冗余模式下,同一份数据的不同副本/分片默认分布在不同的故障域,当故障域损坏时,允许根据卷的冗余折叠原则,将多份数据副本放在同一个故障域中,但是分布在不同的path上。 注意 如果存储池故障域级别为path,此参数不生效。如果指定该参数,则必须指定克隆卷的localStorageClass。 取值:
| 否 |
| config.sectorSize | Integer | 指定克隆卷的扇区大小。 说明 扇区大小的选取:根据自身业务场景,一般情况下,单次I/O操作的数据大小大于或接近4KiB,则推荐选择4096;单次I/O操作的数据大小接近512Bytes,则推荐选择512。如果对接VMware等虚拟化平台,则推荐选择512。 | 否 |
| config.cachePool | String | 指定缓存存储池(仅集群版支持)。 注意
| 否 |
| config.pool | String | 指定存储池(仅集群版支持)。 注意
| 否 |
| config.highAvailability | String | 指定克隆卷的高可用类型(仅集群版支持)。
默认值为源卷的高可用类型。 | 否 |
| config.writePolicy | String | 指定克隆卷的写策略。
默认为源卷的写策略。 | 否 |
| config.serverAffinity | Object | 卷主备分布优先级设置,详见“表1 请求参数config.serverAffinity说明”。 | 否 |
| config.qosPolicy | Object | 卷关联的QoS策略信息,详见“表2 请求参数config.qosPolicy说明”。 | 否 |
| config.path | String | 指定存储克隆卷数据的数据目录(仅单机版支持)。 | 否 |
表1 请求参数config.serverAffinity说明
| 参数 | 类型 | 描述 | 是否必须 |
|---|---|---|---|
autoFailback | String | 是否根据指定的克隆卷主备分布优先级自动进行主备切换(仅集群版支持),即针对卷主备状态,当高优先级的服务器恢复正常后,是否自动进行主备状态切换。
默认值为Enabled。 | 否 |
priority | Array of string | 指定卷主备分布优先级的服务器ID(仅集群版支持),系统根据指定的服务器ID顺序来选择卷的主备IQN。可以指定一个或者多个服务器ID,以英文逗号分开。 | 否 |
表2 请求参数config.qosPolicy说明
| 参数 | 类型 | 描述 | 是否必须 |
|---|---|---|---|
| qosName | String | 指定QoS策略名称。 说明 创建卷时,如果指定QoS策略名称不存在,那么同时创建QoS策略,新创建的QoS策略的回收策略默认为Delete。 对于集群版,不指定QoS策略时:
取值:长度范围1~64,只能由字母、数字和短横线(-)组成,区分大小写,且仅支持以字母或数字开头。 注意
| 是 |
| IOPS | Long | 每秒能够进行读写操作次数的最大值。 取值:取值范围为[-1, 999999999],默认值为-1。-1表示不限制。 | 否 |
| readIOPS | Long | 每秒能够进行读操作次数的最大值。 取值:取值范围为[-1, 999999999],默认值为-1。-1表示不限制。 | 否 |
| writeIOPS | Long | 每秒能够进行写操作次数的最大值。 取值:取值范围为[-1, 999999999],默认值为-1。-1表示不限制。 | 否 |
| Bps | Long | 每秒可传输数据量的最大值。 取值:取值范围为[-1, 4096000000000],默认值为-1,单位是Bytes/s。-1表示不限制。 | 否 |
| readBps | Long | 读带宽上限。 取值:取值范围为[-1, 4096000000000],默认值为-1,单位是Bytes/s。-1表示不限制。 | 否 |
| writeBps | Long | 写带宽上限。 取值:取值范围为[-1, 4096000000000],默认值为-1,单位是Bytes/s。-1表示不限制。 | 否 |
| IOPSBurst | Long | 使用Burst功能时,每秒能够进行读写操作次数的最大值。 取值:只有当IOPS大于等于1时,此项设置为-1或(IOPS, 999999999]内的正整数方可生效。默认值为-1,表示不限制。 | 否 |
| readIOPSBurst | Long | 使用Burst功能时,每秒能够进行读操作次数的最大值。 取值:只有当readIOPS大于等于1时,此项设置为-1或(readIOPS, 999999999]内的正整数方可生效。默认值为-1,表示不限制。 | 否 |
| writeIOPSBurst | Long | 使用Burst功能时,每秒能够进行写操作次数的最大值。 取值:只有当writeIOPS大于等于1时,此项设置为-1或(writeIOPS, 999999999]内的正整数方可生效。默认值为-1,表示不限制。 | 否 |
| BpsBurst | Long | 使用Burst功能时,每秒可传输的数据量最大值。 取值:只有当Bps大于等于1时,此项设置为-1或(Bps, 4096000000000]内的正整数方可生效,默认值为-1,单位是Bytes/s。-1表示不限制。 | 否 |
| readBpsBurst | Long | 使用Burst功能时,读带宽上限。 取值:只有当readBps大于等于1时,此项设置为-1或(readBps, 4096000000000]内的正整数方可生效,默认值为-1,单位是Bytes/s。-1表示不限制。 | 否 |
| writeBpsBurst | Long | 使用Burst功能时,写带宽上限。 取值:只有当writeBps大于等于1时,此项设置为-1或(writeBps, 4096000000000]内的正整数方可生效,默认值为-1,单位是Bytes/s。-1表示不限制。 | 否 |
| IOPSBurstSecs | Long | 使用Burst功能时,按照Burst上限的能力进行读写操作所能持续的时间。 注意 只有在IOPS Burst功能启用时,此配置才生效。 取值:取值范围为[1, 999999999],默认值为1,单位是秒。 | 否 |
| readIOPSBurstSecs | Long | 使用Burst功能时,按照Burst上限的能力进行读操作所能持续的时间。 注意 只有在read IOPS Burst功能启用时,此配置才生效。 取值:取值范围为[1, 999999999],默认值为1,单位是秒。 | 否 |
| writeIOPSBurstSecs | Long | 使用Burst功能时,按照Burst上限的能力进行写操作所能持续的时间。 注意 只有在write IOPS Burst功能启用时,此配置才生效。 取值:取值范围为[1, 999999999],默认值为1,单位是秒。 | 否 |
| BpsBurstSecs | Long | 使用Burst功能时,按照Burst上限的流量能力所能持续的时间。 注意 只有在Bps Burst功能启用时,此配置才生效。 取值:取值范围为[1, 999999999],默认值为1,单位是秒。 | 否 |
| readBpsBurstSecs | Long | 使用Burst功能时,按照Burst上限的读流量能力所能持续的时间,单位是秒。 注意 只有在read Bps Burst功能启用时,此配置才生效。 取值:取值范围为[1, 999999999],默认值为1,单位是秒。 | 否 |
| writeBpsBurstSecs | Long | 使用Burst功能时,按照Burst上限的写流量能力所能持续的时间。 注意 只有在write Bps Burst功能启用时,此配置才生效。 取值:取值范围为[1, 999999999],默认值为1,单位是秒。 | 否 |
响应结果
| 名称 | 类型 | 描述 |
|---|---|---|
| iSCSITargets | Array of iSCSITarget | iSCSI target属性集合,详见“表3 响应参数iSCSITarget说明”。 |
| cloneDepth | Integer | 克隆卷的深度。 |
表3 响应参数iSCSITarget说明
| 名称 | 类型 | 描述 |
|---|---|---|
iqn | String | iSCSI target IQN。 |
| status | String | 克隆卷对应的Target的状态:
|
| ips | Array of ip | iSCSI target的IP属性集合,详见“表4 响应参数ip说明”。 |
| serverId | String | 服务器ID。 |
表4 响应参数ip说明
| 名称 | 类型 | 描述 |
|---|---|---|
| ip | String | iSCSI target的IP。 |
| port | Integer | iSCSI target的端口号。 |
请求示例1
单机版:创建克隆卷luna1-C2。
POST /rest/v1/block/lun/clone HTTP/1.1
Date: Tue, 11 Mar 2025 06:55:43 GMT
Content-Type: application/json; charset=utf-8
Authorization: HBlock userName:signature
Connection: keep-alive
Content-Length: 211
Host:192.168.0.66:1443
{
"lunName": "luna1-C2",
"snapshotName": "luna1-snap4",
"targetName": "targeta",
"capacity": 500,
"config": {
"sectorSize": 512,
"writePolicy": "WriteThrough"
}
}响应示例1
HTTP/1.1 200 OK
x-hblock-request-id: 1e3c374dc4044830828d69d3657d996a
Connection: keep-alive
Content-Length: 172
Date: Tue, 11 Mar 2025 06:55:43 GMT
Content-Type: application/json;charset=utf-8
Server: HBlock
{
"data": {
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:targeta.1",
"status": "Active",
"ips": [
{
"ip": "192.168.0.66",
"port": 3260
}
],
"serverId": "hblock_1"
}
],
"cloneDepth": 1
}
}请求示例2
集群版:创建克隆卷lun02-clone-6。
POST /rest/v1/block/lun/clone HTTP/1.1
Date: Tue, 11 Mar 2025 06:41:03 GMT
Content-Type: application/json; charset=utf-8
Authorization: HBlock userName:signature
Connection: keep-alive
Content-Length: 559
Host:192.168.0.64:1443
{
"lunName": "lun02-clone-6",
"snapshotName": "lun02-snap20250304170942",
"targetName": "target02",
"capacity": 500,
"config": {
"localStorageClass": "EC 2+1",
"ECfragmentSize": 1024,
"sectorSize": 512,
"cachePool": "default",
"pool": "pool2",
"highAvailability": "ActiveStandby",
"writePolicy": "WriteThrough",
"serverAffinity": {
"autoFailback": "Enabled",
"priority": [
"hblock_1"
]
}
}
}响应示例2
HTTP/1.1 200 OK
x-hblock-request-id: 379a264ec280457ea92a44ba3e0413eb
Connection: keep-alive
Content-Length: 314
Date: Tue, 11 Mar 2025 06:41:03 GMT
Content-Type: application/json;charset=utf-8
Server: HBlock
{
"data": {
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target02.3",
"status": "Unavailable",
"ips": [
{
"ip": "192.168.0.65",
"port": 3260
}
],
"serverId": "hblock_1"
},
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target02.4",
"status": "Unavailable",
"ips": [
{
"ip": "192.168.0.64",
"port": 3260
}
],
"serverId": "hblock_2"
}
],
"cloneDepth": 1
}
}