VMware Cloud Community
robrtb12
Enthusiast
Enthusiast

How to remove a VcClusterDrsVmConfigSpec

Hello,

I've experienced some issues over the last couple of years deploying a VM from a template in a workflow.  In my custom workflow I power off and power on the VM a couple of times (DVPortgroup 'dynamic binding', OS configs, etc.) and occasionally vCenter migrates the VM to a new host.  i'm a little OCD in the fact that I want to elimate all possible failures during the workflow.  I discoved that I could disable DRS for the VM.  While proofing this yesterday I was able to Add a VcClusterDrsVmConfigSpec to the Cluster however, I wasn't able to remove the VcClusterDrsVmConfigSpec from the Cluster; for when the deployment is complete.

Here's what we're running:

vCenter 4.1.0 (Build 345043) - they will be applying Update3 to the vCenter this weekend.

vCO 4.2.0 (Build 5277)  - using vCenter plug-in 5.0.2

Using Onyx (2.1.4226) here is the code generated:

...

spec.drsVmConfigSpec = System.getModule("com.vmware.onyx").array(VcClusterDrsVmConfigSpec, 1);

spec.drsVmConfigSpec[0] = new VcClusterDrsVmConfigSpec();

spec.drsVmConfigSpec[0].operation = VcArrayUpdateOperation.remove;

spec.drsVmConfigSpec[0].removeKey = vm-451566;

...

When I try to pass 'vm.id' to 'removeKey', I get error:  Task 'ReconfigureComputeResource_Task' error: A specified parameter was not correct.

Looking in the 5.0 plug-in API i see that 'removeKey' is Deprecated.
Using 'removeKey_IntValue' passing 'vm.id' or 'vm' or '451566' they all fail as well.

Is there something I'm missing when removing the VcClusterDrsVmConfigSpec entry?

Thank you for your help!

1 Reply
simon1234
Contributor
Contributor

Hi robrtb12,

var mo = new VcManagedObjectReference();

mo.type = "VirtualMachine";

mo.value = vm.id;

dasSpec.operation = VcArrayUpdateOperation.remove;

dasSpec.removeKey = mo;

works for me.

Kind regards,

Simon