本文介绍如何将虚拟机(VM)还原点复制到另一个区域。
先决条件
若要跨区域复制还原点,需要在目标区域中预先创建 restorePointCollection 资源。
在复制还原点之前,详细了解 跨区域复制及其限制 。
在目标区域中创建还原点集合
将现有 VM 还原点从一个区域复制到另一个区域的第一步是通过引用restorePointCollection源区域在目标区域中创建restorePointCollection资源。
URI 请求
PUT https://management.chinacloudapi.cn/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}&api-version={api-version}
请求主体
{
"name": "name of target restorePointCollection resource",
"location": "location of target restorePointCollection resource",
"tags": {
"department": "finance"
},
"properties": {
"source": {
"id": "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/microsoft.compute/restorePointCollections/{restorePointCollectionName}"
}
}
}
响应
请求响应包括状态代码和一组响应标头。
状态代码
操作在创建时返回 201,在更新时返回 200。
响应体
{
"name": "name of the copied restorePointCollection resource",
"id": "CSM Id of copied restorePointCollection resource",
"type": "Microsoft.Compute/restorePointCollections",
"location": "location of the copied restorePointCollection resource",
"tags": {
"department": "finance"
},
"properties": {
"source": {
"id": "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/microsoft.compute/restorePointCollections/{restorePointCollectionName}",
"location": "location of source RPC"
}
}
}
在目标区域中创建 VM 还原点
下一步是通过引用源区域中需要复制的还原点来触发目标 RestorePointCollection 资源中的还原点副本。
URI 请求
PUT https://management.chinacloudapi.cn/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}&api-version={api-version}
请求主体
{
"name": "name of the restore point resource",
"properties": {
"sourceRestorePoint": {
"id": "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/microsoft.compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"
}
}
}
注释
sourceRestorePoint的位置是从源RestorePointCollection的位置推断出来的。
响应
请求响应包括状态代码和一组响应标头。
状态代码
此操作是长期运行的,因此在创建过程中将返回201。 客户端应使用该操作来轮询状态。 提供location标头和Azure-AsyncOperation标头以实现此目的。
在创建还原点的过程中,ProvisioningState 在 GET 还原点 API 响应中显示为 Creating。 如果创建失败, ProvisioningState 则显示为 Failed。 当启动跨区域的数据复制时,ProvisioningState 被设置为 Succeeded。
注释
可以通过在目标 VM 还原点上调用 GET 实例视图(?$expand=instanceView)来跟踪复制状态。 有关如何执行此作的步骤,请参阅“获取 VM 还原点复制/复制状态”部分。仅当所有磁盘还原点的副本成功时,VM 还原点才被视为可用(可用于还原 VM)。
响应体
{
"id": "CSM Id of the restore point",
"name": "name of the restore point",
"properties": {
"optionalProperties": "opaque bag of properties to be passed to extension",
"sourceRestorePoint": {
"id": "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/microsoft.compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"
},
"consistencyMode": "CrashConsistent | FileSystemConsistent | ApplicationConsistent",
"sourceMetadata": {
"vmId": "Unique Guid of the VM from which the restore point was created",
"location": "source VM location",
"hardwareProfile": {
"vmSize": "Standard_A1"
},
"osProfile": {
"computername": "",
"adminUsername": "",
"secrets": [
{
"sourceVault": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/providers/Microsoft.KeyVault/vaults/<keyvault-name>"
},
"vaultCertificates": [
{
"certificateUrl": "https://<keyvault-name>.vault.azure.cn/secrets/<secret-name>/<secret-version>",
"certificateStore": "certificateStoreName on Windows"
}
]
}
],
"customData": "",
"windowsConfiguration": {
"provisionVMAgent": "true|false",
"winRM": {
"listeners": [
{
"protocol": "http"
},
{
"protocol": "https",
"certificateUrl": ""
}
]
},
"additionalUnattendContent": [
{
"pass": "oobesystem",
"component": "Microsoft-Windows-Shell-Setup",
"settingName": "FirstLogonCommands|AutoLogon",
"content": "<XML unattend content>"
}
],
"enableAutomaticUpdates": "true|false"
},
"linuxConfiguration": {
"disablePasswordAuthentication": "true|false",
"ssh": {
"publicKeys": [
{
"path": "Path-Where-To-Place-Public-Key-On-VM",
"keyData": "PEM-Encoded-public-key-file"
}
]
}
}
},
"storageProfile": {
"osDisk": {
"osType": "Windows|Linux",
"name": "OSDiskName",
"diskSizeGB": "10",
"caching": "ReadWrite",
"managedDisk": {
"id": "CSM Id of the managed disk",
"storageAccountType": "Standard_LRS"
},
"diskRestorePoint": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/restorePointCollections/<rpcName>/restorePoints/<rpName>/diskRestorePoints/<diskRestorePointName>"
}
},
"dataDisks": [
{
"lun": "0",
"name": "datadisk0",
"diskSizeGB": "10",
"caching": "ReadWrite",
"managedDisk": {
"id": "CSM Id of the managed disk",
"storageAccountType": "Standard_LRS"
},
"diskRestorePoint": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/restorePointCollections/<rpcName>/restorePoints/<rpName>/diskRestorePoints/<diskRestorePointName>"
}
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": " http://storageaccount.blob.core.chinacloudapi.cn/"
}
}
},
"provisioningState": "Succeeded | Failed | Creating | Deleting",
"provisioningDetails": {
"creationTime": "Creation Time of Restore point in UTC"
}
}
}
获取 VM 还原点副本/复制状态
启动 VM 还原点的副本过程后,可以通过在目标 VM 还原点上调用 GET 实例视图(?$expand=instanceView)来跟踪复制状态。
URI 请求
GET https://management.chinacloudapi.cn/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}?$expand=instanceView&api-version={api-version}
响应
{
"id": "CSM Id of the restore point",
"name": "name of the restore point",
"properties": {
"optionalProperties": "opaque bag of properties to be passed to extension",
"sourceRestorePoint": {
"id": "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/microsoft.compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"
},
"consistencyMode": "CrashConsistent | FileSystemConsistent | ApplicationConsistent",
"sourceMetadata": {
"vmId": "Unique Guid of the VM from which the restore point was created",
"location": "source VM location",
"hardwareProfile": {
"vmSize": "Standard_A1"
},
"osProfile": {
"computername": "",
"adminUsername": "",
"secrets": [
{
"sourceVault": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/providers/Microsoft.KeyVault/vaults/<keyvault-name>"
},
"vaultCertificates": [
{
"certificateUrl": "https://<keyvault-name>.vault.azure.cn/secrets/<secret-name>/<secret-version>",
"certificateStore": "certificateStoreName on Windows"
}
]
}
],
"customData": "",
"windowsConfiguration": {
"provisionVMAgent": "true|false",
"winRM": {
"listeners": [
{
"protocol": "http"
},
{
"protocol": "https",
"certificateUrl": ""
}
]
},
"additionalUnattendContent": [
{
"pass": "oobesystem",
"component": "Microsoft-Windows-Shell-Setup",
"settingName": "FirstLogonCommands|AutoLogon",
"content": "<XML unattend content>"
}
],
"enableAutomaticUpdates": "true|false"
},
"linuxConfiguration": {
"disablePasswordAuthentication": "true|false",
"ssh": {
"publicKeys": [
{
"path": "Path-Where-To-Place-Public-Key-On-VM",
"keyData": "PEM-Encoded-public-key-file"
}
]
}
}
},
"storageProfile": {
"osDisk": {
"osType": "Windows|Linux",
"name": "OSDiskName",
"diskSizeGB": "10",
"caching": "ReadWrite",
"managedDisk": {
"id": "CSM Id of the managed disk",
"storageAccountType": "Standard_LRS"
},
"diskRestorePoint": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/restorePointCollections/<rpcName>/restorePoints/<rpName>/diskRestorePoints/<diskRestorePointName>"
}
},
"dataDisks": [
{
"lun": "0",
"name": "datadisk0",
"diskSizeGB": "10",
"caching": "ReadWrite",
"managedDisk": {
"id": "CSM Id of the managed disk",
"storageAccountType": "Standard_LRS"
},
"diskRestorePoint": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/restorePointCollections/<rpcName>/restorePoints/<rpName>/diskRestorePoints/<diskRestorePointName>"
}
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": " http://storageaccount.blob.core.chinacloudapi.cn/"
}
}
},
"provisioningState": "Succeeded | Failed | Creating | Deleting",
"provisioningDetails": {
"creationTime": "Creation Time of Restore point in UTC"
},
"instanceView": {
"statuses": [
{
"code": "ReplicationState/succeeded",
"level": "Info",
"displayStatus": "Replication succeeded"
}
],
"diskRestorePoints": [
{
"id": "<diskRestorePoint Arm Id>",
"replicationStatus": {
"status": {
"code": "ReplicationState/succeeded",
"level": "Info",
"displayStatus": "Replication succeeded"
},
"completionPercent": "<completion percentage of the replication>"
}
}
]
}
}
}