Maerth
Maerth

Reputation: 15

VM with multiple StorageProfiles

I'm using the .NET version of the vCloud SDK from VMware. I have a VM with two storages, one of type "x" and the other of type "y".

However, when calling vm.Resource.StorageProfile.name I only get the name of the first disk (x)

vCloudClient client = new vCloudClient(url,   com.vmware.vcloud.sdk.constants.Version.V1_5);
client.Login(userName,pass);
Organization organisation = Organization.GetOrganizationByReference(client, client.GetOrgRefsByName()[orgName]);
Vdc vdc = Vdc.GetVdcByReference(client,organisation.GetVdcRefByName(vdcName));
ReferenceType vappref = vdc.GetVappRefByName("myVappName");
Vapp vapp = Vapp.GetVappByReference(client,vappref);
List<VM> vms = vapp.GetChildrenVms();
foreach(VM vm in vms)
{
   //VM I'm having trouble with
   string storageprofile = vm.Resource.StorageProfile.name //returns value: x
}

Is there any other way to get both the "x" and "y" storages?

Upvotes: 1

Views: 291

Answers (2)

AdilZ
AdilZ

Reputation: 1197

Hey try parsing via the vdc storage profile instead

heres the link type for it:

"https://vcloud-example/api/query?type=orgVdcStorageProfile"

If that is not what you need you need to search for the Storage Profile list itself, where it gives href or a link type for EACH storage policy with their name and href type link for that specific storage policy

most probably vm.GetDisks gives you the storage policy "link" (im not sure, but i think it should, I dont use C#, but python and powershell)

Upvotes: 1

Dexion
Dexion

Reputation: 1101

vm.GetDisks should return all disks.

Upvotes: 0

Related Questions