static void printFileVolumeInfo(HostFileSystemVolumeInfo info) { String[] volTypes = info.getVolumeTypeList(); for(int i=0; volTypes!=null && i<volTypes.length; i++) { System.out.println(volTypes[i]); } System.out.println("\nThe file system volumes mounted:"); HostFileSystemMountInfo[] mis = info.getMountInfo(); for(int i=0; mis!=null && i<mis.length; i++) { HostMountInfo hmi = mis[i].getMountInfo(); System.out.println("\nAccessible:" + hmi.getAccessible()); System.out.println("AccessMode:" + hmi.getAccessMode()); System.out.println("Path:" + hmi.getPath()); HostFileSystemVolume hfsv = mis[i].getVolume(); System.out.println("Capacity:" + hfsv.getCapacity()); System.out.println("Name:" + hfsv.getName()); System.out.println("Type:" + hfsv.getType()); } }
public boolean isAccessibleToHost(String hostValue) throws Exception { boolean isAccessible = true; List<DatastoreHostMount> hostMounts = getHostMounts(); for (DatastoreHostMount hostMount : hostMounts) { String hostMountValue = hostMount.getKey().getValue(); if (hostMountValue.equalsIgnoreCase(hostValue)) { HostMountInfo mountInfo = hostMount.getMountInfo(); isAccessible = mountInfo.isAccessible(); break; } } return isAccessible; }