From fc9d617f27946653b2ea863c260533969535cb2f Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Sun, 10 May 2020 00:45:36 +0100 Subject: [PATCH] CA-338830: Pool join checks should not allow slave with enabled clustering to join. Signed-off-by: Konstantina Chremmou --- XenModel/Messages.Designer.cs | 9 +++++++++ XenModel/Messages.resx | 3 +++ XenModel/PoolJoinRules.cs | 13 ++++++++----- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 7a41ccafa..077c19300 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -25411,6 +25411,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Clustering is enabled on this server.. + /// + public static string NEW_POOL_CLUSTERING_ENABLED { + get { + return ResourceManager.GetString("NEW_POOL_CLUSTERING_ENABLED", resourceCulture); + } + } + /// /// Looks up a localized string similar to You are attempting to add the server '{0}' to a pool with a master that is using an older CPU. /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 260f77d1c..432278a6a 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -8793,6 +8793,9 @@ You should only proceed if you have verified that these settings are correct. New Private Network + + Clustering is enabled on this server. + This server has different updates from the master diff --git a/XenModel/PoolJoinRules.cs b/XenModel/PoolJoinRules.cs index 615dc5dc7..fe0efd712 100644 --- a/XenModel/PoolJoinRules.cs +++ b/XenModel/PoolJoinRules.cs @@ -71,6 +71,7 @@ namespace XenAdmin.Core NonCompatibleManagementInterface, WrongRoleOnMaster, WrongRoleOnSlave, + HasClusteringEnabled, WrongNumberOfIpsCluster, WrongNumberOfIpsBond, NotConnected, @@ -168,11 +169,11 @@ namespace XenAdmin.Core if (!Helpers.FeatureForbidden(slaveConnection, Host.RestrictManagementOnVLAN) && !HasCompatibleManagementInterface(slaveConnection)) return Reason.NonCompatibleManagementInterface; - bool clusterHostInBond; - if (!HasIpForClusterNetwork(masterConnection, slaveHost, out clusterHostInBond)) - { - return clusterHostInBond ? Reason.WrongNumberOfIpsBond : Reason.WrongNumberOfIpsCluster; - } + if (slaveHost?.Connection?.Cache.Clusters.FirstOrDefault() != null) + return Reason.HasClusteringEnabled; + + if (!HasIpForClusterNetwork(masterConnection, slaveHost, out var clusterHostInBond)) + return clusterHostInBond ? Reason.WrongNumberOfIpsBond : Reason.WrongNumberOfIpsCluster; return Reason.Allowed; } @@ -235,6 +236,8 @@ namespace XenAdmin.Core return Messages.NEWPOOL_MASTER_ROLE; case Reason.WrongRoleOnSlave: return Messages.NEWPOOL_SLAVE_ROLE; + case Reason.HasClusteringEnabled: + return Messages.NEW_POOL_CLUSTERING_ENABLED; case Reason.WrongNumberOfIpsCluster: return Messages.NEWPOOL_IP_COUNT_CLUSTER; case Reason.WrongNumberOfIpsBond: