Reply to Message

View discussion in a popup

Replying to:
asdt
Contributor
Contributor

No, that property works just fine. It fails for datasore and vm property. And I need them to find out the details of vm associated with each host. I am trying the below logic to handle these properties:

                      DynamicProperty[] pcary = null;

                      pcary = oc.propSet;

                      for (int i = 0; i < pcary.Length; i++)

                      {

                          pc = pcary[i];

                      

                              if ((pc.val.GetType() == typeof(Vim25Api.ManagedObjectReference[])))

                           

                              {

                                  Vim25Api.ManagedObjectReference[] dsList = (ManagedObjectReference[])pc.val;

                                  Vim25Api.ManagedObjectReference dsRef = null;

                                  for (int j = 0; j < dsList.Length; j++)

                                  {

                                      dsRef = dsList[j];

                                      if (dsRef.type.Equals("VirtualMachine"))

                                      {

                                          StringBuilder VM_Info2 = getvCenterVMsData(dsRef);

                                          VM_Info.Append(VM_Info2).Append("<VM>");

                                      }

                                      else

                                      {

                                          //ManagedObject is a datastore

                                          Object[] dsProps = getProperties(dsRef, new String[] { "summary.capacity",

                                                                                           "summary.freeSpace",

                                                                                            "summary.name",

                                                                                            "summary.type",

                                                                                            "summary.url"

                                                                                                        });

Reply
0 Kudos