CA-304656: Stop users from applying automated updates that will bring the server to a verson incompatible with the current XenCenter version.

When running the XenCenter version precheck, calculate the higher server version that will be installed (by looking at the update sequence) and use this for checking the XenCenter version compatibility.

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2019-06-03 13:49:30 +01:00 committed by Konstantina Chremmou
parent 23b0517cb7
commit 71333fcf90

View File

@ -348,12 +348,6 @@ namespace XenAdmin.Wizards.PatchingWizard
{
var groups = new List<CheckGroup>();
//XenCenter version check
if (UpdateAlert != null && UpdateAlert.NewServerVersion != null)
{
groups.Add(new CheckGroup(Messages.CHECKING_XENCENTER_VERSION, new List<Check> {new XenCenterVersionCheck(UpdateAlert.NewServerVersion)}));
}
//HostLivenessCheck checks
var livenessChecks = new List<Check>();
foreach (Host host in applicableServers)
@ -392,6 +386,8 @@ namespace XenAdmin.Wizards.PatchingWizard
groups.Add(new CheckGroup(Messages.CHECKING_STORAGE_CONNECTIONS_STATUS, pbdChecks));
XenServerVersion highestNewVersion = null;
//Disk space, reboot required and can evacuate host checks for automated and version updates
if (WizardMode != WizardMode.SingleUpdate)
{
@ -444,9 +440,18 @@ namespace XenAdmin.Wizards.PatchingWizard
rebootChecks.Add(new HostNeedsRebootCheck(host, restartHostPatches));
if (restartHostPatches.Any(p => !p.ContainsLivepatch))
evacuateChecks.Add(new AssertCanEvacuateCheck(host));
foreach (var p in us[host])
{
var newVersion = Updates.XenServerVersions.FirstOrDefault(v => v.PatchUuid != null && v.PatchUuid.Equals(p.Uuid, StringComparison.OrdinalIgnoreCase));
if (newVersion != null && (highestNewVersion == null || newVersion.Version > highestNewVersion.Version))
highestNewVersion = newVersion;
}
}
}
}
groups.Add(new CheckGroup(Messages.PATCHINGWIZARD_PRECHECKPAGE_CHECKING_DISK_SPACE, diskChecks));
if (rebootChecks.Count > 0)
groups.Add(new CheckGroup(Messages.CHECKING_SERVER_NEEDS_REBOOT, rebootChecks));
@ -454,6 +459,14 @@ namespace XenAdmin.Wizards.PatchingWizard
groups.Add(new CheckGroup(Messages.CHECKING_CANEVACUATE_STATUS, evacuateChecks));
}
//XenCenter version check
if (highestNewVersion != null || UpdateAlert?.NewServerVersion != null)
{
// add XenCenter version check as the first group
groups.Insert(0, new CheckGroup(Messages.CHECKING_XENCENTER_VERSION,
new List<Check> { new XenCenterVersionCheck(highestNewVersion ?? UpdateAlert.NewServerVersion) }));
}
//GFS2 check for version updates
if (WizardMode == WizardMode.NewVersion)
{