此操作用来批量查询卷。可以通过设置过滤条件和range范围进行查询。如果未设置过滤条件和range范围,则查询所有的卷。
请求语法
GET /rest/v1/block/lun?filter=filter&range=i-j HTTP/1.1
Date: date
Host: ip:port
Authorization: authorization
请求参数
参数 描述 是否必须 filter 查询的过滤条件。可以选择多个查询,如果是或的关系,使用“or”将查询条件分隔开;如果是与的关系,使用“and”将查询条件分隔开。
支持的过滤条件类型包括:
lunName:卷名称。
status:卷的状态。
capacity:卷容量。
iqn:Target的识别。
否 range 查询卷的范围,格式为i-j,i和j为正整数,0 < j-i < 1000。按照卷名称进行排序,返回第i到第j的卷。
如果输入的查询范围超过卷的总个数,返回的结果为空,如果未指定range,则返回所有符合条件的卷。 否
响应结果
名称 描述 lunName 卷名称。 status 卷的状态:
Enabled:卷处于启用状态。
Disabled:卷处于禁用状态。
Deleting:卷正在删除中。
DeleteFailed:卷删除失败。
Recovering:卷正在还原中。
RecoverFailed:卷还原失败。
storageMode 卷的存储类型:
Local:本地模式,数据全部保留在本地。
Cache:缓存模式,本地保留部分热数据,全部数据异步存储到OOS中。
Storage:存储模式,本地保留全部数据,并异步存储到OOS中。
capacity 卷容量,单位是GiB。 createTime 卷创建时间。unix时间戳(UTC),精确到毫秒。
iSCSITargets iSCSITargets iSCSI Target属性集合。包含:iqn、status、ips、serverId。
类型:数组
iqn iSCSI Target IQN。 iSCSITargets.status 卷对应的Target的状态:
Active:主Target。
Standby:热备Target。
Offline:离线Target。
Unavailable:冷备Target。
ips iSCSI Target的IP属性集合,包含:ip、port。
类型:数组
ip iSCSI Target的IP。 port iSCSI Target的端口号。 serverId IQN所在的服务器ID。 cloud.bucketName OOS存储桶的名称(仅上云卷支持)。 cloud.endpoint OOS Endpoint(仅上云卷支持)。 cloud.signVersion 上云签名认证的类型(仅上云卷支持):
v2:V2签名认证。
v4:V4签名认证。
cloud.region Endpoint资源池所在区域(仅上云卷支持)。 config.minReplica 卷的最小副本数(仅集群版支持)。 config.ECfragmentSize 分片大小。如果冗余模式为EC N+M,则会返回此项。 config.sectorSize 扇区大小:
512。
4096。
config.highAvailability 高可用模式类型(仅集群版支持):
ActiveStandby:主备,该卷关联对应Target下的所有IQN。
Disabled:禁用,该卷关联对应Target下的1个IQN。
config.writePolicy 卷的写策略:
WriteBack:回写,指数据写入到内存后即返回客户端成功,之后再异步写入磁盘。
WriteThrough:透写,指数据同时写入内存和磁盘,并在都写成功后再返回客户端成功。
WriteAround:绕写,指数据直接写到磁盘,不写入内存。
config.cachePool 缓存存储池(仅集群版支持)。 config.pool 存储池(仅集群版支持),表示最终存储池,卷数据最终落在该存储池内。 config.path 数据目录(仅单机版支持)。 number 卷编号。 WWID 卷的唯一标识符。 deleteFailedReason 云上数据删除失败的原因,只有status是DeleteFailed的时候才返回该项。
config.localStorageClass 卷冗余模式(仅集群版支持):
single-copy:单副本。
2-copy:两副本。
3-copy:三副本。
EC N+M。
请求示例1
单机版:查询卷名称包含lun的卷,并且只列出第1个到第4个查询结果。
GET /rest/v1/block/lun?filter=lunName:lun&range=1-4 HTTP/1.1
Date: Tue, 14 May 2024 03: 07: 57 GMT
Authorization: userName:signature
Host: 192.168.0.32: 1443
响应示例1
HTTP/1.1 200 OK
x-hblock-request-id: d2ab1c7eec9e4d2787614c8c2000c011
Connection: keep-alive
Content-Length: 1714
Date: Tue, 14 May 2024 03: 07: 57 GMT
Content-Type: application/json;charset=utf-8
Server: HBlock
{
"data": {
"luns": [
{
"lunName": "lun8",
"status": "Enabled",
"capacity": 500,
"storageMode": "Local",
"createTime": 1715593736690,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target8.4",
"status": "Active",
"ips": [
{
"ip": "192.168.0.32",
"port": 3260
}
],
"serverId": "hblock_1"
}
],
"config": {
"sectorSize": 512,
"writePolicy": "WriteThrough",
"path": "/mnt/storage01"
},
"number": 0,
"WWID": "33fffffff87655738"
},
{
"lunName": "luna1",
"status": "Enabled",
"capacity": 110,
"storageMode": "Local",
"createTime": 1715333463256,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:targeta.2",
"status": "Active",
"ips": [
{
"ip": "192.168.0.32",
"port": 3260
}
],
"serverId": "hblock_1"
}
],
"config": {
"sectorSize": 4096,
"writePolicy": "WriteBack",
"path": "/mnt/storage01"
},
"number": 0,
"WWID": "3300000002e39684c"
},
{
"lunName": "luna2",
"status": "Enabled",
"capacity": 110,
"storageMode": "Storage",
"createTime": 1715396757240,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:targeta.2",
"status": "Active",
"ips": [
{
"ip": "192.168.0.32",
"port": 3260
}
],
"serverId": "hblock_1"
}
],
"cloud": {
"bucketName": "hblocktest3",
"endpoint": "https://oos-cn.ctyunapi.cn",
"signVersion": "v4",
"region": "cn"
},
"config": {
"sectorSize": 4096,
"writePolicy": "WriteBack",
"path": "/mnt/storage01"
},
"number": 1,
"WWID": "33000000069ef2804"
},
{
"lunName": "luna9",
"status": "Enabled",
"capacity": 500,
"storageMode": "Storage",
"createTime": 1715593820777,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:targeta.2",
"status": "Active",
"ips": [
{
"ip": "192.168.0.32",
"port": 3260
}
],
"serverId": "hblock_1"
}
],
"cloud": {
"bucketName": "hblocktest3",
"endpoint": "https://oos-cn.ctyunapi.cn",
"signVersion": "v4",
"region": "cn"
},
"config": {
"sectorSize": 512,
"writePolicy": "WriteThrough",
"path": "/mnt/storage01"
},
"number": 2,
"WWID": "33000000063b3f8e6"
}
]
}
}
请求示例2
集群版:查询卷名称包含lun的卷,并且只列出第1个到第4个查询结果。
GET /rest/v1/block/lun?filter=lunName:lun&range=1-4 HTTP/1.1
Date: Mon, 17 Jun 2024 02: 52: 19 GMT
Authorization: HBlock userName:signature
Host: 192.168.0.110: 1443
响应示例2
HTTP/1.1 200 OK
x-hblock-request-id: 4f66bd0a0f53401fa516d8e34c0654ed
Connection: keep-alive
Content-Length: 2638
Date: Mon, 17 Jun 2024 02: 52: 19 GMT
Content-Type: application/json;charset=utf-8
Server: HBlock
{
"data": {
"luns": [
{
"lunName": "lun01",
"status": "Enabled",
"capacity": 1,
"storageMode": "Local",
"createTime": 1718357534513,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target01.2",
"status": "Active",
"ips": [
{
"ip": "192.168.0.110",
"port": 3260
}
],
"serverId": "hblock_2"
},
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target01.1",
"status": "Standby",
"ips": [
{
"ip": "192.168.0.102",
"port": 3260
}
],
"serverId": "hblock_3"
}
],
"config": {
"localStorageClass": "EC 2+1",
"minReplica": 2,
"sectorSize": 4096,
"highAvailability": "ActiveStandby",
"writePolicy": "WriteBack",
"cachePool": "default",
"pool": "pool2",
"ECfragmentSize": 16
},
"number": 1,
"WWID": "3300000005502e993"
},
{
"lunName": "lun01a",
"status": "Enabled",
"capacity": 200,
"storageMode": "Local",
"createTime": 1717480736475,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target01.1",
"status": "Active",
"ips": [
{
"ip": "192.168.0.102",
"port": 3260
}
],
"serverId": "hblock_3"
},
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target01.2",
"status": "Standby",
"ips": [
{
"ip": "192.168.0.110",
"port": 3260
}
],
"serverId": "hblock_2"
}
],
"config": {
"localStorageClass": "EC 2+1",
"minReplica": 2,
"sectorSize": 4096,
"highAvailability": "ActiveStandby",
"writePolicy": "WriteBack",
"pool": "default",
"ECfragmentSize": 16
},
"number": 0,
"WWID": "33000000007feaf6e"
},
{
"lunName": "lun02a",
"status": "Enabled",
"capacity": 220,
"storageMode": "Cache",
"createTime": 1717480818023,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target02.3",
"status": "Active",
"ips": [
{
"ip": "192.168.0.192",
"port": 3260
}
],
"serverId": "hblock_1"
},
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target02.4",
"status": "Standby",
"ips": [
{
"ip": "192.168.0.102",
"port": 3260
}
],
"serverId": "hblock_3"
}
],
"cloud": {
"bucketName": "hblocktest3",
"endpoint": "https://oos-cn.ctyunapi.cn",
"signVersion": "v4",
"region": "cn"
},
"config": {
"localStorageClass": "EC 2+1",
"minReplica": 2,
"sectorSize": 4096,
"highAvailability": "ActiveStandby",
"writePolicy": "WriteBack",
"pool": "default",
"ECfragmentSize": 16
},
"number": 0,
"WWID": "33fffffffb3c7e027"
},
{
"lunName": "lun03a",
"status": "Enabled",
"capacity": 300,
"storageMode": "Storage",
"createTime": 1717480916739,
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target03.5",
"status": "Active",
"ips": [
{
"ip": "192.168.0.192",
"port": 3260
}
],
"serverId": "hblock_1"
},
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target03.6",
"status": "Standby",
"ips": [
{
"ip": "192.168.0.102",
"port": 3260
}
],
"serverId": "hblock_3"
}
],
"cloud": {
"bucketName": "hblocktest3",
"endpoint": "https://oos-cn.ctyunapi.cn",
"signVersion": "v4",
"region": "cn"
},
"config": {
"localStorageClass": "EC 2+1",
"minReplica": 2,
"sectorSize": 4096,
"highAvailability": "ActiveStandby",
"writePolicy": "WriteBack",
"pool": "default",
"ECfragmentSize": 16
},
"number": 0,
"WWID": "3300000002c4fc25b"
}
]
}
}