Java 类com.vmware.vim25.HostScsiTopology 实例源码

项目:vijava    文件:PrintStorageSystem.java   
static void printStorageDeviceInfo(HostStorageDeviceInfo hsdi)
{
  System.out.println("\nHost bus adapters");
  printHBAs(hsdi.getHostBusAdapter());

  System.out.println("\nMultipath information");
  HostMultipathInfo hmi = hsdi.getMultipathInfo();
  printMultiPathInfo(hmi);

  System.out.println("\nSCSI LUNs");
  printScsiLuns(hsdi.getScsiLun());

  HostScsiTopology hst = hsdi.getScsiTopology();
  printScsiTopology(hst);

  System.out.println("\nSoftware iSCSI enabled:" 
      + hsdi.isSoftwareInternetScsiEnabled());
}
项目:vijava    文件:PrintStorageSystem.java   
static void printScsiTopology(HostScsiTopology hst)
{
  HostScsiTopologyInterface[] hstis = hst.getAdapter();

  for(int i=0; hstis!=null && i<hstis.length; i++)
  {
    System.out.println("Adapter:" + hstis[i].getAdapter());
    System.out.println("Key:" + hstis[i].getKey());
    HostScsiTopologyTarget[] hstts = hstis[i].getTarget();

    for(int j=0; hstts!=null && j<hstts.length; j++)
    {
      System.out.println("Key:" + hstts[j].getKey());
      System.out.println("Target:" + hstts[j].getTarget());
      System.out.println("Transport:" 
          + hstts[j].getTransport().getClass().getName());
      HostScsiTopologyLun[] luns = hstts[j].getLun();
      for(int k=0; luns!=null && k<luns.length; k++)
      {
        System.out.println("Key:" + luns[k].getKey());
        System.out.println("LUN:" + luns[k].getLun());
        System.out.println("ScsiLun:" + luns[k].getScsiLun());
      }
    }
  }
}
项目:cloudstack    文件:VmwareStorageProcessor.java   
private static HostScsiDisk getHostScsiDisk(HostScsiTopology hst, List<HostScsiDisk> lstHostScsiDisks, String iqn) {
    for (HostScsiTopologyInterface adapter : hst.getAdapter()) {
        if (adapter.getTarget() != null) {
            for (HostScsiTopologyTarget target : adapter.getTarget()) {
                if (target.getTransport() instanceof HostInternetScsiTargetTransport) {
                    String iScsiName = ((HostInternetScsiTargetTransport)target.getTransport()).getIScsiName();

                    if (iqn.equals(iScsiName)) {
                        for (HostScsiDisk hostScsiDisk : lstHostScsiDisks) {
                            for (HostScsiTopologyLun hstl : target.getLun()) {
                                if (hstl.getScsiLun().contains(hostScsiDisk.getUuid())) {
                                    return hostScsiDisk;
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    return null;
}