CA-381102 and other update process corrections.

- Put the servers in maintenance mode before applying the updates.
- Updated host do not disappear completely from the metadata hence we need to skip them from the update plan.

Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
Konstantina Chremmou 2023-08-10 19:08:16 +01:00
parent 7fb1bd4eb6
commit 5e860b03f7
2 changed files with 10 additions and 1 deletions

View File

@ -137,7 +137,7 @@ namespace XenAdmin.Wizards.PatchingWizard
foreach (var server in allHosts)
{
var hostUpdateInfo = updateInfo.HostsWithUpdates.FirstOrDefault(c => c.HostOpaqueRef == server.opaque_ref);
if (hostUpdateInfo == null)
if (hostUpdateInfo?.UpdateIDs?.Length == 0)
continue;
hostPlans.Add(GetCdnUpdatePlanActionsForHost(server, updateInfo, hostUpdateInfo));

View File

@ -37,6 +37,8 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
{
public class ApplyCdnUpdatesPlanAction : HostPlanAction
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private readonly CdnPoolUpdateInfo _updateInfo;
public ApplyCdnUpdatesPlanAction(Host host, CdnPoolUpdateInfo updateInfo)
@ -49,6 +51,13 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
{
var host = GetResolvedHost();
if (host.enabled)
{
log.DebugFormat("Disabling host {0}", host.Name());
AddProgressStep(string.Format(Messages.UPDATES_WIZARD_ENTERING_MAINTENANCE_MODE, host.Name()));
Host.disable(session, HostXenRef.opaque_ref);
}
AddProgressStep(string.Format(Messages.UPDATES_WIZARD_APPLYING_UPDATES_FROM_CDN, host.Name()));
new ApplyUpdatesFromCdnAction(host, _updateInfo).RunSync(session);
}