Commit 618a7e96 authored by Mohamed Khalil Labidi's avatar Mohamed Khalil Labidi
Browse files

Fix scaleIn process when some nodes did not have been acquired properly

parent ed7e3243
......@@ -670,9 +670,15 @@ public class PAGateway {
public void removeNodes(List<String> nodeNames, Boolean preempt) {
nodeNames.forEach(nodeName -> {
try {
String nodeUrl = resourceManagerGateway.searchNodes(Collections.singletonList(nodeName), true).get(0);
resourceManagerGateway.removeNode(nodeUrl, preempt);
LOGGER.info("Node " + nodeName + " with URL: " + nodeUrl + " has been removed successfully.");
List<String> nodeURLs = resourceManagerGateway.searchNodes(Collections.singletonList(nodeName), true);
if (!nodeURLs.isEmpty()) {
String nodeUrl = nodeURLs.get(0);
resourceManagerGateway.removeNode(nodeUrl, preempt);
LOGGER.info("Node " + nodeName + " with URL: " + nodeUrl + " has been removed successfully.");
} else {
LOGGER.warn("No Nodes with tag " + nodeName + " has been found in RM. Nothing to be removed here.");
}
} catch (NotConnectedException | RestException e) {
LOGGER.error(String.valueOf(e.getStackTrace()));
}
......
......@@ -197,7 +197,7 @@ public class PAResourceManagerGateway {
* @throws RestException In case a Rest exception is thrown
*/
public List<String> searchNodes(List<String> tags, boolean all) throws NotConnectedException, RestException {
LOGGER.debug("Search for nodes ...");
LOGGER.debug("Search for nodes with tags " + tags + " ...");
List<String> nodesUrls = new ArrayList<>(rmRestInterface.searchNodes(RMConnectionHelper.getSessionId(), tags, all));
LOGGER.debug("Nodes found: " + nodesUrls);
return nodesUrls;
......@@ -257,7 +257,7 @@ public class PAResourceManagerGateway {
* @throws PermissionRestException In case the user does not have valid permissions
*/
public Boolean removeNode(String nodeUrl, Boolean preempt) throws NotConnectedException, PermissionRestException {
LOGGER.debug("Removing node ...");
LOGGER.debug("Removing node \'" + nodeUrl + "\' ...");
Boolean result = rmRestInterface.removeNode(RMConnectionHelper.getSessionId(), nodeUrl, preempt);
LOGGER.info("Node removed!");
return result;
......
log4j.rootCategory=info,console
log4j.logger.org.activeeon.morphemic=info
log4j.logger.org.activeeon.morphemic=debug
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.out
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment