此操作用来批量查询卷。可以通过设置过滤条件和range范围进行查询。如果未设置过滤条件和range范围,则查询所有的卷。
请求语法
GET /rest/v1/block/lun?filter=filter&range=i-j HTTP/1.1
Date: date
Host: ip:port
Authorization: authorization
请求参数
参数 | 类型 | 描述 | 是否必须 |
---|---|---|---|
filter | String | 查询的过滤条件。可以选择多个查询,如果是或的关系,使用“or”将查询条件分隔开;如果是与的关系,使用“and”将查询条件分隔开。 支持的过滤条件类型包括:
| 否 |
range | String | 查询卷的范围,格式为i-j,i和j为正整数,0 < j-i < 1000。按照卷名称进行排序,返回第i到第j的卷。如果输入的查询范围超过卷的总个数,返回的结果为空,如果未指定range,则返回所有符合条件的卷。 | 否 |
响应结果
名称 | 类型 | 描述 |
---|---|---|
luns | Array of lun | 卷信息集合,详见“表1 响应参数lun说明”。 |
表1 响应参数lun说明
名称 | 类型 | 描述 |
---|---|---|
lunName | String | 卷名称。 |
status | String | 卷的状态:
Flattening:与快照的关系链断开过程中,表示克隆卷正在复制源卷的数据,复制完成之后将变成独立卷,不再依赖快照和源卷。 |
recoverFailedReason | String | 卷还原失败的原因。 仅卷状态为RecoverFailed时显示。 |
deleteFailedReason | String | 卷云上数据删除失败的原因。 仅卷状态为DeleteFailed时显示。 |
storageMode | String | 卷的存储类型:
|
capacity | Integer | 卷容量,单位是GiB。 |
createTime | Long | 卷创建时间。unix时间戳(UTC),精确到毫秒。 |
iSCSITargets | Array of iSCSITarget | iSCSI Target属性集合。包含:iqn、status、ips、serverId,详见“表2响应参数说明iSCSITarget”。 |
cloud.bucketName | String | OOS存储桶的名称(仅上云卷支持)。 |
cloud.endpoint | String | OOS Endpoint(仅上云卷支持)。 |
cloud.signVersion | String | 上云签名认证的类型(仅上云卷支持):
|
cloud.region | String | Endpoint资源池所在区域(仅上云卷支持)。 |
cloud.provider | String | 对象存储服务名称:
|
config.minReplica | Integer | 卷的最小副本数(仅集群版支持)。 |
config.sectorSize | Integer | 扇区大小:
|
config.highAvailability | String | 高可用模式类型(仅集群版支持):
|
config.writePolicy | String | 卷的写策略:
|
config.cachePool | String | 缓存存储池(仅集群版支持)。 |
config.pool | String | 存储池(仅集群版支持),表示最终存储池,卷数据最终落在该存储池内。 |
config.redundancyOverlap | Integer | 卷的折叠副本数(仅集群版支持)。 |
config.reclaimPolicy | String | 卷回收策略:
|
config.serverAffinity | List of serverAffinity | 卷主备分布优先级设置,详见“表4 响应参数config.serverAffinity说明”。 |
config.ECfragmentSize | String | 分片大小。如果冗余模式为EC N+M,则会返回此项。 |
config.path | String | 数据目录(仅单机版支持)。 |
number | String | 卷编号。 |
isClone | Boolean | 是否是克隆卷:
|
sourceSnapshotName | String | 对应的快照名称(仅克隆卷支持)。 |
sourceLunName | String | 克隆卷的源卷名称(仅克隆卷支持)。 |
Snapshots.snapshotNumbers | Integer | 卷快照的数量(仅本地卷支持)。 |
WWID | String | 卷的唯一标识符。 |
表2 响应参数iSCSITarget说明
名称 | 类型 | 描述 |
---|---|---|
iqn | String | iSCSI Target IQN。 |
status | String | 卷对应的Target的状态:
|
ips | Array of ip | iSCSI Target的IP属性集合,详见“表3 响应参数ip说明”。 |
serverId | String | IQN所在的服务器ID。 |
表3 响应参数ip说明
名称 | 类型 | 描述 |
---|---|---|
ip | String | iSCSI Target的IP。 |
port | Integer | iSCSI Target的端口号。 |
表4 响应参数config.serverAffinity说明
名称 | 类型 | 描述 |
---|---|---|
autoFailback | String | 针对卷主备状态,当高优先级的服务器恢复正常后,是否自动进行主备状态切换(仅集群版支持):
|
priority | Array of string | 卷主备分布优先级的服务器ID(仅集群版支持),系统根据指定的服务器ID顺序来选择卷的主备IQN。 |
请求示例1
单机版:查询卷名称包含luna或lunb的卷。
GET /rest/v1/block/lun?filter=lunName:luna or lunName:lunb HTTP/1.1
Date: Tue, 11 Mar 2025 08:33:17 GMT
Authorization: userName:signature
Host: 192.168.0.66:1443
响应示例1
HTTP/1.1 200 OK
x-hblock-request-id: 04521019519844689f4051424b170aaf
Connection: keep-alive
Content-Length: 1593
Date: Tue, 11 Mar 2025 08:33:17 GMT
Content-Type: application/json;charset=utf-8
Server: HBlock
{
"data": {
"luns": [
{
"lunName": "luna1",
"status": "Normal",
"capacity": 100,
"storageMode": "Local",
"createTime": 1740646111244,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:targeta.1",
"status": "Active",
"ips": [
{
"ip": "192.168.0.66",
"port": 3260
}
],
"serverId": "hblock_1"
}
],
"config": {
"sectorSize": 4096,
"writePolicy": "WriteBack",
"path": "/mnt/stor01",
"reclaimPolicy": "Retain"
},
"number": 0,
"isClone": false,
"snapshots": {
"snapshotNumbers": 5
},
"WWID": "33000000032b51acf"
},
{
"lunName": "luna1-C1",
"status": "Normal",
"capacity": 200,
"storageMode": "Local",
"createTime": 1741578932451,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:targeta1.4",
"status": "Active",
"ips": [
{
"ip": "192.168.0.66",
"port": 3260
}
],
"serverId": "hblock_1"
}
],
"config": {
"sectorSize": 4096,
"writePolicy": "WriteBack",
"path": "/mnt/stor01",
"reclaimPolicy": "Retain"
},
"number": 0,
"isClone": true,
"sourceSnapshotName": "luna1-snapshot",
"sourceLunName": "luna1",
"snapshots": {
"snapshotNumbers": 1
},
"WWID": "33000000066d85e04"
},
{
"lunName": "luna1-C2",
"status": "Normal",
"capacity": 500,
"storageMode": "Local",
"createTime": 1741676143667,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:targeta.1",
"status": "Active",
"ips": [
{
"ip": "192.168.0.66",
"port": 3260
}
],
"serverId": "hblock_1"
}
],
"config": {
"sectorSize": 512,
"writePolicy": "WriteThrough",
"path": "/mnt/stor01",
"reclaimPolicy": "Retain"
},
"number": 2,
"isClone": false,
"snapshots": {
"snapshotNumbers": 0
},
"WWID": "33fffffffa8a58560"
},
{
"lunName": "luna2",
"status": "Normal",
"capacity": 88,
"storageMode": "Local",
"createTime": 1740723195879,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:targeta.1",
"status": "Active",
"ips": [
{
"ip": "192.168.0.66",
"port": 3260
}
],
"serverId": "hblock_1"
}
],
"config": {
"sectorSize": 4096,
"writePolicy": "WriteBack",
"path": "/mnt/stor01",
"reclaimPolicy": "Retain"
},
"number": 1,
"isClone": false,
"snapshots": {
"snapshotNumbers": 1
},
"WWID": "33fffffffda281600"
},
{
"lunName": "lunb1",
"status": "Normal",
"capacity": 200,
"storageMode": "Cache",
"createTime": 1740650654198,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:targetb.2",
"status": "Active",
"ips": [
{
"ip": "192.168.0.66",
"port": 3260
}
],
"serverId": "hblock_1"
}
],
"cloud": {
"bucketName": "hblocktest3",
"endpoint": "https://oos-cn.ctyunapi.cn",
"signVersion": "v4",
"region": "cn",
"provider": "OOS"
},
"config": {
"sectorSize": 4096,
"writePolicy": "WriteBack",
"path": "/mnt/stor01",
"reclaimPolicy": "Retain"
},
"number": 0,
"isClone": false,
"WWID": "33fffffff9449437a"
}
]
}
}
请求示例2
集群版:查询卷名称包含lun04或lun01a的卷,并且只列出第5个到第7个查询结果。
GET /rest/v1/block/lun?filter=lunName:lun04 or lunName:lun01a &range=5-7 HTTP/1.1
Date: Tue, 11 Mar 2025 09:09:47 GMT
Authorization: HBlock userName:signature
Connection: keep-alive
Host: 192.168.0.65:1443
响应示例2
HTTP/1.1 200 OK
x-hblock-request-id: b4875ebfbbfb4408a9411ef6009de145
Connection: keep-alive
Content-Length: 2382
Date: Tue, 11 Mar 2025 09:09:47 GMT
Content-Type: application/json;charset=utf-8
Server: HBlock
{
"data": {
"luns": [
{
"lunName": "lun01a-clone2",
"status": "Normal",
"capacity": 100,
"storageMode": "Local",
"createTime": 1741224470703,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target001.7",
"status": "Active",
"ips": [
{
"ip": "192.168.0.65",
"port": 3260
}
],
"serverId": "hblock_1"
},
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target001.8",
"status": "Standby",
"ips": [
{
"ip": "192.168.0.67",
"port": 3260
}
],
"serverId": "hblock_3"
}
],
"config": {
"localStorageClass": "EC 2+1",
"minReplica": 2,
"sectorSize": 4096,
"highAvailability": "ActiveStandby",
"writePolicy": "WriteBack",
"pool": "default",
"redundancyOverlap": 1,
"reclaimPolicy": "Retain",
"serverAffinity": {
"autoFailback": "Enabled"
},
"ECfragmentSize": 16
},
"number": 2,
"isClone": true,
"sourceSnapshotName": "snapshot-lun01a-2",
"sourceLunName": "lun01a",
"snapshots": {
"snapshotNumbers": 1
},
"WWID": "3300000000429bf04"
},
{
"lunName": "lun01a20250304",
"status": "Normal",
"capacity": 100,
"storageMode": "Local",
"createTime": 1741314227795,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target01.2",
"status": "Active",
"ips": [
{
"ip": "192.168.0.64",
"port": 3260
}
],
"serverId": "hblock_2"
},
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target01.1",
"status": "Standby",
"ips": [
{
"ip": "192.168.0.67",
"port": 3260
}
],
"serverId": "hblock_3"
}
],
"config": {
"localStorageClass": "EC 2+1",
"minReplica": 2,
"sectorSize": 4096,
"highAvailability": "ActiveStandby",
"writePolicy": "WriteBack",
"pool": "default",
"redundancyOverlap": 1,
"reclaimPolicy": "Retain",
"serverAffinity": {
"autoFailback": "Enabled"
},
"ECfragmentSize": 16
},
"number": 11,
"isClone": false,
"snapshots": {
"snapshotNumbers": 0
},
"WWID": "33fffffffcffa0b61"
},
{
"lunName": "lun04a",
"status": "Normal",
"capacity": 220,
"storageMode": "Cache",
"createTime": 1740708257052,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target04.15",
"status": "Active",
"ips": [
{
"ip": "192.168.0.65",
"port": 3260
}
],
"serverId": "hblock_1"
},
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target04.16",
"status": "Standby",
"ips": [
{
"ip": "192.168.0.64",
"port": 3260
}
],
"serverId": "hblock_2"
}
],
"cloud": {
"bucketName": "hblocktest3",
"endpoint": "https://oos-cn.ctyunapi.cn",
"signVersion": "v2",
"provider": "OOS"
},
"config": {
"localStorageClass": "EC 2+1",
"minReplica": 2,
"sectorSize": 4096,
"highAvailability": "ActiveStandby",
"writePolicy": "WriteBack",
"pool": "default",
"redundancyOverlap": 1,
"reclaimPolicy": "Retain",
"serverAffinity": {
"autoFailback": "Enabled"
},
"ECfragmentSize": 16
},
"number": 0,
"isClone": false,
"WWID": "33ffffffff4f9099b"
}
]
}
}