HDDS-1680. Create missing parent directories during the creation of HddsVolume dirs (#961)

This commit is contained in:
Elek, Márton 2019-06-14 01:18:15 +02:00 committed by Bharat Viswanadham
parent 89acbbc0b9
commit e094b3b4cd
2 changed files with 2 additions and 2 deletions

View File

@ -204,7 +204,7 @@ private void initialize() throws IOException {
switch (intialVolumeState) {
case NON_EXISTENT:
// Root directory does not exist. Create it.
if (!hddsRootDir.mkdir()) {
if (!hddsRootDir.mkdirs()) {
throw new IOException("Cannot create directory " + hddsRootDir);
}
setState(VolumeState.NOT_FORMATTED);

View File

@ -230,7 +230,7 @@ public void testFailVolumes() throws Exception{
ozoneConfig.set(HDDS_DATANODE_DIR_KEY, readOnlyVolumePath.getAbsolutePath()
+ "," + volumePath.getAbsolutePath());
volSet = new VolumeSet(UUID.randomUUID().toString(), ozoneConfig);
assertTrue(volSet.getFailedVolumesList().size() == 1);
assertEquals(1, volSet.getFailedVolumesList().size());
assertEquals(readOnlyVolumePath, volSet.getFailedVolumesList().get(0)
.getHddsRootDir());