diff --git a/XenAdmin/TabPages/CdnUpdates/CdnExpandableRow.cs b/XenAdmin/TabPages/CdnUpdates/CdnExpandableRow.cs index 0d3e57099..6f4e93f33 100644 --- a/XenAdmin/TabPages/CdnUpdates/CdnExpandableRow.cs +++ b/XenAdmin/TabPages/CdnUpdates/CdnExpandableRow.cs @@ -209,19 +209,10 @@ namespace XenAdmin.TabPages.CdnUpdates { if (hostUpdateInfo.RecommendedGuidance.Length > 0) { - bool allLivePatches = true; + _childRows.Add(new PostUpdateActionRow(hostUpdateInfo.RecommendedGuidance)); - foreach (var id in hostUpdateInfo.UpdateIDs) - { - var update = poolUpdateInfo.Updates.FirstOrDefault(u => u.Id == id); - if (update != null && update.LivePatchGuidance == CdnLivePatchGuidance.None) - { - allLivePatches = false; - break; - } - } - - _childRows.Add(new PostUpdateActionRow(hostUpdateInfo.RecommendedGuidance, allLivePatches)); + if (hostUpdateInfo.LivePatches.Length > 0 && !hostUpdateInfo.RecommendedGuidance.Contains(CdnGuidance.RebootHost)) + _childRows.Add(new LivePatchActionRow()); } var categories = hostUpdateInfo.GetUpdateCategories(poolUpdateInfo); @@ -293,14 +284,18 @@ namespace XenAdmin.TabPages.CdnUpdates internal class PostUpdateActionRow : CdnExpandableRow { - public PostUpdateActionRow(CdnGuidance[] guidance, bool allLivePatches) + public PostUpdateActionRow(CdnGuidance[] guidance) { - var msg = allLivePatches ? Messages.HOTFIX_POST_UPDATE_LIVEPATCH_ACTIONS : Messages.HOTFIX_POST_UPDATE_ACTIONS; + var text = string.Format(Messages.HOTFIX_POST_UPDATE_ACTIONS, string.Join(Environment.NewLine, guidance.Select(Cdn.FriendlyInstruction))); + SetValues(text, Images.StaticImages.rightArrowLong_Blue_16); + } + } - var text = string.Format(msg, string.Join(Environment.NewLine, guidance.Select(Cdn.FriendlyInstruction))); - var img = allLivePatches ? Images.StaticImages.livepatch_16 : Images.StaticImages.rightArrowLong_Blue_16; - - SetValues(text, img); + internal class LivePatchActionRow : CdnExpandableRow + { + public LivePatchActionRow() + { + SetValues(Messages.HOTFIX_POST_UPDATE_LIVEPATCH_ACTIONS, Images.StaticImages.livepatch_16); } } diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_AutomatedUpdatesPage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_AutomatedUpdatesPage.cs index 9463ee6ab..ad27c770d 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_AutomatedUpdatesPage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_AutomatedUpdatesPage.cs @@ -174,45 +174,24 @@ namespace XenAdmin.Wizards.PatchingWizard var planActionsPerHost = new List(); var delayedActionsPerHost = new List(); - if (hostUpdateInfo.RecommendedGuidance.Length > 0) + if (hostUpdateInfo.RecommendedGuidance.Length > 0 && PostUpdateTasksAutomatically) { - bool allLivePatches = true; - - foreach (var id in hostUpdateInfo.UpdateIDs) - { - var update = poolUpdateInfo.Updates.FirstOrDefault(u => u.Id == id); - if (update != null && update.LivePatchGuidance == CdnLivePatchGuidance.None) - { - allLivePatches = false; - break; - } - } - if (hostUpdateInfo.RecommendedGuidance.Contains(CdnGuidance.RebootHost)) { - if (!allLivePatches) - planActionsPerHost.Add(new EvacuateHostPlanAction(host)); - - if (PostUpdateTasksAutomatically) - delayedActionsPerHost.Add(new RestartHostPlanAction(host, host.GetRunningVMs())); + planActionsPerHost.Add(new EvacuateHostPlanAction(host)); + delayedActionsPerHost.Add(new RestartHostPlanAction(host, host.GetRunningVMs())); } else if (hostUpdateInfo.RecommendedGuidance.Contains(CdnGuidance.RestartToolstack)) { - if (!allLivePatches) - planActionsPerHost.Add(new EvacuateHostPlanAction(host)); - - if (PostUpdateTasksAutomatically) - planActionsPerHost.Add(new RestartAgentPlanAction(host)); + delayedActionsPerHost.Add(new RestartAgentPlanAction(host)); } else if (hostUpdateInfo.RecommendedGuidance.Contains(CdnGuidance.EvacuateHost)) { - if (!allLivePatches) - planActionsPerHost.Add(new EvacuateHostPlanAction(host)); + planActionsPerHost.Add(new EvacuateHostPlanAction(host)); } else if (hostUpdateInfo.RecommendedGuidance.Contains(CdnGuidance.RestartDeviceModel)) { - if (!allLivePatches) - planActionsPerHost.Add(new RebootVMsPlanAction(host, host.GetRunningVMs())); + delayedActionsPerHost.Add(new RebootVMsPlanAction(host, host.GetRunningVMs())); } } diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs index 028271372..56ef9192b 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs @@ -297,33 +297,21 @@ namespace XenAdmin.Wizards.PatchingWizard { if (hostUpdateInfo.RecommendedGuidance.Length > 0) { - bool allLivePatches = true; - - foreach (var id in hostUpdateInfo.UpdateIDs) + var host = pool.Connection.Resolve(new XenRef(hostUpdateInfo.HostOpaqueRef)); + if (host != null) { - var update = poolUpdateInfo.Updates.FirstOrDefault(u => u.Id == id); - if (update != null && update.LivePatchGuidance == CdnLivePatchGuidance.None) - { - allLivePatches = false; - break; - } - } + var hostSb = new StringBuilder(); - if (!allLivePatches) - { - var host = pool.Connection.Resolve(new XenRef(hostUpdateInfo.HostOpaqueRef)); - if (host != null) - { - var hostSb = new StringBuilder(); + var msg = host.IsCoordinator() ? $"{host.Name()} ({Messages.COORDINATOR})" : host.Name(); + hostSb.AppendIndented(msg).AppendLine(); - var msg = host.IsCoordinator() ? $"{host.Name()} ({Messages.COORDINATOR})" : host.Name(); - hostSb.AppendIndented(msg).AppendLine(); + foreach (var g in hostUpdateInfo.RecommendedGuidance) + hostSb.AppendIndented(Cdn.FriendlyInstruction(g), 4).AppendLine(); - foreach (var g in hostUpdateInfo.RecommendedGuidance) - hostSb.AppendIndented(Cdn.FriendlyInstruction(g), 4).AppendLine(); + if (hostUpdateInfo.LivePatches.Length > 0 && !hostUpdateInfo.RecommendedGuidance.Contains(CdnGuidance.RebootHost)) + hostSb.AppendIndented(Messages.HOTFIX_POST_UPDATE_LIVEPATCH_ACTIONS, 4).AppendLine(); - hostDict[host] = hostSb; - } + hostDict[host] = hostSb; } } } diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 0a2c37c9e..a38f9c555 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -20514,9 +20514,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to This server will be live patched. - ///Post-update tasks to be performed if live patch fails: - ///{0}. + /// Looks up a localized string similar to This server will be live patched. If live patch fails, a server reboot will be required.. /// public static string HOTFIX_POST_UPDATE_LIVEPATCH_ACTIONS { get { diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index aa118f068..7862e26b6 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -7162,9 +7162,7 @@ This might result in failure to migrate VMs to this server during the RPU or to {0} - This server will be live patched. -Post-update tasks to be performed if live patch fails: -{0} + This server will be live patched. If live patch fails, a server reboot will be required. {0} packages will be updated