Enabling replication for a virtual machine a vCloud Availability deployment uses multiple steps and calls to the Web service API.

During the replication enablement process, the steps are completed by a vCloud Director administrator.


The following procedure contains long, single commands that should be run as one. There are breaks in the command for better visibility marked with "\". "#" marks the beginning of a new command.


When using the Web services API, you can use any tool that can set and request the required information. In the example below, the command-line tool curl. The process requires multiple steps, first to obtain the authorization, then the registration URL, and finally the call that performs the registration.


  1. Create some variables that are used in the rest of the process:
    ACCEPT='Accept: application/*+xml;version=5.6'
  2. Authenticate with the vCD API by using curl with the previously set variables. You use the authorization token returned in all further commands.
    # curl -k -o "$CONTENT" -D "$HEADERS" -X POST --user "$USER:$PASS" \
     -H "$ACCEPT" "https://${VCD_IP}/api/sessions"
  3. Extract the authorization code from the returned header information:
    # head -n1 $HEADERS
    # grep x-vcloud-authorization "$HEADERS" | awk -F : '{print $2}' | tr -d ' '
  4. Set a variable to contain the authorization code:
    # VCD_COOKIE=93f2f3f0c07a4355b3466812ddf9987e
  5. To identify the correct organization where the replication will be enabled, obtain a list of configured organizations:
    # curl -k -o "$CONTENT" -D "$HEADERS" \
     -H "x-vcloud-authorization: $VCD_COOKIE" \
     -H "$ACCEPT" https://${VCD_IP}/api/org
  6. Extract the organization:
    # head -n1 $HEADERS
    # cat $CONTENT | grep "application/vnd.vmware.vcloud.org+xml" | awk -F\" '{print $4 ":" $2}'
  7. Obtain a list of the VDCs within the organization:
    # curl -k -o "$CONTENT" -D "$HEADERS" -H "x-vcloud-authorization: $VCD_COOKIE" \
      -H "$ACCEPT"
    # head -n1 $HEADERS
    # cat $CONTENT | grep "application/vnd.vmware.vcloud.vdc+xml" | awk -F\" '{print $6 ":" $4}'
  8. To enable a replication to the selected organization, obtain the registration URL required:
    # curl -k -o "$CONTENT" -D "$HEADERS" -H "x-vcloud-authorization: $VCD_COOKIE" \
      -H "$ACCEPT"
    # head -n1 $HEADERS
    # cat $CONTENT | grep "enableReplication" | awk -F\" '{print $4}'
  9. Enable a replication by submitting a POST request using the URL retrieved in the previous step.
    # curl -k -o "$CONTENT" -D "$HEADERS" -X POST -H "x-vcloud-authorization: $VCD_COOKIE" \
      -H "$ACCEPT" \
    # head -n1 $HEADERS
    # cat $CONTENT | grep Link | grep "application/vnd.vmware.vcloud.task+xml" | \
      awk -F\" '{print $4}'
  10. Confirm that the task finishes successfully to enable a replication.
    # curl -k -o "$CONTENT" -D "$HEADERS" -H "x-vcloud-authorization: $VCD_COOKIE" \
      -H "$ACCEPT"
    # head -n1 $HEADERS
    # cat $CONTENT


Replication is now be enabled. If the task fails, look for the error, correct, and try to enable a replication again.