VMware {code} Community
rmilkowski
Contributor
Contributor
Jump to solution

vSphere Storage Policy with replication group - Python API

Hi,

 

I have several storage policies defined, during VM creation (or later) I can assign one of them fine.

However, some storage policies (profiles) require replication (consistency?) groups with specific names - this is so an array will do snapshots of the VM on vvol. In vCenter when I assign such storage policy to a VM it asks me to select "Replication group" - only one is given each time (as each policy explicitly allows only a given replication group). But how do I query in python for which replication group(s) are allowed by a given storage policy and then how do I assign the replication group to a VM?

There is PbmQueryReplicationGroups() but si.RetrieveContent() reutnr handles to various manager but for the replicationManager it returns None for some reason, so I can't use it...

 

0 Kudos
1 Solution

Accepted Solutions
rmilkowski
Contributor
Contributor
Jump to solution

Fixed by specifying version11 instead of version1 in the below code.

Now PbmCheckRequirements() works fine.

 

 VmomiSupport.GetRequestContext()["vcSessionCookie"] = self.si._stub.cookie.split('"')[1]
 hostname = self.si._stub.host.split(":")[0]
 pbmStub = SoapStubAdapter(
 host=hostname,
 version="pbm.version.version11",
 path="/pbm/sdk",
 poolSize=0,
 sslContext=ssl._create_unverified_context())
 pbmServiceInstance = pbm.ServiceInstance("ServiceInstance", pbmStub)

View solution in original post

0 Kudos
1 Reply
rmilkowski
Contributor
Contributor
Jump to solution

Fixed by specifying version11 instead of version1 in the below code.

Now PbmCheckRequirements() works fine.

 

 VmomiSupport.GetRequestContext()["vcSessionCookie"] = self.si._stub.cookie.split('"')[1]
 hostname = self.si._stub.host.split(":")[0]
 pbmStub = SoapStubAdapter(
 host=hostname,
 version="pbm.version.version11",
 path="/pbm/sdk",
 poolSize=0,
 sslContext=ssl._create_unverified_context())
 pbmServiceInstance = pbm.ServiceInstance("ServiceInstance", pbmStub)

0 Kudos