dav3860 / vmbix

Fork of vmbix, a TCP proxy for querying a VMWare infrastucture with Zabbix
53 stars 19 forks source link

Problem with DatastoreInfo into method getDatastores #24

Closed acxadoom closed 8 years ago

acxadoom commented 8 years ago

Hi, we have a problem using NAS Datastore in Virtual center, for resolve this issue i add this code into getDatastores method :

            //Correction by Andrea for trap the NasDatastoreInfo
            if (d.getInfo() instanceof NasDatastoreInfo)
            {
                NasDatastoreInfo dsInfo = (NasDatastoreInfo) d.getInfo();
                if ( dsInfo != null ) {
                    HostNasVolume naaName = dsInfo.getNas();
                    JsonObject jObject = new JsonObject();
                    jObject.addProperty("{#DATASTORE}", d.getName());
                    //jObject.addProperty("{#UUID}", uuid);
                    jObject.addProperty("{#UUID}", "N/A");
                    jObject.addProperty("{#CLUSTER}", d.getParent().getName());
                    jObject.addProperty("{#LOCAL}", !d.getSummary().multipleHostAccess);
                    jObject.addProperty("{#NAA}", naaName.getName());
                    jArray.add(jObject); 
                }
            }
            else
            {
                VmfsDatastoreInfo dsInfo = (VmfsDatastoreInfo) d.getInfo();
                if ( dsInfo != null ) {
                    HostScsiDiskPartition[] naaName = dsInfo.getVmfs().extent;
                    JsonObject jObject = new JsonObject();
                    jObject.addProperty("{#DATASTORE}", d.getName());
                    //jObject.addProperty("{#UUID}", uuid);
                    jObject.addProperty("{#UUID}", dsInfo.getVmfs().getUuid());
                    jObject.addProperty("{#CLUSTER}", d.getParent().getName());
                    jObject.addProperty("{#LOCAL}", !d.getSummary().multipleHostAccess);
                    jObject.addProperty("{#NAA}", naaName[0].getDiskName());
                    jArray.add(jObject); 
                }
            }

If is correct for you add this code into branch code.

Bye.

   Andrea
dav3860 commented 8 years ago

Hi, I've just uploaded the version 2.0 which integrates your changes. Thank you !

acxadoom commented 8 years ago

Ok perfect.

Thanks.

   Andrea