Start a Conversation

Unsolved

X

3 Posts

8345

February 11th, 2019 15:00

RP4VM Protect VM via REST Call

I'm trying to use the REST API to protect VMs after a series of calls to get the source and destination parameters. However I feel the documentation is somewhat lacking with how to do this.

After generating a JSON file that looks to be what I want, I am returned with the following error:

 

"Unexpected token (END_OBJECT), expected FIELD_NAME: missing property 'JsonSubType' that is to contain type id (for class com.emc.fapi.version5_2.commons.ReplicateVmsParam) at [Source: org.apache.catalina.connector.CoyoteInputStream@42ae5db5; line: 1, column: 2863]"

Any advice/tips or sample JSON files that I could use to replicate to a non-existing VM? The documentation has a JSON for a VM that already exists at the remote site. I've tried adapting that to what I have.

 

My JSON file is as below:

{
"cgName": cgName,
"productionCopy": {
"clusterUID": {
"id": source_clusterUID
},
"copyUID": 0
},
"productionCopyName": prodName,
"vmReplicationSets": [{
"replicationSetVms": [{
"copyUID": 0,
"vmParam": {
"JsonSubType": "SourceVmParam",
"vmUID": {
"uuid": source_vm_uuid,
"virtualCenterUID": {
"uuid": source_vc_uuid
}
},
"clusterUID": {
"id": source_clusterUID
}
},
"vmParam": {
"JsonSubType": "CreateVMParam",
"targetVirtualCenterUID": {
"uuid": dest_vc_uuid
},
"targetResourcePlacementParam": {
"JsonSubType": "CreateTargetVMAutomaticResourcePlacementParam",
"targetResourcePoolUID": {
"uuid": dest_virtual_resource_pool_uuid
}
},
"targetDatastoreUID": {
"uuid": dest_datastore_uuid
},
"networkDevices": [],
"clusterUID": {
"id": source_clusterUID
}
}
}],
"virtualHardwareReplicationPolicy": {
"provisionPolicy": "SAME_AS_SOURCE",
"hwChangesPolicy": "REPLICATION_HW_CHANGES"
},
"virtualDisksReplicationPolicy": {
"autoReplicationNewVirtualDisks": "true"
}
}],
"links": [{
"linkUID": {
"groupUID": {
"id": cg_uid
},
"firstCopy": {
"clusterUID": {
"id": source_clusterUID
},
"copyUID": 0
},
"secondCopy": {
"clusterUID": {
"id": dest_clusterUID
},
"copyUID": 0
}
},
"linkPolicy": {
"JsonSubType": "ConsistencyGroupLinkPolicy",
"protectionPolicy": {
"protectionType": "ASYNCHRONOUS",
"syncReplicationLatencyThresholds": {
"thresholdEnabled": "false",
"startAsyncReplicationAbove": {
"value": 5000,
"type": "MICROSECONDS"
},
"resumeSyncReplicationBelow": {
"value": 3000,
"type": "MICROSECONDS"
}
},
"syncReplicationThroughputThresholds": {
"thresholdEnabled": "false",
"startAsyncReplicationAbove": {
"value": 45000,
"type": "KB"
},
"resumeSyncReplicationBelow": {
"value": 35000,
"type": "KB"
}
},
"rpoPolicy": {
"maximumAllowedLag": {
"value": 15,
"type": "MINUTES"
},
"allowRegulation": "false",
"minimizationType": "MINIMIZE_BANDWIDTH"
},
"replicatingOverWAN": "true",
"compression": "MEDIUM",
"bandwidthLimit": 0.0,
"measureLagToTargetRPA": "true",
"deduplication": "true",
"weight": 1
},
"advancedPolicy": {
"performLongInitialization": "true",
"snapshotGranularity": "DYNAMIC"
}
}
}],
"startTransfer": "true",
"copies": [
{
"copyUID": {
"clusterUID": {
"id": source_clusterUID
},
"copyUID": 0
},
"copyName": sourceCopyName,
"volumeCreationParams": {
"volumeParams": [{
"JsonSubType": "VolumeCreationParams",
"arrayUid": {
"id": source_arrayUID,
"clusterUID": {
"id": source_clusterUID
}
},
"poolUid": {
"uuid": source_virtual_resource_pool_uuid,
"storageResourcePoolId": source_datastore_moid,
"arrayUid": {
"id": source_arrayUID,
"clusterUID": {
"id": source_clusterUID
}
}
},
"resourcePoolType": "VC_DATASTORE"
}]
}
},
{
"copyUID": {
"clusterUID": {
"id": dest_clusterUID
},
"copyUID": 0
},
"copyName": destCopyName,
"volumeCreationParams": {
"volumeParams": [{
"JsonSubType": "VolumeCreationParams",
"arrayUid": {
"id": dest_arrayUID,
"clusterUID": {
"id": dest_clusterUID
}
},
"poolUid": {
"uuid": dest_virtual_resource_pool_uuid,
"storageResourcePoolId": dest_datastore_moid,
"arrayUid": {
"id": dest_arrayUID,
"clusterUID": {
"id": dest_clusterUID
}
}
},
"resourcePoolType": "VC_DATASTORE"
}]
}
}
]
}

Thanks!

1 Message

March 8th, 2019 13:00

Did you have any luck figuring this out? I'm attempting to do the same thing and am struggling with the convoluted sample JSON in the documentation. I have found zero instances online of anyone successfully protecting a VM using RP4VM's REST API, and the official documentation leaves a lot to be desired. If you were successful with this, it would be awesome if you can post your updated JSON.

April 1st, 2019 03:00

Hi,

I have the same problem, I'm trying to replicate a VM using RESTAPI but I don't find the complete RESTAPI documentation. Please, anyone know where can I find some document where I can see all methods and parameters?

 

I have seen the pdf "docu89863_RecoverPoint-for-Virtual-Machines-5.2-REST-API-Guide.pdf" but there is very limited info.

 

Thanks and regards,

 

Francisco Tomas.

7 Posts

April 24th, 2019 01:00

Hi,

I'm currently working on the same problem... Accessing RP4VM with abstract classes fails with no good explaination.

Some time has passed since the original post. Did anyone find a solution and can provide a JSON example?

May 7th, 2019 23:00

Hello, Please see if the below helps Create CG POST – https://10.108.145.119/fapi/rest/5_1/groups/virtual_machines/replicate { "JsonSubType" : "ReplicateVmsParam", "cgName" : "SampleCGName", "productionCopy" : { "clusterUID" : { "id" : 3609727980236804096 }, "copyUID" : 0 }, "productionCopyName" : null, "vmReplicationSets" : [ { "replicationSetVms" : [ { "copyUID" : { "clusterUID" : { "id" : 3609727980236804096 }, "copyUID" : 1 }, "vmParam" : { "JsonSubType" : "CreateVMParam", "targetVirtualCenterUID" : { "uuid" : "7223C5B7-1943-4071-A4E9-66AAE98A7121" }, "targetResourcePlacementParam" : { "JsonSubType" : "CreateTargetVMManualResourcePlacementParam", "targetEsxUID" : { "uuid" : "host-23" } }, "targetDatastoreUID" : { "uuid" : "datastore-6512" } } }, { "copyUID" : { "clusterUID" : { "id" : 3609727980236804096 }, "copyUID" : 0 }, "vmParam" : { "JsonSubType" : "ExistingVMParam", "vmUID" : { "uuid" : "500c4ec2-50c1-0123-9e98-f557b592fc13", "virtualCenterUID" : { "uuid" : "7223C5B7-1943-4071-A4E9-66AAE98A7121" } } } } ], "virtualHardwareReplicationPolicy" : { "provisionPolicy" : "SAME_AS_SOURCE", "hwChangesPolicy" : "REPLICATE_HW_CHANGES", "replicateMACAddress" : false }, "virtualDisksReplicationPolicy" : { "autoReplicateNewVirtualDisks" : true, "diskSettings" : [ { "diskId" : { "unitNumber" : 0, "controller" : 0, "controllerType" : "CONTROLLER_TYPE_SCSI" }, "included" : true } ] } } ], "links" : [ { "linkUID" : { "groupUID" : null, "firstCopy" : { "clusterUID" : { "id" : 3609727980236804096 }, "copyUID" : 0 }, "secondCopy" : { "clusterUID" : { "id" : 3609727980236804096 }, "copyUID" : 1 } }, "linkPolicy" : { "JsonSubType" : "ConsistencyGroupLinkPolicy", "protectionPolicy" : { "protectionType" : "ASYNCHRONOUS", "syncReplicationLatencyThresholds" : { "thresholdEnabled" : false, "startAsyncReplicationAbove" : { "value" : 5000, "type" : "MICROSECONDS" }, "resumeSyncReplicationBelow" : { "value" : 3000, "type" : "MICROSECONDS" } }, "syncReplicationThroughputThresholds" : { "thresholdEnabled" : false, "startAsyncReplicationAbove" : { "value" : 45000, "type" : "KB" }, "resumeSyncReplicationBelow" : { "value" : 35000, "type" : "KB" } }, "rpoPolicy" : { "maximumAllowedLag" : { "value" : 25, "type" : "SECONDS" }, "allowRegulation" : false, "minimizationType" : "IRRELEVANT" }, "replicatingOverWAN" : false, "compression" : "NONE", "bandwidthLimit" : 0.0, "measureLagToTargetRPA" : true, "deduplication" : false, "weight" : 1 }, "advancedPolicy" : { "performLongInitialization" : true, "snapshotGranularity" : "FIXED_PER_SECOND" }, "snapshotShippingPolicy" : null } } ], "startTransfer" : true, "copies" : [ { "JsonSubType" : "ConsistencyGroupCopyParam", "copyUID" : { "clusterUID" : { "id" : 3609727980236804096 }, "copyUID" : 1 }, "copyName" : "replicaCp", "volumeCreationParams" : { "volumeParams" : [ { "JsonSubType" : "VolumeCreationParams", "volumeSize" : { "sizeInBytes" : 10737418240 }, "arrayUid" : { "id" : 262129646546525333, "clusterUID" : { "id" : 3609727980236804096 } }, "poolUid" : { "uuid" : 38081123845707144, "storageResourcePoolId" : "datastore-6514", "arrayUid" : { "id" : 262129646546525333, "clusterUID" : { "id" : 3609727980236804096 } } }, "tieringPolicy" : null, "resourcePoolType" : "VC_DATASTORE" } ] } }, { "JsonSubType" : "ConsistencyGroupCopyParam", "copyUID" : { "clusterUID" : { "id" : 3609727980236804096 }, "copyUID" : 0 }, "copyName" : "prdCp", "volumeCreationParams" : { "volumeParams" : [ { "JsonSubType" : "VolumeCreationParams", "volumeSize" : { "sizeInBytes" : 10737418240 }, "arrayUid" : { "id" : 262129646546525333, "clusterUID" : { "id" : 3609727980236804096 } }, "poolUid" : { "uuid" : 21528747797692195, "storageResourcePoolId" : "datastore-6513", "arrayUid" : { "id" : 262129646546525333, "clusterUID" : { "id" : 3609727980236804096 } } }, "tieringPolicy" : null, "resourcePoolType" : "VC_DATASTORE" } ] } } ] } Regards Raghav

3 Posts

July 3rd, 2019 00:00

Hi  Viswanathan,

Need some help, please suggest how do we get the VM uuid through REST API for a source VM, such that we can populate the below replicate VM parameter.

 

"vmParam": {

                              "JsonSubType": "ExistingVMParam",

                              "vmUID": {

                                   "uuid": "502236e5-38ce-a578-98cd-96ea5fee0445",

 

3 Posts

July 3rd, 2019 00:00

Hello xyker, Need some help, please suggest how do we get the VM uuid through REST API for a source VM, such that we can populate the below replicate VM parameter. "vmParam": { "JsonSubType": "ExistingVMParam", "vmUID": { "uuid": "502236e5-38ce-a578-98cd-96ea5fee0445",

675 Posts

July 3rd, 2019 00:00

This should be retrieved directly from vCenter (vSphere API / PowerCLI / etc.) as RPVM does not track and present VMs that are not protected yet.

675 Posts

July 3rd, 2019 01:00

That's right because we don't have a call which will show you the VM UUID of a VM we're not protecting yet. To clarify my previous response, this is something you'll need to query vCenter for.

3 Posts

July 3rd, 2019 01:00

Thanks for suggestion.

But i want know Which Vcenter Api. i have checked all Vcenter api(https://{}:7225/fapi/rest/5_2/recoverpoint.wadl) but  not found any api to reponse  vmUUI(uuid)..

Please help me in this regards.

13 Posts

September 26th, 2019 18:00

Just google and you can find the one-liner you need 

https://communities.vmware.com/thread/152365

Get-VM   | %{(Get-View $_.Id).config.uuid}  

No Events found!

Top