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
1 changed files with 4 additions and 6 deletions

View File

@ -255,11 +255,6 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl
// 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 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl
* @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 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl
} }
securityEnabled = OzoneSecurityUtil.isSecurityEnabled(conf); securityEnabled = OzoneSecurityUtil.isSecurityEnabled(conf);
if (securityEnabled) {
loginOMUser(conf);
}
switch (startOpt) { switch (startOpt) {
case INIT: case INIT: