Hi,
I'm working with vRO 7.6 and added vCenter 7.0 as endpoint to VRO. There is a workflow named "Change vCPU of VM" but I could not found any workflow about change vCPU reservation of VM.
I've checked existing workflows and tried to create a new one about this. I can change vcpu of vm with the following code marked with blue. But I can't change vCpu reservation with the following code marked with red. I'm getting the following error : "TypeError: Cannot read property "reservation" from null" What's wrong ?
You need to put everything into the configSpec and just run a single update task.
configSpec.cpu is an instance of VcResourceAllocationInfo. So something like
var myVcResourceAllocationInfo = new VcResourceAllocationInfo() ;
var myVcSharesInfo = new VcSharesInfo() ;
myVcSharesInfo.shares = 1000;
myVcSharesInfo.level = VcSharesLevel("normal") ;
myVcResourceAllocationInfo.shares = myVcSharesInfo;
configSpec.cpuAllocation = myVcResourceAllocaionInfo;
Then run your update. I haven't run that code so could be some typo's but that is the gist of it.
You need to put everything into the configSpec and just run a single update task.
configSpec.cpu is an instance of VcResourceAllocationInfo. So something like
var myVcResourceAllocationInfo = new VcResourceAllocationInfo() ;
var myVcSharesInfo = new VcSharesInfo() ;
myVcSharesInfo.shares = 1000;
myVcSharesInfo.level = VcSharesLevel("normal") ;
myVcResourceAllocationInfo.shares = myVcSharesInfo;
configSpec.cpuAllocation = myVcResourceAllocaionInfo;
Then run your update. I haven't run that code so could be some typo's but that is the gist of it.
Hi qc4vmware
I fixed the issue with your direction. Thank you very much.
var spec = new VcVirtualMachineConfigSpec();
spec.cpuAllocation = new VcResourceAllocationInfo();
spec.cpuAllocation.reservation = vcpureservation;
var task = vm.reconfigVM_Task(spec);