VMware Cloud Community
vmwaredownload
Enthusiast
Enthusiast
Jump to solution

How to pull vapp template mem and cpu info

Hi Folks,

   As part of developing an approval workflow for instantiating an vApp, I need to pull the memory and cpu details for an vApp Template in vcloud director, which is in an catalog.

I'm not finding any option under "VclQueryResultAdminVAppTemplateRecord" in API Search.

Kindly advise.

0 Kudos
1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee
Jump to solution

Unfortunately, that info is not available while the Instantiate vAppTemplate task is being blocked. My team has reported this to engineering and asked that such additional information be made available via the api. Here's an example of the level of information we can currently extract during that blocking task:

User

  • Name : jdoe
  • Description :
  • Full Name : John Doe
  • Email Address : jdoe@rainpole.com
  • Telephone Number : (555) 555-1212
  • Instant Messenger ID :
  • Deployed VM Quota : Unlimited
  • Stored VM Quota : Unlimited
  • Role : vApp Author

vApp

  • Name : vApp_jdoe_4
  • Description :
  • VDC : Demo-Org-vDC
  • Creation Date : Sat Feb 11 2012 02:14:05 GMT-0000 (UTC)
  • Number of VMs : 2
  • Disk Size : 9728 MB
  • Storage Lease : Sat Feb 11 2012 03:14:05 GMT-0000 (UTC)

VM

  • Name : XP-Pro-TEMPLATE2
  • Guest OS : Microsoft Windows XP Professional (32-bit)
  • Network name : Test-NAT-Routed

VM

  • Name : blanktest
  • Guest OS : Microsoft Windows Server 2003, Standard Edition (32-bit)
  • Network name : Test-NAT-Routed
If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

0 Kudos
10 Replies
Burke-
VMware Employee
VMware Employee
Jump to solution

Unfortunately, that info is not available while the Instantiate vAppTemplate task is being blocked. My team has reported this to engineering and asked that such additional information be made available via the api. Here's an example of the level of information we can currently extract during that blocking task:

User

  • Name : jdoe
  • Description :
  • Full Name : John Doe
  • Email Address : jdoe@rainpole.com
  • Telephone Number : (555) 555-1212
  • Instant Messenger ID :
  • Deployed VM Quota : Unlimited
  • Stored VM Quota : Unlimited
  • Role : vApp Author

vApp

  • Name : vApp_jdoe_4
  • Description :
  • VDC : Demo-Org-vDC
  • Creation Date : Sat Feb 11 2012 02:14:05 GMT-0000 (UTC)
  • Number of VMs : 2
  • Disk Size : 9728 MB
  • Storage Lease : Sat Feb 11 2012 03:14:05 GMT-0000 (UTC)

VM

  • Name : XP-Pro-TEMPLATE2
  • Guest OS : Microsoft Windows XP Professional (32-bit)
  • Network name : Test-NAT-Routed

VM

  • Name : blanktest
  • Guest OS : Microsoft Windows Server 2003, Standard Edition (32-bit)
  • Network name : Test-NAT-Routed
If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

There is a workaround but quite ugly: download the vAppTemplate OVF and extract data from there.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
vmwaredownload
Enthusiast
Enthusiast
Jump to solution

Thanks Burke and Christophe,

       Is it possible to pull this info by running a REST operation via the HTTP-REST plugin or by running an SQL query via the SQL plugin.

I hav'nt gone through their documentation fully yet.

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

Using HTTP REST you will have similar limitations (i.e no Hardware details in the vAppTemplate). You would have to get the Template OVF, which requires enabling download (meaning vCenter export to vCD transfer share).

The difference may be that with HTTP REST you can download the OVF content directly to a string whereas using vCD API you need to download the ovf to a vCO local disk, and load it from a file to a string. The downside of HTTP REST is that you will need extra authentication.

The SQL route I would not advise since you have no guarantee the schema will be the same in different versions of vCD.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
vmwaredownload
Enthusiast
Enthusiast
Jump to solution

Hi Christophe,

     Thanks to this community post - http://communities.vmware.com/message/2030905#2030905

I'm able to find the ID of the VM in VC. example - vm-1095.

vms = new Array();
MoRefs = new Array();
for (var i in vAppvms){
var doc = new XML(vAppvms[i].toXml());
default xml namespace = doc.namespace();
System.log("Info for VM \n"+vAppvms[i].name)
System.log(vAppvms[i].toXml());
System.log("VM MoRef: "+doc.VCloudExtension.*::VmVimInfo.*::VmVimObjectRef.*::MoRef.toString());
MoRefs.push(""+doc.VCloudExtension.*::VmVimInfo.*::VmVimObjectRef.*::MoRef.toString()+"");
var org = vdc.parent;
var host = org.parent;
var providerVdcReference = vdc.toAdminObject().providerVdcReference;
var providerVdc = host.getEntityByReference(VclEntityType.PROVIDER_VDC ,providerVdcReference);
var adminExtProviderVdc = providerVdc.toAdminExtensionObject();
var vimServerUrls = adminExtProviderVdc.getVimServers();
var vimServerUrl = vimServerUrls[0].url
var vimServerHostName = vimServerUrl.substring(vimServerUrl.indexOf("://") + 3, vimServerUrl.lastIndexOf(":"));
}
for (var k in MoRefs){
vms.push(Server.findForType("VC:VirtualMachine", vimServerHostName + "/" + MoRefs[k]));
}

I'm not too well versed with VCO and hence need furthur guidance in how to use this VM object to obtain it's Memory and Cpu info.

Also is this is the right approach to obtain the configuration details of an vApp Template for now.

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

If this is a private cloud, using vCenter works. If a public cloud then I am affraid getting it from vAppTemplate.downloadOvf is the only solution for the moment.

To get it from a VC:virtualMachine try this:

cpuCount = vm.summary.config.numCpu;
memoryMB = vm.summary.config.memorySizeMB;

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
vmwaredownload
Enthusiast
Enthusiast
Jump to solution

Thanks Christophe,

       All that I have now is the VM id as an string. Ex - vm1055.

Kindly let me know as to how I can get the VC:virtualMachine object of this VM id.

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

Like this:

vcVm = Server.findForType("VC:VirtualMachine", vmMoref);

vmMoref being your vm ID.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
vmwaredownload
Enthusiast
Enthusiast
Jump to solution

It did not work Christohphe. Nevertheless I was able to pull the same using

vcVm = VcPlugin.getAllVirtualMachines(null, "xpath:id='"+vmMoref+"'");

But you did give me directions. Thanks for all the help.

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

I forgot that the VC objects ID are prefixed with the vcenter URL. The ID is:

vimServerHostName + "/" + vmMoref and not vmMoref since vCO can talk to several vCenter and need to differentiate the objects.

But you found a good solution as well.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos