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,11 +94,11 @@ 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);
return new HostNeedsReboot(this, Host);
}
successfulCheckDescription = string.Format(Messages.UPDATES_WIZARD_NO_REBOOT_NEEDED, Host);

View File

@ -79,30 +79,31 @@ namespace XenAdmin.Wizards.PatchingWizard
bool someHostMayRequireRestart;
bool automaticDisabled;
if (IsNewGeneration)
switch (SelectedUpdateType)
{
ManualTextInstructions = ModeCdnUpdates();
automaticDisabled = anyPoolForbidsAutostart;
}
else
{
switch (SelectedUpdateType)
{
case UpdateType.Legacy:
case UpdateType.Legacy:
if (IsNewGeneration)
{
ManualTextInstructions = ModeCdnUpdates();
automaticDisabled = anyPoolForbidsAutostart;
}
else
{
ManualTextInstructions = ModePoolPatch(out someHostMayRequireRestart);
automaticDisabled = anyPoolForbidsAutostart && someHostMayRequireRestart;
break;
case UpdateType.ISO:
ManualTextInstructions = PoolUpdate != null
? ModePoolUpdate(out someHostMayRequireRestart)
: ModeSuppPack(out someHostMayRequireRestart);
automaticDisabled = anyPoolForbidsAutostart && someHostMayRequireRestart;
break;
default:
ManualTextInstructions = null;
automaticDisabled = true;
break;
}
}
break;
case UpdateType.ISO:
ManualTextInstructions = PoolUpdate != null
? ModePoolUpdate(out someHostMayRequireRestart)
: ModeSuppPack(out someHostMayRequireRestart);
automaticDisabled = anyPoolForbidsAutostart && someHostMayRequireRestart;
break;
default:
ManualTextInstructions = null;
automaticDisabled = true;
break;
}
if (ManualTextInstructions == null || ManualTextInstructions.Count == 0)

View File

@ -414,16 +414,12 @@ 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