VMware Cloud Community
Camberton
Enthusiast
Enthusiast
Jump to solution

Get VM memory reservation in workflow

Hi,

I have a simple question : how can i retrieve the memory reservation for a virtual machine ?

I get the actual memory with "myvar = VirtualMachine.config.hardware.memoryMB; " but for reservation i don't know.

I've tested : "myvar2 = VirtualMachine.memoryAllocation.VcResourceAllocationInfo.reservation;" but it doesen't work.

Best regards

0 Kudos
1 Solution

Accepted Solutions
tschoergez
Leadership
Leadership
Jump to solution

Using Managed object browser I figured out: You should be able to access the reservation settings for a VM object via the attribute path

resourceConfig.memoryAllocation.reservation



View solution in original post

0 Kudos
8 Replies
tschoergez
Leadership
Leadership
Jump to solution

You can use Onyx (http://labs.vmware.com/flings/onyx) to figure out the proper API call...

Cheers,

Joerg

0 Kudos
Camberton
Enthusiast
Enthusiast
Jump to solution

In fact, i want to display the reservation value.

I'm using onyx who help me to set the reservation, but i don't know to how to get the value.

If i'm right, Onyx only display something on change configuration ?

Regards

0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

Good point. Onyx indeed helps mainly for changing configuration settings, not just to view them.

To view the attributes, you can use the managed object browser in vCenter. Maybe the onyx output at least might point you in the proper direction.

Cheers,

Joerg

0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

Using Managed object browser I figured out: You should be able to access the reservation settings for a VM object via the attribute path

resourceConfig.memoryAllocation.reservation



0 Kudos
Camberton
Enthusiast
Enthusiast
Jump to solution

Yes Smiley Happy

I searched in the API explorer and the online documentation before posting but many things i don't understand Smiley Sad

0 Kudos
Camberton
Enthusiast
Enthusiast
Jump to solution

It works ! My real problem is to find and understand objects.

Thanks Joerg

Regards

0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

Cool, thanks for the feedback!

IMHO there is no real way to "learn" the vCenter API and the data models, it's just experience. Use the managed object browser (MOB) extensively, and just "browse" around there. Try to align the attributes and values you see in the MOB with what you see in the vSphere Client.

And consider to buy this book: http://www.amazon.com/VMware-VI-vSphere-SDK-Infrastructure/dp/0137153635

It's written for vCenter 4, but all the content is still valid, it just misses some new things in version 5.

Cheers,

Joerg

0 Kudos
Camberton
Enthusiast
Enthusiast
Jump to solution

Many thanks !

I will see that.

Regards

0 Kudos