VMware {code} Community
kbr5678
Contributor
Contributor

vAPP under vm

Hi..

In our environment we are using VMWare vSphere webservices SDK....VirtualMachine entity via we get vm properties like runtime,guest,config details.In this entity shows all vms except vApp under vms...We are not get the vApp under vm properties via VirtualMachine entity..suppose we getDynamiProperty method for vApp under vms collection those details..its take more time...Is any idea to get vApp under vm properties.

Thanks

Ramesh

0 Kudos
4 Replies
lamw
Community Manager
Community Manager

afaik, vApp attributes are tied to the VM themselves and this information is available in the config property of a VM: http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.vApp.VmConfigInfo.htm...

If you're not able to get any information, then the VM is probably not part of a vApp and this is the only place to retrieve this information.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
kbr5678
Contributor
Contributor

Thanks a lot..

Normally Virtualmachine Entity gives all Vms properties.....But our environment it gives only few vm properties(Which is not managed by vApps) .Is any Idea.Iam waiting for your inputs..here with i have attched code..

try{

String[][] typeinfo = new String[][] { new String[] { "VirtualMachine","name","datastore",

"guest,"config","runtime",

"summary,"resourceConfig"}};

ObjectContent[] ocary = getContentsRecursively(null, null, typeinfo, true);

if (ocary == null || ocary.length == 0) {

return null;

}

ObjectContent oc = null;

ManagedObjectReference mor = null;

DynamicProperty[] propary = null;

//String propval = null;

Hashtable ht_EsxHostVmRefs = new Hashtable();

for (int oci = 0; oci < ocary.length ; oci++)

{

lastRunTime = System.currentTimeMillis();

oc = ocary[oci];

propary = oc.getPropSet();

if (propary == null)

continue;

mor = oc.getObj();

System.out.println("MOR is "+mor);

}

}

catch(Exception e)

{

}

The output of Mob object is only not managed by vApps

0 Kudos
SMART3GGS
Contributor
Contributor

I have the same issue, my code is similar to yours, and the only VirtualMachines I get back are the ones NOT in vapps. Any vm that is in a VAPP is not returned.

Did you ever figure out what you needed to do to get the VirtualMachine information returned for the ones that are in VAPPs?

Does anyone know how you find the VirtualMachine (or MOR) information of VM's under VAPPS?

Thx

0 Kudos
lamw
Community Manager
Community Manager

vApp's are also considered resource pools, you'll basically want to query this information at the Datacenter level and then check whether it's an RP or vApp. Once you get back the vApp, you'll be able to extract the individual VMs within the vApp.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos