Corrected prechecks and calculation of post-update tasks for supp-packs installed on new servers.

Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
Konstantina Chremmou 2023-08-16 22:19:19 +01:00
parent d9885d342b
commit 6e175a4280
3 changed files with 36 additions and 41 deletions

View File

@ -74,17 +74,15 @@ namespace XenAdmin.Diagnostics.Checks
protected override Problem RunHostCheck()
{
if (Helpers.CloudOrGreater(Host))
{
if (Helpers.CloudOrGreater(Host) && livePatchCodesByHost == null)
return new HostNeedsReboot(this, Host);
}
var updateSequenceIsLivePatchable = restartHostPatches != null && restartHostPatches.Count > 0 && restartHostPatches.All(p => p.ContainsLivepatch);
var updateSequenceIsLivePatchable = restartHostPatches != null && restartHostPatches.Count > 0 &&
restartHostPatches.All(p => p.ContainsLivepatch);
var hostHasBeenLivePatched = livePatchCodesByHost != null && livePatchCodesByHost.ContainsKey(Host.uuid) &&
livePatchCodesByHost[Host.uuid] == livepatch_status.ok_livepatch_complete;
// when livepatching is available, no restart is expected
if (livePatchCodesByHost != null && livePatchCodesByHost.ContainsKey(Host.uuid) &&
livePatchCodesByHost[Host.uuid] == livepatch_status.ok_livepatch_complete
|| updateSequenceIsLivePatchable)
if (hostHasBeenLivePatched || updateSequenceIsLivePatchable)
{
var livePatchingRestricted = Helpers.FeatureForbidden(Host.Connection, Host.RestrictLivePatching);
var livePatchingRDisabled = Helpers.GetPoolOfOne(Host.Connection)?.live_patching_disabled == true;
@ -96,9 +94,9 @@ namespace XenAdmin.Diagnostics.Checks
return null;
}
if ((updateGuidance != null && updateGuidance.Contains(update_after_apply_guidance.restartHost))
|| (patchGuidance != null && patchGuidance.Contains(after_apply_guidance.restartHost))
|| (restartHostPatches != null && restartHostPatches.Count > 0))
if (updateGuidance != null && updateGuidance.Contains(update_after_apply_guidance.restartHost) ||
patchGuidance != null && patchGuidance.Contains(after_apply_guidance.restartHost) ||
restartHostPatches != null && restartHostPatches.Count > 0)
{
return new HostNeedsReboot(this, Host);
}

View File

@ -79,6 +79,9 @@ namespace XenAdmin.Wizards.PatchingWizard
bool someHostMayRequireRestart;
bool automaticDisabled;
switch (SelectedUpdateType)
{
case UpdateType.Legacy:
if (IsNewGeneration)
{
ManualTextInstructions = ModeCdnUpdates();
@ -86,11 +89,10 @@ namespace XenAdmin.Wizards.PatchingWizard
}
else
{
switch (SelectedUpdateType)
{
case UpdateType.Legacy:
ManualTextInstructions = ModePoolPatch(out someHostMayRequireRestart);
automaticDisabled = anyPoolForbidsAutostart && someHostMayRequireRestart;
}
break;
case UpdateType.ISO:
ManualTextInstructions = PoolUpdate != null
@ -103,7 +105,6 @@ namespace XenAdmin.Wizards.PatchingWizard
automaticDisabled = true;
break;
}
}
if (ManualTextInstructions == null || ManualTextInstructions.Count == 0)
{

View File

@ -414,17 +414,13 @@ namespace XenAdmin.Wizards.PatchingWizard
if (host == null)
continue;
if (hostUpdateInfo.RecommendedGuidance.Contains(CdnGuidance.RebootHost))
{
var guidance = hostUpdateInfo.RecommendedGuidance;
if (guidance.Contains(CdnGuidance.RebootHost))
rebootChecks.Add(new HostNeedsRebootCheck(host));
if (guidance.Contains(CdnGuidance.RebootHost) || guidance.Contains(CdnGuidance.EvacuateHost))
evacuateChecks.Add(new AssertCanEvacuateCheck(host));
}
else if (hostUpdateInfo.RecommendedGuidance.Contains(CdnGuidance.EvacuateHost) ||
hostUpdateInfo.RecommendedGuidance.Contains(CdnGuidance.RestartToolstack))
{
evacuateChecks.Add(new AssertCanEvacuateCheck(host));
}
}
}
else
{