VMware Cloud Community
DLally
Enthusiast
Enthusiast

Changing NIC portgroup and assigning state change to vCAC blueprint

Just starting with vCO and am in need of some guidance/assistance.  I've created a workflow that successfully creates and assigns a dvsportgroup.  What I'd really like is for it to change the NIC to the portgroup, but i think i can make it work if it has to create it.

Then my next question, how would I make this workflow callable from vCAC?  I've tried to Assign a state change to a blueprint, but get an error.

Key value must be a simple type, found: org.mozilla.javascript.Undefined (Dynamic Script Module name : updatePropertyFromBlueprint#2)

Here's my script.

var managedObject = vm;

// ------- ReconfigVM_Task -------

var spec = new VcVirtualMachineConfigSpec();

//spec.changeVersion = "2012-09-14T13:58:04.147363Z";

spec.deviceChange = System.getModule("com.vmware.onyx").array(VcVirtualDeviceConfigSpec, 1);

spec.deviceChange[0] = new VcVirtualDeviceConfigSpec();

spec.deviceChange[0].operation = VcVirtualDeviceConfigSpecOperation.add;

spec.deviceChange[0].device = new VcVirtualVmxnet3();

spec.deviceChange[0].device.key = -100;

var backingInfo = new VcVirtualEthernetCardDistributedVirtualPortBackingInfo();

var connection = new VcDistributedVirtualSwitchPortConnection();

connection.PortgroupKey = "dvportgroup-12638";

connection.SwitchUuid = "c8 48 39 50 9e ab 0b 07-f5 40 c3 4b b6 dd df 3f";

backingInfo.port = connection;

spec.deviceChange[0].device.backing = backingInfo;

spec.deviceChange[0].device.connectable = new VcVirtualDeviceConnectInfo();

spec.deviceChange[0].device.connectable.startConnected = true;

spec.deviceChange[0].device.connectable.allowGuestControl = true;

spec.deviceChange[0].device.connectable.connected = true;

spec.deviceChange[0].device.controllerKey = 100;

spec.deviceChange[0].device.addressType = "generated";

spec.deviceChange[0].device.wakeOnLanEnabled = true;

task = managedObject.reconfigVM_Task(spec);  // VirtualMachine

0 Kudos
1 Reply
DLally
Enthusiast
Enthusiast

If I change my script to VcVirtualDeviceConfigSpecOperation.edit, i just get invalid configuration for device '0'.

0 Kudos