I am trying to make a vm hot add enabled for cpu and memory, but the changes do not seem to stick. I get no errors. Here is my code
**power off vm in another function
workerVm = GetVM(orgName, vmName);
VmType vmType = new VmType();
vmType = workerVm.GetResource();
VmCapabilitiesType vmCapabilitiesType = new VmCapabilitiesType();
vmCapabilitiesType = vmType.VmCapabilities;
vmType.needsCustomization = true;
if (vmCapabilitiesType.CpuHotAddEnabled != cpuHot)
vmCapabilitiesType.CpuHotAddEnabled = cpuHot;
if (vmCapabilitiesType.MemoryHotAddEnabled != memoryHot)
vmCapabilitiesType.MemoryHotAddEnabled = memoryHot;
vmType.VmCapabilities = vmCapabilitiesType;
task = workerVm.UpdateVM(vmType);
task.WaitForTask(0);
task = workerVm.UpdateHotAdd(memoryHot, cpuHot);
task.WaitForTask(0);
GuestCustomizationSectionType guestCustomizationSection = workerVm.GetGuestCustomizationSection();
if (!guestCustomizationSection.Enabled)
{
guestCustomizationSection.Enabled = true;
task = workerVm.UpdateSection(guestCustomizationSection);
task.WaitForTask(0);
}
**Turn on vm in another function
I would be very grateful for any assistance!