This is an automated email from the ASF dual-hosted git repository.

bstoyanov pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.18 by this push:
     new 1aa4f807419 accept first word from host os string for backwards 
compatibility (#7620)
1aa4f807419 is described below

commit 1aa4f8074197ecb38fe9bf5a3431f5cc73b7d635
Author: dahn <[email protected]>
AuthorDate: Thu Jun 15 09:09:31 2023 +0200

    accept first word from host os string for backwards compatibility (#7620)
---
 .../cloud/hypervisor/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));
+                }
             }
         }
 

Reply via email to