YARN-4883. Make consistent operation name in AdminService. Contributed by Kai Sasaki.
This commit is contained in:
parent
38128baff4
commit
c63afdbe14
|
@ -399,11 +399,11 @@ public class AdminService extends CompositeService implements
|
||||||
@Override
|
@Override
|
||||||
public RefreshQueuesResponse refreshQueues(RefreshQueuesRequest request)
|
public RefreshQueuesResponse refreshQueues(RefreshQueuesRequest request)
|
||||||
throws YarnException, StandbyException {
|
throws YarnException, StandbyException {
|
||||||
String argName = "refreshQueues";
|
final String operation = "refreshQueues";
|
||||||
final String msg = "refresh queues.";
|
final String msg = "refresh queues.";
|
||||||
UserGroupInformation user = checkAcls(argName);
|
UserGroupInformation user = checkAcls(operation);
|
||||||
|
|
||||||
checkRMStatus(user.getShortUserName(), argName, msg);
|
checkRMStatus(user.getShortUserName(), operation, msg);
|
||||||
|
|
||||||
RefreshQueuesResponse response =
|
RefreshQueuesResponse response =
|
||||||
recordFactory.newRecordInstance(RefreshQueuesResponse.class);
|
recordFactory.newRecordInstance(RefreshQueuesResponse.class);
|
||||||
|
@ -414,22 +414,22 @@ public class AdminService extends CompositeService implements
|
||||||
if (rSystem != null) {
|
if (rSystem != null) {
|
||||||
rSystem.reinitialize(getConfig(), rmContext);
|
rSystem.reinitialize(getConfig(), rmContext);
|
||||||
}
|
}
|
||||||
RMAuditLogger.logSuccess(user.getShortUserName(), argName,
|
RMAuditLogger.logSuccess(user.getShortUserName(), operation,
|
||||||
"AdminService");
|
"AdminService");
|
||||||
return response;
|
return response;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw logAndWrapException(ioe, user.getShortUserName(), argName, msg);
|
throw logAndWrapException(ioe, user.getShortUserName(), operation, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RefreshNodesResponse refreshNodes(RefreshNodesRequest request)
|
public RefreshNodesResponse refreshNodes(RefreshNodesRequest request)
|
||||||
throws YarnException, StandbyException {
|
throws YarnException, StandbyException {
|
||||||
String argName = "refreshNodes";
|
final String operation = "refreshNodes";
|
||||||
final String msg = "refresh nodes.";
|
final String msg = "refresh nodes.";
|
||||||
UserGroupInformation user = checkAcls("refreshNodes");
|
UserGroupInformation user = checkAcls("refreshNodes");
|
||||||
|
|
||||||
checkRMStatus(user.getShortUserName(), argName, msg);
|
checkRMStatus(user.getShortUserName(), operation, msg);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Configuration conf =
|
Configuration conf =
|
||||||
|
@ -446,11 +446,11 @@ public class AdminService extends CompositeService implements
|
||||||
rmContext.getNodesListManager().refreshNodesForcefully();
|
rmContext.getNodesListManager().refreshNodesForcefully();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
RMAuditLogger.logSuccess(user.getShortUserName(), argName,
|
RMAuditLogger.logSuccess(user.getShortUserName(), operation,
|
||||||
"AdminService");
|
"AdminService");
|
||||||
return recordFactory.newRecordInstance(RefreshNodesResponse.class);
|
return recordFactory.newRecordInstance(RefreshNodesResponse.class);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw logAndWrapException(ioe, user.getShortUserName(), argName, msg);
|
throw logAndWrapException(ioe, user.getShortUserName(), operation, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,10 +458,11 @@ public class AdminService extends CompositeService implements
|
||||||
public RefreshSuperUserGroupsConfigurationResponse refreshSuperUserGroupsConfiguration(
|
public RefreshSuperUserGroupsConfigurationResponse refreshSuperUserGroupsConfiguration(
|
||||||
RefreshSuperUserGroupsConfigurationRequest request)
|
RefreshSuperUserGroupsConfigurationRequest request)
|
||||||
throws YarnException, IOException {
|
throws YarnException, IOException {
|
||||||
String argName = "refreshSuperUserGroupsConfiguration";
|
final String operation = "refreshSuperUserGroupsConfiguration";
|
||||||
UserGroupInformation user = checkAcls(argName);
|
UserGroupInformation user = checkAcls(operation);
|
||||||
|
|
||||||
checkRMStatus(user.getShortUserName(), argName, "refresh super-user-groups.");
|
checkRMStatus(user.getShortUserName(), operation,
|
||||||
|
"refresh super-user-groups.");
|
||||||
|
|
||||||
// Accept hadoop common configs in core-site.xml as well as RM specific
|
// Accept hadoop common configs in core-site.xml as well as RM specific
|
||||||
// configurations in yarn-site.xml
|
// configurations in yarn-site.xml
|
||||||
|
@ -472,7 +473,7 @@ public class AdminService extends CompositeService implements
|
||||||
RMServerUtils.processRMProxyUsersConf(conf);
|
RMServerUtils.processRMProxyUsersConf(conf);
|
||||||
ProxyUsers.refreshSuperUserGroupsConfiguration(conf);
|
ProxyUsers.refreshSuperUserGroupsConfiguration(conf);
|
||||||
RMAuditLogger.logSuccess(user.getShortUserName(),
|
RMAuditLogger.logSuccess(user.getShortUserName(),
|
||||||
argName, "AdminService");
|
operation, "AdminService");
|
||||||
|
|
||||||
return recordFactory.newRecordInstance(
|
return recordFactory.newRecordInstance(
|
||||||
RefreshSuperUserGroupsConfigurationResponse.class);
|
RefreshSuperUserGroupsConfigurationResponse.class);
|
||||||
|
@ -482,16 +483,17 @@ public class AdminService extends CompositeService implements
|
||||||
public RefreshUserToGroupsMappingsResponse refreshUserToGroupsMappings(
|
public RefreshUserToGroupsMappingsResponse refreshUserToGroupsMappings(
|
||||||
RefreshUserToGroupsMappingsRequest request)
|
RefreshUserToGroupsMappingsRequest request)
|
||||||
throws YarnException, IOException {
|
throws YarnException, IOException {
|
||||||
String argName = "refreshUserToGroupsMappings";
|
final String operation = "refreshUserToGroupsMappings";
|
||||||
UserGroupInformation user = checkAcls(argName);
|
UserGroupInformation user = checkAcls(operation);
|
||||||
|
|
||||||
checkRMStatus(user.getShortUserName(), argName, "refresh user-groups.");
|
checkRMStatus(user.getShortUserName(), operation, "refresh user-groups.");
|
||||||
|
|
||||||
Groups.getUserToGroupsMappingService(
|
Groups.getUserToGroupsMappingService(
|
||||||
getConfiguration(new Configuration(false),
|
getConfiguration(new Configuration(false),
|
||||||
YarnConfiguration.CORE_SITE_CONFIGURATION_FILE)).refresh();
|
YarnConfiguration.CORE_SITE_CONFIGURATION_FILE)).refresh();
|
||||||
|
|
||||||
RMAuditLogger.logSuccess(user.getShortUserName(), argName, "AdminService");
|
RMAuditLogger.logSuccess(user.getShortUserName(), operation,
|
||||||
|
"AdminService");
|
||||||
|
|
||||||
return recordFactory.newRecordInstance(
|
return recordFactory.newRecordInstance(
|
||||||
RefreshUserToGroupsMappingsResponse.class);
|
RefreshUserToGroupsMappingsResponse.class);
|
||||||
|
@ -505,18 +507,18 @@ public class AdminService extends CompositeService implements
|
||||||
|
|
||||||
private RefreshAdminAclsResponse refreshAdminAcls(boolean checkRMHAState)
|
private RefreshAdminAclsResponse refreshAdminAcls(boolean checkRMHAState)
|
||||||
throws YarnException, IOException {
|
throws YarnException, IOException {
|
||||||
String argName = "refreshAdminAcls";
|
final String operation = "refreshAdminAcls";
|
||||||
UserGroupInformation user = checkAcls(argName);
|
UserGroupInformation user = checkAcls(operation);
|
||||||
|
|
||||||
if (checkRMHAState) {
|
if (checkRMHAState) {
|
||||||
checkRMStatus(user.getShortUserName(), argName, "refresh Admin ACLs.");
|
checkRMStatus(user.getShortUserName(), operation, "refresh Admin ACLs.");
|
||||||
}
|
}
|
||||||
Configuration conf =
|
Configuration conf =
|
||||||
getConfiguration(new Configuration(false),
|
getConfiguration(new Configuration(false),
|
||||||
YarnConfiguration.YARN_SITE_CONFIGURATION_FILE);
|
YarnConfiguration.YARN_SITE_CONFIGURATION_FILE);
|
||||||
authorizer.setAdmins(getAdminAclList(conf), UserGroupInformation
|
authorizer.setAdmins(getAdminAclList(conf), UserGroupInformation
|
||||||
.getCurrentUser());
|
.getCurrentUser());
|
||||||
RMAuditLogger.logSuccess(user.getShortUserName(), argName,
|
RMAuditLogger.logSuccess(user.getShortUserName(), operation,
|
||||||
"AdminService");
|
"AdminService");
|
||||||
|
|
||||||
return recordFactory.newRecordInstance(RefreshAdminAclsResponse.class);
|
return recordFactory.newRecordInstance(RefreshAdminAclsResponse.class);
|
||||||
|
@ -534,10 +536,10 @@ public class AdminService extends CompositeService implements
|
||||||
") not enabled."));
|
") not enabled."));
|
||||||
}
|
}
|
||||||
|
|
||||||
String argName = "refreshServiceAcls";
|
final String operation = "refreshServiceAcls";
|
||||||
UserGroupInformation user = checkAcls(argName);
|
UserGroupInformation user = checkAcls(operation);
|
||||||
|
|
||||||
checkRMStatus(user.getShortUserName(), argName, "refresh Service ACLs.");
|
checkRMStatus(user.getShortUserName(), operation, "refresh Service ACLs.");
|
||||||
|
|
||||||
PolicyProvider policyProvider = RMPolicyProvider.getInstance();
|
PolicyProvider policyProvider = RMPolicyProvider.getInstance();
|
||||||
Configuration conf =
|
Configuration conf =
|
||||||
|
@ -551,7 +553,8 @@ public class AdminService extends CompositeService implements
|
||||||
rmContext.getResourceTrackerService().refreshServiceAcls(
|
rmContext.getResourceTrackerService().refreshServiceAcls(
|
||||||
conf, policyProvider);
|
conf, policyProvider);
|
||||||
|
|
||||||
RMAuditLogger.logSuccess(user.getShortUserName(), argName, "AdminService");
|
RMAuditLogger.logSuccess(user.getShortUserName(), operation,
|
||||||
|
"AdminService");
|
||||||
|
|
||||||
return recordFactory.newRecordInstance(RefreshServiceAclsResponse.class);
|
return recordFactory.newRecordInstance(RefreshServiceAclsResponse.class);
|
||||||
}
|
}
|
||||||
|
@ -571,10 +574,10 @@ public class AdminService extends CompositeService implements
|
||||||
@Override
|
@Override
|
||||||
public UpdateNodeResourceResponse updateNodeResource(
|
public UpdateNodeResourceResponse updateNodeResource(
|
||||||
UpdateNodeResourceRequest request) throws YarnException, IOException {
|
UpdateNodeResourceRequest request) throws YarnException, IOException {
|
||||||
String argName = "updateNodeResource";
|
final String operation = "updateNodeResource";
|
||||||
UserGroupInformation user = checkAcls(argName);
|
UserGroupInformation user = checkAcls(operation);
|
||||||
|
|
||||||
checkRMStatus(user.getShortUserName(), argName, "update node resource.");
|
checkRMStatus(user.getShortUserName(), operation, "update node resource.");
|
||||||
|
|
||||||
Map<NodeId, ResourceOption> nodeResourceMap = request.getNodeResourceMap();
|
Map<NodeId, ResourceOption> nodeResourceMap = request.getNodeResourceMap();
|
||||||
Set<NodeId> nodeIds = nodeResourceMap.keySet();
|
Set<NodeId> nodeIds = nodeResourceMap.keySet();
|
||||||
|
@ -615,7 +618,7 @@ public class AdminService extends CompositeService implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (allSuccess) {
|
if (allSuccess) {
|
||||||
RMAuditLogger.logSuccess(user.getShortUserName(), argName,
|
RMAuditLogger.logSuccess(user.getShortUserName(), operation,
|
||||||
"AdminService");
|
"AdminService");
|
||||||
}
|
}
|
||||||
UpdateNodeResourceResponse response =
|
UpdateNodeResourceResponse response =
|
||||||
|
@ -627,11 +630,11 @@ public class AdminService extends CompositeService implements
|
||||||
public RefreshNodesResourcesResponse refreshNodesResources(
|
public RefreshNodesResourcesResponse refreshNodesResources(
|
||||||
RefreshNodesResourcesRequest request)
|
RefreshNodesResourcesRequest request)
|
||||||
throws YarnException, StandbyException {
|
throws YarnException, StandbyException {
|
||||||
String argName = "refreshNodesResources";
|
final String operation = "refreshNodesResources";
|
||||||
UserGroupInformation user = checkAcls(argName);
|
UserGroupInformation user = checkAcls(operation);
|
||||||
final String msg = "refresh nodes.";
|
final String msg = "refresh nodes.";
|
||||||
|
|
||||||
checkRMStatus(user.getShortUserName(), argName, msg);
|
checkRMStatus(user.getShortUserName(), operation, msg);
|
||||||
|
|
||||||
RefreshNodesResourcesResponse response =
|
RefreshNodesResourcesResponse response =
|
||||||
recordFactory.newRecordInstance(RefreshNodesResourcesResponse.class);
|
recordFactory.newRecordInstance(RefreshNodesResourcesResponse.class);
|
||||||
|
@ -662,11 +665,11 @@ public class AdminService extends CompositeService implements
|
||||||
// refresh dynamic resource in ResourceTrackerService
|
// refresh dynamic resource in ResourceTrackerService
|
||||||
this.rmContext.getResourceTrackerService().
|
this.rmContext.getResourceTrackerService().
|
||||||
updateDynamicResourceConfiguration(newConf);
|
updateDynamicResourceConfiguration(newConf);
|
||||||
RMAuditLogger.logSuccess(user.getShortUserName(), argName,
|
RMAuditLogger.logSuccess(user.getShortUserName(), operation,
|
||||||
"AdminService");
|
"AdminService");
|
||||||
return response;
|
return response;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw logAndWrapException(ioe, user.getShortUserName(), argName, msg);
|
throw logAndWrapException(ioe, user.getShortUserName(), operation, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,28 +722,28 @@ public class AdminService extends CompositeService implements
|
||||||
@Override
|
@Override
|
||||||
public AddToClusterNodeLabelsResponse addToClusterNodeLabels(AddToClusterNodeLabelsRequest request)
|
public AddToClusterNodeLabelsResponse addToClusterNodeLabels(AddToClusterNodeLabelsRequest request)
|
||||||
throws YarnException, IOException {
|
throws YarnException, IOException {
|
||||||
String argName = "addToClusterNodeLabels";
|
final String operation = "addToClusterNodeLabels";
|
||||||
final String msg = "add labels.";
|
final String msg = "add labels.";
|
||||||
UserGroupInformation user = checkAcls(argName);
|
UserGroupInformation user = checkAcls(operation);
|
||||||
|
|
||||||
checkRMStatus(user.getShortUserName(), argName, msg);
|
checkRMStatus(user.getShortUserName(), operation, msg);
|
||||||
|
|
||||||
AddToClusterNodeLabelsResponse response =
|
AddToClusterNodeLabelsResponse response =
|
||||||
recordFactory.newRecordInstance(AddToClusterNodeLabelsResponse.class);
|
recordFactory.newRecordInstance(AddToClusterNodeLabelsResponse.class);
|
||||||
try {
|
try {
|
||||||
rmContext.getNodeLabelManager().addToCluserNodeLabels(request.getNodeLabels());
|
rmContext.getNodeLabelManager().addToCluserNodeLabels(request.getNodeLabels());
|
||||||
RMAuditLogger
|
RMAuditLogger
|
||||||
.logSuccess(user.getShortUserName(), argName, "AdminService");
|
.logSuccess(user.getShortUserName(), operation, "AdminService");
|
||||||
return response;
|
return response;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw logAndWrapException(ioe, user.getShortUserName(), argName, msg);
|
throw logAndWrapException(ioe, user.getShortUserName(), operation, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RemoveFromClusterNodeLabelsResponse removeFromClusterNodeLabels(
|
public RemoveFromClusterNodeLabelsResponse removeFromClusterNodeLabels(
|
||||||
RemoveFromClusterNodeLabelsRequest request) throws YarnException, IOException {
|
RemoveFromClusterNodeLabelsRequest request) throws YarnException, IOException {
|
||||||
String operation = "removeFromClusterNodeLabels";
|
final String operation = "removeFromClusterNodeLabels";
|
||||||
final String msg = "remove labels.";
|
final String msg = "remove labels.";
|
||||||
|
|
||||||
UserGroupInformation user = checkAcls(operation);
|
UserGroupInformation user = checkAcls(operation);
|
||||||
|
@ -762,7 +765,7 @@ public class AdminService extends CompositeService implements
|
||||||
@Override
|
@Override
|
||||||
public ReplaceLabelsOnNodeResponse replaceLabelsOnNode(
|
public ReplaceLabelsOnNodeResponse replaceLabelsOnNode(
|
||||||
ReplaceLabelsOnNodeRequest request) throws YarnException, IOException {
|
ReplaceLabelsOnNodeRequest request) throws YarnException, IOException {
|
||||||
String operation = "replaceLabelsOnNode";
|
final String operation = "replaceLabelsOnNode";
|
||||||
final String msg = "set node to labels.";
|
final String msg = "set node to labels.";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -810,15 +813,16 @@ public class AdminService extends CompositeService implements
|
||||||
public CheckForDecommissioningNodesResponse checkForDecommissioningNodes(
|
public CheckForDecommissioningNodesResponse checkForDecommissioningNodes(
|
||||||
CheckForDecommissioningNodesRequest checkForDecommissioningNodesRequest)
|
CheckForDecommissioningNodesRequest checkForDecommissioningNodesRequest)
|
||||||
throws IOException, YarnException {
|
throws IOException, YarnException {
|
||||||
String argName = "checkForDecommissioningNodes";
|
final String operation = "checkForDecommissioningNodes";
|
||||||
final String msg = "check for decommissioning nodes.";
|
final String msg = "check for decommissioning nodes.";
|
||||||
UserGroupInformation user = checkAcls("checkForDecommissioningNodes");
|
UserGroupInformation user = checkAcls("checkForDecommissioningNodes");
|
||||||
|
|
||||||
checkRMStatus(user.getShortUserName(), argName, msg);
|
checkRMStatus(user.getShortUserName(), operation, msg);
|
||||||
|
|
||||||
Set<NodeId> decommissioningNodes = rmContext.getNodesListManager()
|
Set<NodeId> decommissioningNodes = rmContext.getNodesListManager()
|
||||||
.checkForDecommissioningNodes();
|
.checkForDecommissioningNodes();
|
||||||
RMAuditLogger.logSuccess(user.getShortUserName(), argName, "AdminService");
|
RMAuditLogger.logSuccess(user.getShortUserName(), operation,
|
||||||
|
"AdminService");
|
||||||
CheckForDecommissioningNodesResponse response = recordFactory
|
CheckForDecommissioningNodesResponse response = recordFactory
|
||||||
.newRecordInstance(CheckForDecommissioningNodesResponse.class);
|
.newRecordInstance(CheckForDecommissioningNodesResponse.class);
|
||||||
response.setDecommissioningNodes(decommissioningNodes);
|
response.setDecommissioningNodes(decommissioningNodes);
|
||||||
|
@ -829,11 +833,11 @@ public class AdminService extends CompositeService implements
|
||||||
public RefreshClusterMaxPriorityResponse refreshClusterMaxPriority(
|
public RefreshClusterMaxPriorityResponse refreshClusterMaxPriority(
|
||||||
RefreshClusterMaxPriorityRequest request) throws YarnException,
|
RefreshClusterMaxPriorityRequest request) throws YarnException,
|
||||||
IOException {
|
IOException {
|
||||||
String argName = "refreshClusterMaxPriority";
|
final String operation = "refreshClusterMaxPriority";
|
||||||
String msg = "refresh cluster max priority";
|
final String msg = "refresh cluster max priority";
|
||||||
UserGroupInformation user = checkAcls(argName);
|
UserGroupInformation user = checkAcls(operation);
|
||||||
|
|
||||||
checkRMStatus(user.getShortUserName(), argName, msg);
|
checkRMStatus(user.getShortUserName(), operation, msg);
|
||||||
try {
|
try {
|
||||||
Configuration conf =
|
Configuration conf =
|
||||||
getConfiguration(new Configuration(false),
|
getConfiguration(new Configuration(false),
|
||||||
|
@ -842,11 +846,11 @@ public class AdminService extends CompositeService implements
|
||||||
rmContext.getScheduler().setClusterMaxPriority(conf);
|
rmContext.getScheduler().setClusterMaxPriority(conf);
|
||||||
|
|
||||||
RMAuditLogger
|
RMAuditLogger
|
||||||
.logSuccess(user.getShortUserName(), argName, "AdminService");
|
.logSuccess(user.getShortUserName(), operation, "AdminService");
|
||||||
return recordFactory
|
return recordFactory
|
||||||
.newRecordInstance(RefreshClusterMaxPriorityResponse.class);
|
.newRecordInstance(RefreshClusterMaxPriorityResponse.class);
|
||||||
} catch (YarnException e) {
|
} catch (YarnException e) {
|
||||||
throw logAndWrapException(e, user.getShortUserName(), argName, msg);
|
throw logAndWrapException(e, user.getShortUserName(), operation, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue