Question

I'm using the .NET version of the vCloud SDK from VMWare. In my application, I'd like to show a list of the VMs that are currently running. To do this, I jump through a couple hoops to get a Vapp object, and then an enumeration of its child VMs.

Sadly however, there seems to be no way to identify each VM, other than by its IP address.

Is there a way to extract "full name" and description?

vCloudClient cli = new vCloudClient(url, com.vmware.vcloud.sdk.constants.Version.V1_5);
cli.Login(userName,pass);
Organization organisation = Organization.GetOrganizationByReference(cli, cli.GetOrgRefsByName()[orgName]);
Vdc vdc = Vdc.GetVdcByReference(cli,organisation.GetVdcRefByName(vdcName));
ReferenceType vappref = vdc.GetVappRefByName("myVappName");
Vapp vapp = Vapp.GetVappByReference(cli,vappref);
List<VM> vms = vapp.GetChildrenVms();
foreach(VM vm in vms)
{

}
Was it helpful?

Solution

In the terminology of the SDK, every VM is also a VcloudEntity<>, which has a Reference property of type ReferenceType.

So to get a VM's name (or the name of any vCD object for that matter), you can use vm.Reference.name.

I suppose it's not as intuitive as it could be... Took me some very long hours to find it at the time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top