void recoverTransitionRead(DataNode datanode, NamespaceInfo nsInfo,
      Collection<StorageLocation> dataDirs, StartupOption startOpt) throws IOException {
    if (addStorageLocations(datanode, nsInfo, dataDirs, startOpt).isEmpty()) {
      throw new IOException("All specified directories have failed to load.");
    }
  }
@Test
  public void testRecoverTransitionReadDoTransitionFailure()
      throws IOException {
    final int numLocations = 3;
    List<StorageLocation> locations = createStorageLocations(numLocations);
    // Prepare volumes
    storage.recoverTransitionRead(mockDN, nsInfo, locations, START_OPT);
    assertEquals(numLocations, storage.getNumStorageDirs());

    // Reset DataStorage
    storage.unlockAll();
    storage = new DataStorage();
    // Trigger an exception from doTransition().
    nsInfo.clusterID = "cluster1";
    try {
      storage.recoverTransitionRead(mockDN, nsInfo, locations, START_OPT);
      fail("Expect to throw an exception from doTransition()");
    } catch (IOException e) {
      GenericTestUtils.assertExceptionContains("All specified directories", e);
    }
    assertEquals(0, storage.getNumStorageDirs());
  }