VMware {code} Community
rmilkowski
Contributor
Contributor

SPBM and consistency/replication groups

Hi,

 

I'm trying to automate assignment of SPBM policies to VMs (both during VM creation and also for existing VMs) on VVOLs.

I hit an issue with SPBM policies with consistency group defined though. In vcenter gui if I try to assign a storage policy to a VM which specifies snapshot intervals and retention and also replication group (sometimes called consistency group) then I have to select which replication group to use, in this case only one (matching what;s required by the policy) will be present. When selected then I can assign the policy to a VM fine.

However, how do I do it from Python?

The automation SDK doesn't seem to support consistency groups at all - looks like one can only assign SPBM policies without any snapshotting defined.

In case of pyvmomi it does seem to be supporting it by setting vim.vm.replication.ReplicationSpec() which requires replicatiionGroupId. It should be possible to obtain it via placementSolver.PbmCheckCompatibility()->matchingResources but for some reason I always get an empty list:

 

pbm.placement.CompatibilityResult) [
(pbm.placement.CompatibilityResult) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
hub = (pbm.placement.PlacementHub) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
hubType = 'Datastore',
hubId = 'datastore-2433'
},
matchingResources = (pbm.placement.MatchingResources) [],
howMany = <unset>,
utilization = (pbm.placement.ResourceUtilization) [],
warning = (vmodl.MethodFault) [],
error = (vmodl.MethodFault) []
}
]

 

Interestingly though, if I query via web browser via vcenter/pbm/mob then it does return marchingResources with replication group id... so it seems it is a bug in pyvmomi. The PbmCheckCompatibility() is depricated though and I think one is supposed to use placementSolver.PbmCheckRequirements(), however this one just fails with:

 

...

placement_results = placementSolver.PbmCheckRequirements(hubsToSearch=[hub], placementSubjectRef=pbmRef, placementSubjectRequirement=pbmReq)
File "/var/tmp/hdb-tool_venv/lib64/python3.7/site-packages/pyVmomi/VmomiSupport.py", line 706, in <lambda>
self.f(*(self.args + (obj,) + args), **kwargs)
File "/var/tmp/hdb-tool_venv/lib64/python3.7/site-packages/pyVmomi/VmomiSupport.py", line 512, in _InvokeMethod
return self._stub.InvokeMethod(self, info, args)
File "/var/tmp/hdb-tool_venv/lib64/python3.7/site-packages/pyVmomi/SoapAdapter.py", line 1345, in InvokeMethod
req = self.SerializeRequest(mo, info, args)
File "/var/tmp/hdb-tool_venv/lib64/python3.7/site-packages/pyVmomi/SoapAdapter.py", line 914, in SerializeRequest
method=info.name)
pyVmomi.VmomiSupport.MethodNotFound: (vmodl.fault.MethodNotFound) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
msg = <unset>,
faultCause = <unset>,
faultMessage = (vmodl.LocalizableMessage) [],
receiver = 'pbm.placement.PlacementSolver:placementSolver',
method = 'CheckRequirements'
}

 

I submitted:

   https://github.com/vmware/pyvmomi/issues/934

   https://github.com/vmware/pyvmomi/issues/935

but no reply so far.

 

So back to the original question, how one can assign SPBM policy and select/specify replication/consistency group to a given VM (and for all or each of its vdisks as well) either via pyvmomi, SDK automation or some other API in python?

 

 

Reply
0 Kudos
0 Replies