跨数据存储迁移硬盘(PrimaryStorageMigrateVolume)
跨存储迁移硬盘
API请求
URLs
PUT zstack/v1/primary-storage/volumes/{volumeUuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"primaryStorageMigrateVolume": {
"dstPrimaryStorageUuid": "ed4370b338da37d8a537bfb738e736f2"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中
systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X PUT -d '{"primaryStorageMigrateVolume":{"dstPrimaryStorageUuid":"ed4370b338da37d8a537bfb738e736f2"}}' http://localhost:8080/zstack/v1/primary-storage/volumes/b6e9b22601f7319fadd329d065b0cd1b/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| volumeUuid | String | url | 硬盘UUID | 2.2 | |
| dstPrimaryStorageUuid | String | body(包含在primaryStorageMigrateVolume结构中) |
目标数据存储UUID | 2.2 | |
| systemTags (可选) | List | body | 系统标签 | 2.2 | |
| userTags (可选) | List | body | 用户标签 | 2.2 |
API返回
返回示例
{
"inventory": {
"uuid": "93e582fd69593a1fbfbf5b81d795b176",
"name": "test-volume",
"primaryStorageUuid": "65c9477fa7a13170b65b6e9240009717",
"vmInstanceUuid": "ea66572977b234febe41b65a2efb5e00",
"diskOfferingUuid": "5e2d7175f9b1334a806d7217c28fc62e",
"rootImageUuid": "25a4f9644fba3734a984f3b1933f1e29",
"installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-93e582fd69593a1fbfbf5b81d795b176/93e582fd69593a1fbfbf5b81d795b176.qcow2",
"type": "Root",
"format": "qcow2",
"size": 107374182400,
"actualSize": 21474836480,
"deviceId": 0,
"state": "Enabled",
"status": "Ready",
"createDate": "Nov 14, 2017 2:20:57 PM",
"lastOpDate": "Nov 14, 2017 2:20:57 PM"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 0.6 | |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.2 |
| inventory | VolumeInventory | 详情参考inventory | 2.2 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 3.17.13 |
| name | String | 资源名称 | 3.17.13 |
| description | String | 资源的详细描述 | 3.17.13 |
| primaryStorageUuid | String | 数据存储UUID | 3.17.13 |
| vmInstanceUuid | String | 虚拟机UUID | 3.17.13 |
| diskOfferingUuid | String | 硬盘规格UUID | 3.17.13 |
| rootImageUuid | String | 3.17.13 | |
| installPath | String | 3.17.13 | |
| type | String | 3.17.13 | |
| format | String | 3.17.13 | |
| size | Long | 3.17.13 | |
| actualSize | Long | 3.17.13 | |
| deviceId | Integer | 3.17.13 | |
| state | String | 3.17.13 | |
| status | String | 3.17.13 | |
| createDate | Timestamp | 创建时间 | 3.17.13 |
| lastOpDate | Timestamp | 最后一次修改时间 | 3.17.13 |
| isShareable | Boolean | 3.17.13 | |
| volumeQos | String | 3.17.13 | |
| lastDetachDate | Timestamp | 3.17.13 | |
| lastVmInstanceUuid | String | 3.17.13 | |
| encrypted | Boolean | 5.1.0 |
SDK示例
Java SDK
PrimaryStorageMigrateVolumeAction action = new PrimaryStorageMigrateVolumeAction();
action.volumeUuid = "b6e9b22601f7319fadd329d065b0cd1b";
action.dstPrimaryStorageUuid = "ed4370b338da37d8a537bfb738e736f2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
PrimaryStorageMigrateVolumeAction.Result res = action.call();Python SDK
action = PrimaryStorageMigrateVolumeAction()
action.volumeUuid = "b6e9b22601f7319fadd329d065b0cd1b"
action.dstPrimaryStorageUuid = "ed4370b338da37d8a537bfb738e736f2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()