mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CA-251630: XenCenter update wizard incorrectly states that some hosts need rebooting and requires suspending VMs
Perform all the prechecks on applicable hosts only (i.e. the hosts that don't have the update applied already), with the following exceptions: - The HA check, which is performed on the pool master - The server-side precheck (PatchPrecheckCheck) which will still be performed on all servers in the pool and will show the warning if the update has already been applied on some servers This commit also adds an override to the HAOffCheck.SuccessfulCheckDescription to show the pool name instead of the master's if the check is successful. Also, in the PatchPrecheckCheck, I had moved the code that checks if the patch is already applied to the very beginning (before the host liveness check), so it will return the warning that the server will be skipped even if the server is not reachable Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
parent
f71b39ff5f
commit
6e4c5d3548
@ -69,5 +69,14 @@ namespace XenAdmin.Diagnostics.Checks
|
||||
return Messages.HA_CHECK_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
||||
public override string SuccessfulCheckDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
var pool = Helpers.GetPool(Host.Connection);
|
||||
return string.Format(Messages.PATCHING_WIZARD_HOST_CHECK_OK, pool != null ? pool.Name : Host.Name, Description);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,14 +80,6 @@ namespace XenAdmin.Diagnostics.Checks
|
||||
|
||||
protected override Problem RunCheck()
|
||||
{
|
||||
if (!Host.IsLive)
|
||||
return new HostNotLiveWarning(this, Host);
|
||||
|
||||
if (!Host.Connection.IsConnected)
|
||||
throw new EndOfStreamException(Helpers.GetName(Host.Connection));
|
||||
|
||||
Session session = Host.Connection.DuplicateSession();
|
||||
|
||||
//
|
||||
// Check patch isn't already applied here
|
||||
//
|
||||
@ -96,6 +88,16 @@ namespace XenAdmin.Diagnostics.Checks
|
||||
{
|
||||
return new PatchAlreadyApplied(this, Host);
|
||||
}
|
||||
|
||||
if (!Host.IsLive)
|
||||
return new HostNotLiveWarning(this, Host);
|
||||
|
||||
if (!Host.Connection.IsConnected)
|
||||
throw new EndOfStreamException(Helpers.GetName(Host.Connection));
|
||||
|
||||
Session session = Host.Connection.DuplicateSession();
|
||||
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -343,14 +343,14 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
set;
|
||||
}
|
||||
|
||||
protected virtual List<KeyValuePair<string, List<Check>>> GenerateCommonChecks()
|
||||
protected virtual List<KeyValuePair<string, List<Check>>> GenerateCommonChecks(List<Host> applicableServers)
|
||||
{
|
||||
List<KeyValuePair<string, List<Check>>> checks = new List<KeyValuePair<string, List<Check>>>();
|
||||
|
||||
//HostLivenessCheck checks
|
||||
checks.Add(new KeyValuePair<string, List<Check>>(Messages.CHECKING_HOST_LIVENESS_STATUS, new List<Check>()));
|
||||
List<Check> checkGroup = checks[checks.Count - 1].Value;
|
||||
foreach (Host host in SelectedServers)
|
||||
foreach (Host host in applicableServers)
|
||||
{
|
||||
checkGroup.Add(new HostLivenessCheck(host));
|
||||
}
|
||||
@ -367,7 +367,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
//PBDsPluggedCheck
|
||||
checks.Add(new KeyValuePair<string, List<Check>>(Messages.CHECKING_STORAGE_CONNECTIONS_STATUS, new List<Check>()));
|
||||
checkGroup = checks[checks.Count - 1].Value;
|
||||
foreach (Host host in SelectedServers)
|
||||
foreach (Host host in applicableServers)
|
||||
{
|
||||
checkGroup.Add(new PBDsPluggedCheck(host));
|
||||
}
|
||||
@ -404,7 +404,9 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
|
||||
protected virtual List<KeyValuePair<string, List<Check>>> GenerateChecks(Pool_patch patch)
|
||||
{
|
||||
List<KeyValuePair<string, List<Check>>> checks = GenerateCommonChecks();
|
||||
List<Host> applicableServers = patch != null ? SelectedServers.Where(h => patch.AppliedOn(h) == DateTime.MaxValue).ToList() : SelectedServers;
|
||||
|
||||
List<KeyValuePair<string, List<Check>>> checks = GenerateCommonChecks(applicableServers);
|
||||
|
||||
List<Check> checkGroup;
|
||||
|
||||
@ -429,7 +431,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
var guidance = patch != null
|
||||
? patch.after_apply_guidance
|
||||
: new List<after_apply_guidance> {after_apply_guidance.restartHost};
|
||||
foreach (var host in SelectedServers)
|
||||
foreach (var host in applicableServers)
|
||||
{
|
||||
checkGroup.Add(new HostNeedsRebootCheck(host, guidance, LivePatchCodesByHost));
|
||||
}
|
||||
@ -442,7 +444,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
{
|
||||
checks.Add(new KeyValuePair<string, List<Check>>(Messages.CHECKING_CANEVACUATE_STATUS, new List<Check>()));
|
||||
checkGroup = checks[checks.Count - 1].Value;
|
||||
foreach (Host host in SelectedServers)
|
||||
foreach (Host host in applicableServers)
|
||||
{
|
||||
checkGroup.Add(new AssertCanEvacuateCheck(host, LivePatchCodesByHost));
|
||||
}
|
||||
@ -453,8 +455,9 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
|
||||
protected virtual List<KeyValuePair<string, List<Check>>> GenerateChecks(Pool_update update)
|
||||
{
|
||||
List<KeyValuePair<string, List<Check>>> checks = GenerateCommonChecks();
|
||||
List<Host> applicableServers = update != null ? SelectedServers.Where(h => !update.AppliedOn(h)).ToList() : SelectedServers;
|
||||
|
||||
List<KeyValuePair<string, List<Check>>> checks = GenerateCommonChecks(applicableServers);
|
||||
List<Check> checkGroup;
|
||||
|
||||
//Checking other things
|
||||
@ -478,7 +481,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
var guidance = update != null
|
||||
? update.after_apply_guidance
|
||||
: new List<update_after_apply_guidance> {update_after_apply_guidance.restartHost};
|
||||
foreach (var host in SelectedServers)
|
||||
foreach (var host in applicableServers)
|
||||
{
|
||||
checkGroup.Add(new HostNeedsRebootCheck(host, guidance, LivePatchCodesByHost));
|
||||
}
|
||||
@ -489,7 +492,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
{
|
||||
checks.Add(new KeyValuePair<string, List<Check>>(Messages.CHECKING_CANEVACUATE_STATUS, new List<Check>()));
|
||||
checkGroup = checks[checks.Count - 1].Value;
|
||||
foreach (Host host in SelectedServers)
|
||||
foreach (Host host in applicableServers)
|
||||
{
|
||||
checkGroup.Add(new AssertCanEvacuateCheck(host, LivePatchCodesByHost));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user