此操作用来迁移iSCSI target,修改iSCSI target对应的服务器。
说明
一次只允许迁移iSCSI target对应的一个服务器。
注意
执行迁移iSCSI target之前,需要保证集群处于working状态,同时目的服务器需要处于正常已连接状态。
目前仅支持强制迁移iSCSI target,强制迁移iSCSI target可能会造成数据丢失。
如果被迁移的iSCSI target已被卷连接,且该卷已经被客户端挂载,迁移iSCSI target前,需要客户端与原iSCSI target IQN断开;迁移后,确保原iSCSI target IQN不能被发现,客户端重新连接迁移后的iSCSI target IQN。
迁移完成后,请检查并调整target允许访问列表配置,确保符合访问控制要求。
迁移iSCSI target时:
如果提示内存不足:由于内存不足可能会引起HBlock服务异常,建议随时观察服务器上的内存使用情况,内存使用率过高时,及时增加系统总内存,或单独提高服务器中HBlock可使用的内存。提高服务器中HBlock可使用的内存详见批量修改服务器属性。
如果提示需要重启服务:您可以等此类操作全部执行完毕后,立即重启提示信息中对应服务器上的HBlock服务。
请求语法
PUT /rest/v1/block/target/targetName/migrate?force=force HTTP/1.1
Date: date
Content-Type: application/json; charset=utf-8
Content-Length: length
Host: ip:port
Authorization: authorization
{
"server": [
{
"source": source_server_ID,
"dest": dest_server_ID
}
]
}请求参数
| 参数 | 类型 | 描述 | 是否必填 |
|---|---|---|---|
| targetName | String | iSCSI target名称。 取值:长度范围是1~16,可以由小写字母、数字、句点(.)和短横线(-)组成,且仅支持以字母或数字开头。 | 是 |
| force | Boolean | 是否强制迁移iSCSI target。 注意 目前仅支持强制迁移iSCSI target,强制迁移iSCSI target可能会造成数据丢失。 取值:true:强制迁移iSCSI target。 | 是 |
| server | Array of server | 迁移的源和目的服务器集合,详见“表1 请求参数server说明”。 | 是 |
表1 请求参数server说明
| 参数 | 类型 | 描述 | 是否必填 |
|---|---|---|---|
| source | String | iSCSI target的源服务器ID。 | 是 |
| dest | String | iSCSI target的目标服务器ID。 | 是 |
响应结果
| 名称 | 类型 | 描述 |
|---|---|---|
| luns | Array of lun | 卷的属性集合,详见“表2响应参数lun说明”。 |
表2 响应参数lun说明
| 名称 | 类型 | 描述 |
|---|---|---|
| lunName | String | 关联卷的名称。 |
| iSCSITargets | Array of iSCSITarget | iSCSI target属性集合,详见“表3 响应参数iSCSITarget说明”。 |
表3 响应参数iSCSITarget说明
| 名称 | 类型 | 描述 |
|---|---|---|
| iqn | String | iSCSI target IQN。 |
| status | String | 卷对应的iSCSI target的状态:
|
| ips | Array of ip | iSCSI target的IP属性集合,详见“表4 响应参数ip说明”。 |
| targetPortalIP | Object | iSCSI目标门户,详见“表5 响应参数targetPortalIP说明”。 |
表4 响应参数ip说明
| 名称 | 类型 | 描述 |
|---|---|---|
| ip | String | iSCSI target的IP。 |
| port | Integer | iSCSI target的端口号。 |
表5 响应参数targetPortalIP说明
| 名称 | 类型 | 描述 |
|---|---|---|
| ips | Array of ip | iSCSI目标门户的IP属性集合,详见“表6 响应参数targetPortalIP.ip说明”。 |
| status | String | iSCSI目标门户的状态:
|
表6 响应参数targetPortalIP.ip说明
| 名称 | 类型 | 描述 |
|---|---|---|
| ip | String | iSCSI目标门户的IP地址。 |
| port | Integer | iSCSI目标门户的端口号。 |
请求示例
迁移target03。
PUT /rest/v1/block/target/target03/migrate?force=true HTTP/1.1
Date: Mon, 22 Jun 2026 10:29:13 GMT
Content-Type: application/json; charset=utf-8
Authorization: HBlock userName:signature
Content-Length: 117
Host: 192.168.0.65:1443
{
"server": [
{
"source": "hblock_3",
"dest": "hblock_2"
}
]
}响应示例
HTTP/1.1 200 OK
x-hblock-request-id: 4371cbe82191417b940d1e08a304928e
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Content-Length: 1013
Date: Mon, 22 Jun 2026 10:29:16 GMT
Server: HBlock
{
"data": {
"luns": [
{
"lunName": "lun03a",
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target03.5",
"status": "Unavailable",
"ips": [
{
"ip": "192.168.0.64",
"port": 3260
}
],
"targetPortalIP": {
"ips": [
{
"ip": "10.1.0.3",
"port": 105
}
],
"status": "Disabled"
}
},
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target03.6",
"status": "Active",
"ips": [
{
"ip": "192.168.0.68",
"port": 3260
}
],
"targetPortalIP": {
"ips": [
{
"ip": "10.1.0.3",
"port": 105
}
],
"status": "Disabled"
}
}
]
},
{
"lunName": "lun03c",
"iSCSITargets": [
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target03.5",
"status": "Unavailable",
"ips": [
{
"ip": "192.168.0.64",
"port": 3260
}
],
"targetPortalIP": {
"ips": [
{
"ip": "10.1.0.3",
"port": 105
}
],
"status": "Disabled"
}
},
{
"iqn": "iqn.2012-08.cn.ctyunapi.oos:target03.6",
"status": "Active",
"ips": [
{
"ip": "192.168.0.68",
"port": 3260
}
],
"targetPortalIP": {
"ips": [
{
"ip": "10.1.0.3",
"port": 105
}
],
"status": "Disabled"
}
}
]
}
],
"message": "Insufficient memory, please increase the total system memory or separately raise the memory allocation for the services on the following servers:\nhblock_2"
}
}说明
卷关联的iSCSI target处于Unavailable状态,表示iSCSI target正在从一个服务器迁移到集群其他服务器上,迁移过程,该iSCSI target处于Unavailable状态。迁移完成后,iSCSI target将变为Active或者Standby状态。