Commit 4e447be7 authored by Marta Różańska's avatar Marta Różańska
Browse files

Merge branch 'fix-empty-hostname' into 'morphemic-rc1.5'

Fix empty hostname

See merge request !215
parents 68ec66f7 85d67c83
Pipeline #17676 passed with stages
in 29 minutes and 55 seconds
......@@ -475,7 +475,7 @@ public class PAGateway {
for(ByonNode byonNode: byonNodeList){
List<IpAddress> tempListIP=byonNode.getIpAddresses();
assert !tempListIP.isEmpty();
byonIPs= byonIPs + tempListIP.get(0).getValue() + ",";
byonIPs= byonIPs + tempListIP.get(0).getValue().replace(" ", "") + ",";
}
// Collect the pamr router address and port number
try {
......
......@@ -16,6 +16,10 @@ public class ByonUtils {
private ByonUtils() {}
static final int MAX_CONNECTION_RETRIES = 5;
static final int INTERVAL = 5000;
public static void init(String paURL) {
resourceManagerGateway = new PAResourceManagerGateway(paURL);
}
......@@ -101,7 +105,9 @@ public class ByonUtils {
* @return The BYON Host Name
*/
public static String getBYONHostname(String nsName) {
LOGGER.info("Getting the byon node host name for: " + nsName);
List<String> nodeHostnames = new LinkedList<>();
int retries=0;
try {
nodeHostnames = resourceManagerGateway.getAsyncDeployedNodesInformation(nsName, "hostname");
}
......@@ -123,6 +129,22 @@ public class ByonUtils {
}
}
}
while (nodeHostnames.get(0).equals(""))
{
LOGGER.warn("The node host name is empty, retrying to get node information");
try {
Thread.sleep(INTERVAL);
nodeHostnames = resourceManagerGateway.getAsyncDeployedNodesInformation(nsName, "hostname");
}
catch(Exception e) {
LOGGER.error(" resourceManagerGateway threw an exception: " + e);
}
if (retries > MAX_CONNECTION_RETRIES) {
LOGGER.error("The node host name is empty after " + retries+ " retries" );
throw new IllegalStateException("Node hostname is empty");
}
retries++;
}
LOGGER.info("The hostname is retrieved successfully: " + nodeHostnames.get(0));
return nodeHostnames.get(0);
......
Markdown is supported
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