Hi,
I want to check if a VM is capable for hot add of memory and CPU, before I enable it on the VM.
The code I use is this:
queryConfigOption = vm.environmentBrowser.queryConfigOption();
System.log("supportsMemoryHotAdd: " + queryConfigOption.guestOSDescriptor.supportsMemoryHotAdd);
But it always returns: undefined
[2014-08-14 14:17:14.857] [I] supportsMemoryHotAdd: undefined
When I do a System.log of queryConfigOption.guestOSDescriptor;
guestOSDescriptor = queryConfigOption.guestOSDescriptor;
System.debug ("guestOSDescriptor: " + guestOSDescriptor);
it returns 40+ lines of this:
[2014-08-14 14:17:14.857] [D] guestOSDescriptor: DynamicWrapper (Instance) : [VcGuestOsDescriptor]-[class com.vmware.vim.vi4.GuestOsDescriptor] -- VALUE : com.vmware.vim.vi4.GuestOsDescriptor@32bb86f7,DynamicWrapper (Instance) : [VcGuestOsDescriptor]-[class com.vmware.vim.vi4.GuestOsDescriptor] -- VALUE : com.vmware.vim.vi4.GuestOsDescriptor@7ab558bb,DynamicWrapper (Instance) : [VcGuestOsDescriptor]-[class com.vmware.vim.vi4.GuestOsDescriptor] -- VALUE : com.vmware.vim.vi4.GuestOsDescriptor@357c5000,DynamicWrapper (Instance) : [VcGuestOsDescriptor]-[class com.vmware.vim.vi4.GuestOsDescriptor] -- VALUE :...
What am I doing wrong?
And how can I check if the VM is hot add capable?
Thanks,
Jonathan
Hi Jonathan,
Is this what you need?
System.log(vm.config.cpuHotAddEnabled);
System.log(vm.config.memoryHotAddEnabled);
Hi,
No this just reports if it is enabled for the VM or not.
But not if it is capable of hot add of memory or CPU.
Hi
I think we need to first enable the hot add of memory and CPU in the vm.
The following will just tell you that ,if hot add of memory and CPU is enabled in the vm or not
System.log(vm.config.cpuHotAddEnabled);
System.log(vm.config.memoryHotAddEnabled);
Did you get the Fix??? I happen to have landed on the same spot !!
Hi,
Hot add capability based on Guest Os inside in the VM, If Guest OS support for hot add then only it will VMware hot add feature work.
So based on Guest OS you can identify hot add memory/ cup capability for specific VM.
Hello
Below are the Prerequisites for hot add of CPU and Memory
Verify that the virtual machine is running under the following conditions:
■ VMware Tools is installed (required for hot plug functionality with Linux guest operating systems).
■ The virtual machine has a guest operating system that supports CPU hot plug.
■ The virtual machine is using hardware version 7 or later.
■ CPU hot plug is enabled on the Options tab of the Virtual Machine Properties dialog box.
Procedure
1 In the vSphere Client inventory, right-click the virtual machine and select Edit Settings.
2 Click the Options tab and under Advanced, select Memory/CPU Hotplug.
3 Change the CPU Hot Plug setting.
■ Disable CPU hot plug for this virtual machine
■ Enable CPU hot add only for this virtual machine
■ Enable CPU hot add and remove for this virtual machine
4 Click OK to save your changes and close the dialog box.
NOW HERE IS THE SOLUTION
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
var configOption = vm.environmentBrowser.queryConfigOption(); // Note: vm = VC:VirtualMachine
var guestOsDescriptor = configOption.guestOSDescriptor;
for(var i = 0; i < guestOsDescriptor.length; i++){
var fullname = guestOsDescriptor[i].fullName;
if (fullname == GuestFullName){
System.log("supportsMemoryHotPlug "+": "+guestOsDescriptor[i].supportsMemoryHotAdd);
System.log("supportsCpuHotAdd "+": "+guestOsDescriptor[i].supportsCpuHotAdd);
System.log("supportsCpuHotRemove "+": "+guestOsDescriptor[i].supportsCpuHotRemove)
System.log("supportedMaxMemory "+": "+guestOsDescriptor[i].supportedMaxMemMB);
System.log("numSupportedCoresPerSocket"+": "+guestOsDescriptor[i].numSupportedCoresPerSocket);
System.log("numSupportedPhysicalSockets "+": "+guestOsDescriptor[i].numSupportedPhysicalSockets);
.............................................................................................................................................................................
YOU CAN GO ON AND GET THE VALUE OF ANY OF PROPERTIES CONTAINED IN THE
VC:GuestOsDescriptor.
...............................................................................................................................................................................
Your issue has been solved
hot add feature will work for only specific operating systems
windows data center edition supports hot add feature
Hi,
Hot-add and hot-plug are not enabled by default
There are 'toggle switches' that must be enabled in the configuration for each virtual machine in order for that VM to support hot-add or hot-plug. Some caveats: Whether or not the switches appear in a VM's configuration depends on the OS that vSphere is told is running inside that VM. In other words, if you configure a DOS VM and go into the configuration, there won't be an option to even enable hot-add/hot plug. However, if you create a new Windows 2008 Server VM, then you will see the proper switches. Secondly, the ability to use hot-add/hot-plug is not enabled by default. So, even if you create a new VM that is compatible with hot-add/hot-plug and power it on, the ability to use those features is disabled by default.
Also, keep in mind that to use hot-add/hot-plug, your virtual machine version must be version 7 or greater. If it isn't, you'll need to upgrade your virtual hardware first.
Below is the procedure for Hot add settings
The CPU hot plug option lets you add CPU resources for a virtual machine while the machine is powered on.
The following conditions apply:
Prerequisites
Verify that the virtual machine is running under the following conditions:
Procedure