跨数据存储迁移硬盘

PUT/zstack/v1/primary-storage/volumes/{volumeUuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "primaryStorageMigrateVolume": {
    "dstPrimaryStorageUuid": "aafceb95938e42a6be5475f19a92eec9"
  },
  "systemTags": [],
  "userTags": []
}

上述示例中systemTagsuserTags字段可以省略。列出是为了表示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

参数列表

名字类型位置描述可选值起始版本
volumeUuidStringurl硬盘UUID 2.2
dstPrimaryStorageUuidStringbody(包含在primaryStorageMigrateVolume结构中)目标数据存储UUID 2.2
systemTags (可选)Listbody系统标签 2.2
userTags (可选)Listbody用户标签 2.2

API返回

返回示例

{
  "inventory": {
    "uuid": "5fa2d1c7adcd4963b1f9016075764fcb",
    "name": "test-volume",
    "primaryStorageUuid": "6ebc0be6faaa41f28874daa6076322bd",
    "vmInstanceUuid": "2c528326ddcf43dd9bdd1d80da7a15ef",
    "diskOfferingUuid": "2af3082d23444be9833c32c53ea2b1ed",
    "rootImageUuid": "254bdaf01a33407082d8afe540b76796",
    "installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-5fa2d1c7adcd4963b1f9016075764fcb/5fa2d1c7adcd4963b1f9016075764fcb.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400.0,
    "actualSize": 21474836480.0,
    "deviceId": 0.0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Oct 26, 2017 3:38:58 PM",
    "lastOpDate": "Oct 26, 2017 3:38:58 PM"
  }
}
名字类型描述起始版本
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error2.2
inventoryVolumeInventory详情参考inventory2.2

error

名字类型描述起始版本
codeString错误码号,错误的全局唯一标识,例如SYS.1000, HOST.10012.2
descriptionString错误的概要描述2.2
detailsString错误的详细信息2.2
elaborationString保留字段,默认为null2.2
opaqueLinkedHashMap保留字段,默认为null2.2
causeErrorCode根错误,引发当前错误的源错误,若无原错误,该字段为null2.2

inventory

名字类型描述起始版本
uuidString资源的UUID,唯一标示该资源2.2
nameString资源名称2.2
descriptionString资源的详细描述2.2
primaryStorageUuidString数据存储UUID2.2
vmInstanceUuidString虚拟机UUID2.2
diskOfferingUuidString硬盘规格UUID2.2
rootImageUuidString 2.2
installPathString 2.2
typeString 2.2
formatString 2.2
sizeLong 2.2
actualSizeLong 2.2
deviceIdInteger 2.2
stateString 2.2
statusString 2.2
createDateTimestamp创建时间2.2
lastOpDateTimestamp最后一次修改时间2.2
isShareableBoolean 2.2

SDK示例

Java SDK

PrimaryStorageMigrateVolumeAction action = new PrimaryStorageMigrateVolumeAction();
action.volumeUuid = "af5d94f0f24c45f79280fc4661919b2c";
action.dstPrimaryStorageUuid = "e8d756d48e5d48a69f5bec6221ddbc79";
action.sessionId = "c186caf64d0043158b2c5ea9784697ab";
PrimaryStorageMigrateVolumeAction.Result res = action.call();

Python SDK

PrimaryStorageMigrateVolumeAction action = PrimaryStorageMigrateVolumeAction()
action.volumeUuid = "7e170d744c014517b3b38f20111f400d"
action.dstPrimaryStorageUuid = "8c2cc857b81d4d75b404809e57e02deb"
action.sessionId = "ec12693efdf14d72b2a59de9c039870a"
PrimaryStorageMigrateVolumeAction.Result res = action.call()