[VMC on AWS] Updating replica storage policy when reconfiguring replication with new storage policy
search cancel

[VMC on AWS] Updating replica storage policy when reconfiguring replication with new storage policy

book

Article ID: 313683

calendar_today

Updated On:

Products

VMware Cloud on AWS

Issue/Introduction

After setting the storage policy through the reconfigure replication wizard, if you do not do anything else, the storage policy is not applied to the replica disks. When you recover the virtual machines, the policy that was selected when you reconfigured the replication is applied to the recovered virtual machine. You can complete the process of applying the storage policy to the replica disks, without needing to recover the VM, by using the REST API. The APIs work only for the incoming replications on your SDDC. The script below is an example method for more easily accessing these APIs.

When you do Planned Migration or Disaster Recovery of the virtual machines, the policy that was selected when you reconfigured the replication is applied to the recovered virtual machine. When you do Test Failover, the test recovered virtual machine disks will be assigned with this new storage policy, however the replica base disks will not be updated with the new storage policy and still require this API or recovery of virtual machine.


Symptoms:
Selecting a different storage policy for a VM when reconfiguring replication does not change the storage policy assigned to the replica. The newly selected storage policy is assigned when the VM is recovered.

Resolution

Since M14 and above and VR 8.5 and above, HMS (VR management component) is integrated with SPBM and VSAN and once replication is reconfigured with the new storage policy, the VSAN backing object for each replica base disk is automatically resynced with the new storage policy. There is no longer need to invoke VMware Site Recovery service API for this VSAN backing object resync.
This is documented at https://docs.vmware.com/en/vSphere-Replication/8.6/com.vmware.vsphere.replication-admin.doc/GUID-3AC77777-6029-453A-A93E-0BBEC7FC0C48.html#GUID-3AC77777-6029-453A-A93E-0BBEC7FC0C48

we can follow the below steps on VSR 8.4 and below

Before you can use the REST APIs to reconfigure the storage policy, you must obtain a user token.

1. Obtain API Refresh token

To Obtain the token follow KB 79543

$AUTH_TOKEN is set by the above KB. You can make the syntax easier by setting these other values in variables as well.

$ORG_ID="your-32-digit-org-id-here"
$SDDC_ID="your-32-digit-sddc-id-here"
$DRAAS_BACKEND_URL="https://vmc.vmware.com"



2. Update Storage Policy 

Make sure you have the ORG ID, SDDC ID and DRAAS BACKEND URL variables set in the previous step, or explicitly specify them on the command line.

curl "$DRAAS_BACKEND_URL/vmc/draas/api/orgs/$ORG_ID/sddcs/$SDDC_ID/site-recovery/storage-policy" -i -X POST -H "csp-auth-token: $AUTH_TOKEN" 

After invoking the above storage policy API, it returns a task like the following results. Please record the "id" for future reference.

In the example below, "id" = "9a719f98-609f-40e7-8f18-2ce5e17ea4f3"



3. Query vSAN storage policy task info 
 
This is a query API, which you can invoke repeatedly to query the process of vsan-policy-update task
Create a new variable "$TASK_ID" with the id captured from previous invoke api step

curl "$DRAAS_BACKEND_URL/vmc/draas/api/orgs/$ORG_ID/sddcs/$SDDC_ID/site-recovery/vsan-policy-update-task-info" -i -X GET -G -d "task_id=$TASK_ID" -H "csp-auth-token: $AUTH_TOKEN" -H "Content-Type: application/json"


NameTypeExplanation
statusString or EnumThe status of the task.
descriptionStringThe concise summary of the task, which relies on to the task sub status.
totalReplicationNumberIntNumber of total replications.
progressPercentForAllReplicationsInt (0~100)The percentage of the completed replications.
taskIdUUIDvSAN policy update task ID.
completedReplicationIntSize of the completed replications.
currentReplicationNameStringName of the current replication.
remainingDiskNumberForCurrentReplicationIntRemaining number of disks for the current replication.
startTimeStringThe start time of the task.
taskDurationInMinutesLongTask duration from the start time until the current moment.

 

4. Cancel vSAN storage policy task

You can cancel the vSAN storage policy task when it takes long time or you don't want to update the policy. You can invoke query API to check the cancelled status.

Note: We don't recommend cancelling this task unless other operations must be done before the task will complete.

curl "$DRAAS_BACKEND_URL/vmc/draas/api/orgs/$ORG_ID/tasks/$TASK_ID?action=cancel" -i -X POST -H "csp-auth-token: $AUTH_TOKEN"

# or this: curl "$DRAAS_BACKEND_URL/vmc/draas/api/orgs/$ORG_ID/tasks/$TASK_ID" -i -X POST -d "action=cancel" -H "csp-auth-token: $AUTH_TOKEN"




Please Note:

  • The update API only updates the new storage policy for base disks, the child disks (hbrdisk prefix disks) continue to remain on the original storage policy.
  • Always check the available vSAN capacity before using these APIs. Do not change the storage policy and invoke the update API when the disk space is low.
  • Avoid frequent updates of the storage policy.
  • The vsan-update-policy task might update the policy quickly, but the resync of the replication data can take a long time.
  • If you receive a timeout error, verify that there is enough disk space. The vsan-update-policy task waits for enough free space to update the storage policy.
  • If you receive a replication/disk error, verify the status of the disk and the replication and ensure that they are in an OK state.
  • When cancelling an update task, it won’t effect the completed replications (or disks). In other words, once the policy of completed replications (or disks) is already updated, the cancel operation won’t change policy back. Next time you execute the update API, the new task will also check the policy of completed replications, and will skip it since the policies are the same between the replication setting and the vSAN object.