VMware Cloud Community
jonathanvh
Enthusiast
Enthusiast

VM hot add memory/CPU capable

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

Reply
0 Kudos
11 Replies
robrtb12
Enthusiast
Enthusiast

Hi Jonathan,

Is this what you need?

System.log(vm.config.cpuHotAddEnabled);

System.log(vm.config.memoryHotAddEnabled);

Reply
0 Kudos
jonathanvh
Enthusiast
Enthusiast

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.

Reply
0 Kudos
sarikad
Contributor
Contributor

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);

Reply
0 Kudos
Ximp
Contributor
Contributor

Did you get the Fix??? I  happen to have landed on the same spot !!

Reply
0 Kudos
Kisan_VMware
Enthusiast
Enthusiast

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.

Reply
0 Kudos
karthikelango
Enthusiast
Enthusiast

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.

Reply
0 Kudos
Ximp
Contributor
Contributor

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.

...............................................................................................................................................................................

Reply
0 Kudos
Ximp
Contributor
Contributor

Your issue has been solved

Reply
0 Kudos
chaithu4u
Enthusiast
Enthusiast

hot add feature will work for only specific operating systems

windows data center edition supports hot add feature

Reply
0 Kudos
mohdhanifk
Enthusiast
Enthusiast

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.

Reply
0 Kudos
balarajugopinat
Enthusiast
Enthusiast

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:

 

For best results, use hardware version 8 virtual machines.

Hot-adding multicore virtual CPUs is supported only with hardware version 8 virtual machines.

Not all guest operating systems support CPU hot add. You can disable these settings if the guest is not supported.

To use the CPU hot-add feature with hardware version 7 virtual machines, set the Number of cores per socket to 1.

Adding CPU resources to a running virtual machine with CPU hot plug enabled disconnects and reconnects all USB passthrough devices connected to that virtual machine.

Verify that the virtual machine is running under the following conditions:

 

VMware Tools is installed. This condition is 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.

The virtual machine is powered off.

Required privileges: Virtual Machine.Configuration.Settings

1

Select a virtual machine.

In the virtual machines and templates inventory tree, select a group of virtual machines and select a virtual machine from the list on the right.

Search for a virtual machine and select it from the search results list.

2

In the VM Hardware panel, click Edit Settings.

3

Click Virtual Hardware.

4

Click the CPU triangle to expand the CPU options.

5

Select Enable CPU Hot Add to enable adding CPUs while this virtual machine is powered on.

6

Click OK.

Reply
0 Kudos