From 1aa4f8074197ecb38fe9bf5a3431f5cc73b7d635 Mon Sep 17 00:00:00 2001 From: dahn Date: Thu, 15 Jun 2023 09:09:31 +0200 Subject: [PATCH] accept first word from host os string for backwards compatibility (#7620) --- .../kvm/discoverer/LibvirtServerDiscoverer.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java b/server/src/main/java/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java index f4706be185d..440961dd7b0 100644 --- a/server/src/main/java/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java +++ b/server/src/main/java/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java @@ -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)); + } } }