HDDS-1110. OzoneManager need to login during init when security is enabled. Contributed by Xiaoyu Yao.

This commit is contained in:
Márton Elek 2019-02-15 16:09:37 +01:00
parent 9584b47e03
commit e0fe3d1eca

View File

@ -255,11 +255,6 @@ private OzoneManager(OzoneConfiguration conf) throws IOException,
// Load HA related configurations // Load HA related configurations
loadOMHAConfigs(configuration); loadOMHAConfigs(configuration);
// Authenticate KSM if security is enabled
if (securityEnabled) {
loginOMUser(configuration);
}
if (!testSecureOmFlag || !isOzoneSecurityEnabled()) { if (!testSecureOmFlag || !isOzoneSecurityEnabled()) {
scmContainerClient = getScmContainerClient(configuration); scmContainerClient = getScmContainerClient(configuration);
// verifies that the SCM info in the OM Version file is correct. // verifies that the SCM info in the OM Version file is correct.
@ -652,7 +647,7 @@ private void readKeyPair() throws OzoneSecurityException {
* @param conf * @param conf
* @throws IOException, AuthenticationException * @throws IOException, AuthenticationException
*/ */
private void loginOMUser(OzoneConfiguration conf) private static void loginOMUser(OzoneConfiguration conf)
throws IOException, AuthenticationException { throws IOException, AuthenticationException {
if (SecurityUtil.getAuthenticationMethod(conf).equals( if (SecurityUtil.getAuthenticationMethod(conf).equals(
@ -833,6 +828,9 @@ private static OzoneManager createOm(String[] argv,
} }
securityEnabled = OzoneSecurityUtil.isSecurityEnabled(conf); securityEnabled = OzoneSecurityUtil.isSecurityEnabled(conf);
if (securityEnabled) {
loginOMUser(conf);
}
switch (startOpt) { switch (startOpt) {
case INIT: case INIT: