CP-43102: Only allow connections to Havana and Naples or greater servers.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2023-05-10 15:22:46 +01:00 committed by Konstantina Chremmou
parent 82940850e9
commit d599bf4024
9 changed files with 30 additions and 49 deletions

View File

@ -153,6 +153,9 @@
<data name="PRODUCT_VERSION_7_0_SHORT" xml:space="preserve">
<value>7.0</value>
</data>
<data name="PRODUCT_VERSION_7_1_2" xml:space="preserve">
<value>XenServer 7.1.2</value>
</data>
<data name="PRODUCT_VERSION_7_1_2_SHORT" xml:space="preserve">
<value>7.1.2</value>
</data>

View File

@ -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);

View File

@ -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
{

View File

@ -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;

View File

@ -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");

View File

@ -18329,7 +18329,7 @@ namespace XenAdmin {
}
/// <summary>
/// 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:.
/// </summary>
@ -33616,7 +33616,7 @@ namespace XenAdmin {
}
/// <summary>
/// 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..
/// </summary>
public static string SERVER_TOO_OLD {
get {
@ -40314,15 +40314,6 @@ namespace XenAdmin {
}
}
/// <summary>
/// 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..
/// </summary>
public static string WARNING_PRE_CLOUD_VERSION_CONNECTION {
get {
return ResourceManager.GetString("WARNING_PRE_CLOUD_VERSION_CONNECTION", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot find &apos;{0}&apos;..
/// </summary>

View File

@ -6404,7 +6404,7 @@ Note: Any custom color selections will remain unchanged</value>
<value>UEFI certificates are missing from your system</value>
</data>
<data name="GUI_NOT_COMPATIBLE" xml:space="preserve">
<value>This version of {0} can only connect to {1} and greater versions. It cannot connect to {2}.
<value>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:</value>
</data>
@ -11662,7 +11662,7 @@ The coordinator must be upgraded first, so if you skip the coordinator, the roll
<value>The current time on the pool coordinator is: {0}</value>
</data>
<data name="SERVER_TOO_OLD" xml:space="preserve">
<value>This version of {0} supports {1} onwards.</value>
<value>This version of {0} can only connect to {1}, and {2} or greater versions.</value>
</data>
<data name="SERVER_TOO_OLD_SOLUTION" xml:space="preserve">
<value>Use an earlier version of {0} to manage this server.</value>
@ -13920,9 +13920,6 @@ Schedule:
<data name="WARNING_HEALTH_CHECK_SERVICE_INFO" xml:space="preserve">
<value>Health Check has been removed. You must disable Health Check first.</value>
</data>
<data name="WARNING_PRE_CLOUD_VERSION_CONNECTION" xml:space="preserve">
<value>{0} {1} is not recommended for general management of servers running {2}. Please use latest available {0} for {2} instead.</value>
</data>
<data name="WEB_BROWSER_FAILED" xml:space="preserve">
<value>Cannot find '{0}'.</value>
</data>

View File

@ -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

View File

@ -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;
}
/// <summary>