accept first word from host os string for backwards compatibility (#7620)

This commit is contained in:
dahn 2023-06-15 09:09:31 +02:00 committed by GitHub
parent fb29608f61
commit 1aa4f80741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -471,8 +471,12 @@ public abstract class LibvirtServerDiscoverer extends DiscovererBase implements
String hostOsInCluster = oneHost.getDetail("Host.OS");
String hostOs = ssCmd.getHostDetails().get("Host.OS");
if (!hostOsInCluster.equalsIgnoreCase(hostOs)) {
throw new IllegalArgumentException("Can't add host: " + firstCmd.getPrivateIpAddress() + " with hostOS: " + hostOs + " into a cluster," +
"in which there are " + hostOsInCluster + " hosts added");
String msg = String.format("host: %s with hostOS, \"%s\"into a cluster, in which there are \"%s\" hosts added", firstCmd.getPrivateIpAddress(), hostOs, hostOsInCluster);
if (hostOs != null && hostOs.startsWith(hostOsInCluster)) {
s_logger.warn(String.format("Adding %s. This may or may not be ok!", msg));
} else {
throw new IllegalArgumentException(String.format("Can't add %s.", msg));
}
}
}