From d599bf4024c193a7b052ed1b23e4e453dab1435f Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Wed, 10 May 2023 15:22:46 +0100 Subject: [PATCH] CP-43102: Only allow connections to Havana and Naples or greater servers. Signed-off-by: Konstantina Chremmou --- Branding/Branding.resx | 3 +++ XenAdmin/MainWindow.cs | 25 +++++++++++++------------ XenAdmin/Network/XenConnectionUI.cs | 6 ++---- XenAdmin/TabPages/GeneralTabPage.cs | 8 -------- XenModel/BrandManager.cs | 2 ++ XenModel/Messages.Designer.cs | 13 ++----------- XenModel/Messages.resx | 7 ++----- XenModel/Network/XenConnection.cs | 6 +++--- XenModel/Utils/Helpers.Versions.cs | 9 +++------ 9 files changed, 30 insertions(+), 49 deletions(-) diff --git a/Branding/Branding.resx b/Branding/Branding.resx index a29d7993a..9dc409954 100644 --- a/Branding/Branding.resx +++ b/Branding/Branding.resx @@ -153,6 +153,9 @@ 7.0 + + XenServer 7.1.2 + 7.1.2 diff --git a/XenAdmin/MainWindow.cs b/XenAdmin/MainWindow.cs index 641a5bff3..2f6c307c4 100755 --- a/XenAdmin/MainWindow.cs +++ b/XenAdmin/MainWindow.cs @@ -924,7 +924,7 @@ namespace XenAdmin Program.Invoke(Program.MainWindow, () => { var title = string.Format(Messages.CONNECTION_REFUSED_TITLE, Helpers.GetName(coordinator).Ellipsise(80)); - var msg = string.Format(Messages.SUPPORTER_TOO_OLD, BrandManager.ProductVersion70, BrandManager.BrandConsole); + var msg = string.Format(Messages.SUPPORTER_TOO_OLD, BrandManager.ProductVersion712, BrandManager.BrandConsole); new DummyAction(title, "", msg).Run(); @@ -947,14 +947,14 @@ namespace XenAdmin // xencenter_max should always equal the current version of XenCenter. This ensures that even if they are // not required to upgrade, we at least warn them. // else if (server_max > current_version) - int server_min = coordinator.XenCenterMin(); - int server_max = coordinator.XenCenterMax(); + int serverMin = coordinator.XenCenterMin(); + int serverMax = coordinator.XenCenterMax(); - if (server_min > 0 && server_max > 0) + if (serverMin > 0 && serverMax > 0) { - int current_version = (int)API_Version.LATEST; + int currentVersion = (int)API_Version.LATEST; - if (server_min > current_version) + if (serverMin > currentVersion) { connection.EndConnect(); @@ -979,16 +979,17 @@ namespace XenAdmin return; } - // Allow connection only to Yangtze and cloud released versions - // - if (!Helpers.YangtzeOrGreater(coordinator)) + // Allow connection only to Havana and Naples or greater versions + + if (!Helpers.HavanaOrGreater(coordinator) || + Helpers.FalconOrGreater(coordinator) && !Helpers.NaplesOrGreater(coordinator)) { connection.EndConnect(); Program.Invoke(Program.MainWindow, delegate { - var msg = string.Format(Messages.GUI_NOT_COMPATIBLE, BrandManager.BrandConsole, - BrandManager.ProductVersion821, Helpers.GetName(coordinator)); + var msg = string.Format(Messages.GUI_NOT_COMPATIBLE, BrandManager.BrandConsole, BrandManager.ProductVersion712, + BrandManager.ProductVersion80, Helpers.GetName(coordinator)); var url = InvisibleMessages.OUT_OF_DATE_WEBSITE; var title = string.Format(Messages.CONNECTION_REFUSED_TITLE, Helpers.GetName(coordinator).Ellipsise(80)); var error = $"{msg}\n{url}"; @@ -1007,7 +1008,7 @@ namespace XenAdmin return; } - if (server_max > current_version) + if (serverMax > currentVersion) Alert.AddAlert(new GuiOldAlert()); LoadTasksAsMeddlingActions(connection); diff --git a/XenAdmin/Network/XenConnectionUI.cs b/XenAdmin/Network/XenConnectionUI.cs index f25fd2f16..6ee025ec5 100644 --- a/XenAdmin/Network/XenConnectionUI.cs +++ b/XenAdmin/Network/XenConnectionUI.cs @@ -277,12 +277,10 @@ namespace XenAdmin.Network // changes type, for example. AddError(owner, connection, string.Format(Messages.SERVER_API_INCOMPATIBLE, BrandManager.BrandConsole), Messages.SOLUTION_UNKNOWN); } - else if (error is ServerNotSupported) + else if (error is ServerNotSupported ex1) { // Server version is too old for this version of XenCenter - AddError(owner, connection, - string.Format(Messages.SERVER_TOO_OLD, BrandManager.BrandConsole, BrandManager.ProductVersion70), - string.Format(Messages.SERVER_TOO_OLD_SOLUTION, BrandManager.BrandConsole)); + AddError(owner, connection, ex1.Message, string.Format(Messages.SERVER_TOO_OLD_SOLUTION, BrandManager.BrandConsole)); } else { diff --git a/XenAdmin/TabPages/GeneralTabPage.cs b/XenAdmin/TabPages/GeneralTabPage.cs index 351fed465..b64a78509 100644 --- a/XenAdmin/TabPages/GeneralTabPage.cs +++ b/XenAdmin/TabPages/GeneralTabPage.cs @@ -1896,14 +1896,6 @@ namespace XenAdmin.TabPages Banner.LinkUri = new Uri(InvisibleMessages.FCOE_SR_DEPRECATION_URL); Banner.Visible = true; } - else if (!Helpers.CloudOrGreater(xenObject.Connection)) - { - Banner.BannerType = DeprecationBanner.Type.Deprecation; - Banner.WarningMessage = string.Format(Messages.WARNING_PRE_CLOUD_VERSION_CONNECTION, BrandManager.BrandConsole, Program.VersionText, BrandManager.ProductVersion821); - Banner.LinkText = Messages.PATCHING_WIZARD_WEBPAGE_CELL; - Banner.LinkUri = new Uri(InvisibleMessages.OUT_OF_DATE_WEBSITE); - Banner.Visible = true; - } else { Banner.Visible = false; diff --git a/XenModel/BrandManager.cs b/XenModel/BrandManager.cs index 4e9409a8d..52ad8b839 100644 --- a/XenModel/BrandManager.cs +++ b/XenModel/BrandManager.cs @@ -89,6 +89,8 @@ namespace XenAdmin.Core public static readonly string ProductVersion70Short = Get("PRODUCT_VERSION_7_0_SHORT"); + public static readonly string ProductVersion712 = Get("PRODUCT_VERSION_7_1_2"); + public static readonly string ProductVersion712Short = Get("PRODUCT_VERSION_7_1_2_SHORT"); public static readonly string ProductVersion80 = Get("PRODUCT_VERSION_8_0"); diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 3a488b76c..b935b1797 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -18329,7 +18329,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to This version of {0} can only connect to {1} and greater versions. It cannot connect to {2}. + /// Looks up a localized string similar to This version of {0} can only connect to {1}, and {2} or greater versions. It cannot connect to {3}. /// ///You can get a compatible version of {0} from the following location:. /// @@ -33616,7 +33616,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to This version of {0} supports {1} onwards.. + /// Looks up a localized string similar to This version of {0} can only connect to {1}, and {2} or greater versions.. /// public static string SERVER_TOO_OLD { get { @@ -40314,15 +40314,6 @@ namespace XenAdmin { } } - /// - /// Looks up a localized string similar to {0} {1} is not recommended for general management of servers running {2}. Please use latest available {0} for {2} instead.. - /// - public static string WARNING_PRE_CLOUD_VERSION_CONNECTION { - get { - return ResourceManager.GetString("WARNING_PRE_CLOUD_VERSION_CONNECTION", resourceCulture); - } - } - /// /// Looks up a localized string similar to Cannot find '{0}'.. /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 766284fa1..90aef4e78 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -6404,7 +6404,7 @@ Note: Any custom color selections will remain unchanged UEFI certificates are missing from your system - This version of {0} can only connect to {1} and greater versions. It cannot connect to {2}. + This version of {0} can only connect to {1}, and {2} or greater versions. It cannot connect to {3}. You can get a compatible version of {0} from the following location: @@ -11662,7 +11662,7 @@ The coordinator must be upgraded first, so if you skip the coordinator, the roll The current time on the pool coordinator is: {0} - This version of {0} supports {1} onwards. + This version of {0} can only connect to {1}, and {2} or greater versions. Use an earlier version of {0} to manage this server. @@ -13920,9 +13920,6 @@ Schedule: Health Check has been removed. You must disable Health Check first. - - {0} {1} is not recommended for general management of servers running {2}. Please use latest available {0} for {2} instead. - Cannot find '{0}'. diff --git a/XenModel/Network/XenConnection.cs b/XenModel/Network/XenConnection.cs index f97b7b9cc..2efeee1be 100644 --- a/XenModel/Network/XenConnection.cs +++ b/XenModel/Network/XenConnection.cs @@ -1142,7 +1142,7 @@ namespace XenAdmin.Network // Save the session so we can log it out later task.Session = session; - if (session.APIVersion < API_Version.API_2_5) + if (session.APIVersion < API_Version.API_2_6) throw new ServerNotSupported(); // Event.next uses a different session with a shorter timeout: see CA-33145. @@ -1932,8 +1932,8 @@ namespace XenAdmin.Network public class ServerNotSupported : DisconnectionException { - public override string Message => string.Format(Messages.SERVER_TOO_OLD, - BrandManager.BrandConsole, BrandManager.ProductVersion70); + public override string Message => string.Format(Messages.SERVER_TOO_OLD, BrandManager.BrandConsole, + BrandManager.ProductVersion712, BrandManager.ProductVersion80); } public class ConnectionExists : DisconnectionException diff --git a/XenModel/Utils/Helpers.Versions.cs b/XenModel/Utils/Helpers.Versions.cs index 27045c671..3d48f5c21 100644 --- a/XenModel/Utils/Helpers.Versions.cs +++ b/XenModel/Utils/Helpers.Versions.cs @@ -206,12 +206,9 @@ namespace XenAdmin.Core { if (host == null) return true; - string productVersion = HostProductVersion(host); - return - productVersion != null && - ElyOrGreater(host) && - !FalconOrGreater(host) && - ProductVersionCompare(productVersion, BrandManager.ProductVersion712Short) >= 0; + + return ElyOrGreater(host) && + ProductVersionCompare(HostProductVersion(host), BrandManager.ProductVersion712Short) >= 0; } ///