예제 #1
0
  @Override
  protected void executeQueryCommand() {
    List<LUNs> luns = getLunsForVgId(getVgId());
    List<LUNs> nonDummyLuns = new ArrayList<>(luns.size());
    StorageType storageType = getStorageType(luns);
    Map<String, LUNs> lunsFromDeviceMap = getLunsFromDeviceMap(storageType);

    for (LUNs lun : luns) {
      // Filter dummy luns
      if (lun.getLUN_id().startsWith(BusinessEntitiesDefinitions.DUMMY_LUN_ID_PREFIX)) {
        continue;
      }
      nonDummyLuns.add(lun);

      // Update LUN's connections
      for (LUNStorageServerConnectionMap map : getLunConnections(lun.getLUN_id())) {
        addConnection(lun, getConnection(map.getstorage_server_connection()));
      }

      // Update LUN's 'PathsDictionary' by 'lunsFromDeviceList'
      LUNs lunFromDeviceList = lunsFromDeviceMap.get(lun.getLUN_id());
      if (lunFromDeviceList != null) {
        lun.setPathsDictionary(lunFromDeviceList.getPathsDictionary());
        lun.setPathsCapacity(lunFromDeviceList.getPathsCapacity());
        lun.setPvSize(lunFromDeviceList.getPvSize());
      }
    }

    setReturnValue(nonDummyLuns);
  }
 private void expectGetLunsMap(String lunId, String cnxId) {
   List<LUNStorageServerConnectionMap> ret = new ArrayList<>();
   LUNStorageServerConnectionMap map = new LUNStorageServerConnectionMap();
   map.setLunId(lunId);
   map.setStorageServerConnection(cnxId);
   ret.add(map);
   when(storageServerConnectionLunMapDao.getAll(lunId)).thenReturn(ret);
 }