So, I get the error message above and in full here:
TypeError: Cannot find function reconfigVM_Task in object DynamicWrapper (Instance) : [VcVirtualMachine]-[class com.vmware.o11n.plugin.vsphere_gen.VirtualMachine_Wrapper] -- VALUE : Stub: moRef = (ManagedObjectReference: type = VirtualMachine, value = vm-xxxxxx, serverGuid = null), binding = https://vcenterserverhere:443/sdk. (Workflow:Send Backup Requirement Notification / Send Email to lists (item0)#34)
The code here and the last line is what throws the error:
Hi
The problem is here in this code
query = "xpath:name='" + serverName + "'";
//vm=VcPlugin.findAllForType("VC:VirtualMachine", query);
// this returns an VcVirtualMachine[] (i.e., an array of VMs!)
vm = VcPlugin.getAllVirtualMachines(null, query);
// this is the *real* VcVirtualMachine
vmObject=vm[0];
// NOTE: This is safe to apply with powered on VM
//var task = vm.reconfigVM_Task(configSpec); -- I have tried this with and without the "var task = "
// change this call to this & you should be sorted
var task = vmObject.reconfigVM_Task(configSpec);
The change on the last line there should fix the problem
-HTH
I can validate that function reconfigVM_Task() exist for type VC:VirtualMachine if this was your original question as I was able to reconfigure my VM using the below code where I increased the single HDD size to 95GBs.
var spec = new VcVirtualMachineConfigSpec();
var deviceChange = new Array();
deviceChange[0] = new VcVirtualDeviceConfigSpec();
deviceChange[0].device = new VcVirtualDisk();
deviceChange[0].device.shares = new VcSharesInfo();
deviceChange[0].device.shares.shares = 1000;
deviceChange[0].device.shares.level = VcSharesLevel.normal;
deviceChange[0].device.capacityInBytes = 102005473280;
deviceChange[0].device.storageIOAllocation = new VcStorageIOAllocationInfo();
deviceChange[0].device.storageIOAllocation.shares = new VcSharesInfo();
deviceChange[0].device.storageIOAllocation.shares.shares = 1000;
deviceChange[0].device.storageIOAllocation.shares.level = VcSharesLevel.normal;
deviceChange[0].device.storageIOAllocation.limit = -1;
deviceChange[0].device.storageIOAllocation.reservation = 0;
deviceChange[0].device.backing = new VcVirtualDiskFlatVer2BackingInfo();
deviceChange[0].device.backing.backingObjectId = '';
deviceChange[0].device.backing.fileName = '[SVM_DATA_T2_03_TEST_DEV] testvm1-jINq/testvm1-jINq.vmdk';
deviceChange[0].device.backing.split = false;
deviceChange[0].device.backing.writeThrough = false;
deviceChange[0].device.backing.datastore = Server.findForType("VC:Datastore", myVcVirtualMachine.vimHost.id + "/datastore-24994");
deviceChange[0].device.backing.eagerlyScrub = false;
deviceChange[0].device.backing.contentId = '4757381237af512bda5d92adfffffffe';
deviceChange[0].device.backing.thinProvisioned = true;
deviceChange[0].device.backing.diskMode = 'persistent';
deviceChange[0].device.backing.digestEnabled = false;
deviceChange[0].device.backing.sharing = 'sharingNone';
deviceChange[0].device.backing.uuid = '6000C296-fa2c-fdbe-c383-ce5727d9d089';
deviceChange[0].device.controllerKey = 1000;
deviceChange[0].device.unitNumber = 0;
deviceChange[0].device.nativeUnmanagedLinkedClone = false;
deviceChange[0].device.capacityInKB = 99614720;
deviceChange[0].device.deviceInfo = new VcDescription();
deviceChange[0].device.deviceInfo.summary = '94,371,840 KB';
deviceChange[0].device.deviceInfo.label = 'Hard disk 1';
deviceChange[0].device.diskObjectId = '21-2000';
deviceChange[0].device.key = 2000;
deviceChange[0].operation = VcVirtualDeviceConfigSpecOperation.edit;
spec.deviceChange = deviceChange;
var cpuFeatureMask = new Array();
spec.cpuFeatureMask = cpuFeatureMask;
myVcVirtualMachine.reconfigVM_Task(spec);
I know the function exists, I am not sure why it throws the error when I try to use it in that specific code. It works in the native workflows, just not here.
Hi
The problem is here in this code
query = "xpath:name='" + serverName + "'";
//vm=VcPlugin.findAllForType("VC:VirtualMachine", query);
// this returns an VcVirtualMachine[] (i.e., an array of VMs!)
vm = VcPlugin.getAllVirtualMachines(null, query);
// this is the *real* VcVirtualMachine
vmObject=vm[0];
// NOTE: This is safe to apply with powered on VM
//var task = vm.reconfigVM_Task(configSpec); -- I have tried this with and without the "var task = "
// change this call to this & you should be sorted
var task = vmObject.reconfigVM_Task(configSpec);
The change on the last line there should fix the problem
-HTH
Thank you for that!