Quantcast
Channel: VMware Communities : Discussion List - Virtual Disk Development Kit
Viewing all articles
Browse latest Browse all 2039

Select Hot ADD CPU and Memory from .net sdk v5.5

$
0
0



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!


Viewing all articles
Browse latest Browse all 2039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>