Skip to content

Commit 1aa4f80

Browse files
authored
accept first word from host os string for backwards compatibility (#7620)
1 parent fb29608 commit 1aa4f80

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/src/main/java/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,12 @@ public HostVO createHostVOForConnectedAgent(HostVO host, StartupCommand[] cmd) {
471471
String hostOsInCluster = oneHost.getDetail("Host.OS");
472472
String hostOs = ssCmd.getHostDetails().get("Host.OS");
473473
if (!hostOsInCluster.equalsIgnoreCase(hostOs)) {
474-
throw new IllegalArgumentException("Can't add host: " + firstCmd.getPrivateIpAddress() + " with hostOS: " + hostOs + " into a cluster," +
475-
"in which there are " + hostOsInCluster + " hosts added");
474+
String msg = String.format("host: %s with hostOS, \"%s\"into a cluster, in which there are \"%s\" hosts added", firstCmd.getPrivateIpAddress(), hostOs, hostOsInCluster);
475+
if (hostOs != null && hostOs.startsWith(hostOsInCluster)) {
476+
s_logger.warn(String.format("Adding %s. This may or may not be ok!", msg));
477+
} else {
478+
throw new IllegalArgumentException(String.format("Can't add %s.", msg));
479+
}
476480
}
477481
}
478482

0 commit comments

Comments
 (0)