@VisibleForTesting
  synchronized List<StorageDirectory> addStorageLocations(DataNode datanode,
      NamespaceInfo nsInfo, Collection<StorageLocation> dataDirs,
      StartupOption startOpt) throws IOException {
    final int numThreads = getParallelVolumeLoadThreadsNum(
        dataDirs.size(), datanode.getConf());
    final ExecutorService executor = Executors.newFixedThreadPool(numThreads);
    try {
      final List<StorageLocation> successLocations = loadDataStorage(
          datanode, nsInfo, dataDirs, startOpt, executor);

      if (successLocations.isEmpty()) {
        return Lists.newArrayList();
      }

      return loadBlockPoolSliceStorage(
          datanode, nsInfo, successLocations, startOpt, executor);
    } finally {
      executor.shutdown();
    }
  }
@Test
  public void testMissingVersion() throws IOException,
      URISyntaxException {
    final int numLocations = 1;
    final int numNamespace = 1;
    List<StorageLocation> locations = createStorageLocations(numLocations);

    StorageLocation firstStorage = locations.get(0);
    Storage.StorageDirectory sd = new Storage.StorageDirectory(firstStorage);
    // the directory is not initialized so VERSION does not exist
    // create a fake directory under current/
    File currentDir = new File(sd.getCurrentDir(),
        "BP-787466439-172.26.24.43-1462305406642");
    assertTrue("unable to mkdir " + currentDir.getName(), currentDir.mkdirs());

    // Add volumes for multiple namespaces.
    List<NamespaceInfo> namespaceInfos = createNamespaceInfos(numNamespace);
    for (NamespaceInfo ni : namespaceInfos) {
      storage.addStorageLocations(mockDN, ni, locations, START_OPT);
    }

    // It should not format the directory because VERSION is missing.
    assertTrue("Storage directory was formatted", currentDir.exists());
  }