Class StorageVolumeUtil
java.lang.Object
org.apache.hadoop.ozone.container.common.utils.StorageVolumeUtil
A util class for
StorageVolume.-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckVolume(StorageVolume volume, String scmId, String clusterId, org.apache.hadoop.hdds.conf.ConfigurationSource conf, org.slf4j.Logger logger, MutableVolumeSet dbVolumeSet) Check Volume is in consistent state or not.static Stringstatic StringgetClusterID(Properties props, File versionFile, String clusterID) Returns clusterID if it is valid.static longgetCreationTime(Properties props, File versionFile) Returns creationTime if it is valid.static StringgetDatanodeUUID(Properties props, File versionFile, String datanodeUuid) Returns datanodeUuid if it is valid.getDbVolumesList(List<StorageVolume> volumes) static List<HddsVolume> getHddsVolumesList(List<StorageVolume> volumes) static intgetLayOutVersion(Properties props, File versionFile) Returns layOutVersion if it is valid.static StringgetProperty(Properties props, String propName, File versionFile) static StringgetStorageID(Properties props, File versionFile) Returns storageID if it is valid.static FilegetVersionFile(File rootDir) static voidonFailure(StorageVolume volume)
-
Method Details
-
onFailure
-
getHddsVolumesList
-
getDbVolumesList
-
getVersionFile
-
generateUuid
-
getStorageID
public static String getStorageID(Properties props, File versionFile) throws org.apache.hadoop.ozone.common.InconsistentStorageStateException Returns storageID if it is valid. Throws an exception otherwise.- Throws:
org.apache.hadoop.ozone.common.InconsistentStorageStateException
-
getClusterID
public static String getClusterID(Properties props, File versionFile, String clusterID) throws org.apache.hadoop.ozone.common.InconsistentStorageStateException Returns clusterID if it is valid. It should match the clusterID from the Datanode. Throws an exception otherwise.- Throws:
org.apache.hadoop.ozone.common.InconsistentStorageStateException
-
getDatanodeUUID
public static String getDatanodeUUID(Properties props, File versionFile, String datanodeUuid) throws org.apache.hadoop.ozone.common.InconsistentStorageStateException Returns datanodeUuid if it is valid. It should match the UUID of the Datanode. Throws an exception otherwise.- Throws:
org.apache.hadoop.ozone.common.InconsistentStorageStateException
-
getCreationTime
public static long getCreationTime(Properties props, File versionFile) throws org.apache.hadoop.ozone.common.InconsistentStorageStateException Returns creationTime if it is valid. Throws an exception otherwise.- Throws:
org.apache.hadoop.ozone.common.InconsistentStorageStateException
-
getLayOutVersion
public static int getLayOutVersion(Properties props, File versionFile) throws org.apache.hadoop.ozone.common.InconsistentStorageStateException Returns layOutVersion if it is valid. Throws an exception otherwise.- Throws:
org.apache.hadoop.ozone.common.InconsistentStorageStateException
-
getProperty
public static String getProperty(Properties props, String propName, File versionFile) throws org.apache.hadoop.ozone.common.InconsistentStorageStateException - Throws:
org.apache.hadoop.ozone.common.InconsistentStorageStateException
-
checkVolume
public static boolean checkVolume(StorageVolume volume, String scmId, String clusterId, org.apache.hadoop.hdds.conf.ConfigurationSource conf, org.slf4j.Logger logger, MutableVolumeSet dbVolumeSet) Check Volume is in consistent state or not. Prior to SCM HA, volumes used the format<volume>/hdds/<scm-id>. Post SCM HA, new volumes will use the format<volume>/hdds/<cluster -id>. Existing volumes using SCM ID will be reformatted to have<volume>/hdds/<cluster-id>as a symlink pointing to<volume >/hdds/<scm-id>when SCM HA is finalized.- Parameters:
volume-scmId-clusterId-conf-logger-dbVolumeSet-- Returns:
- true - if volume is in consistent state, otherwise false.
-