mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
Rewrote the update application sequence to fix various issues:
- CA-380799: Host evacuation is not needed when the guidance is toolstack restart. - CA-380796: Sometimes the guidance was applied before the update installation. - Livepatch notice should be shown only if guidance is not reboot host. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
parent
a231ca0876
commit
6eaff6dc54
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,45 +174,24 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
var planActionsPerHost = new List<PlanAction>();
|
||||
var delayedActionsPerHost = new List<PlanAction>();
|
||||
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<Host>(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<Host>(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
4
XenModel/Messages.Designer.cs
generated
4
XenModel/Messages.Designer.cs
generated
@ -20514,9 +20514,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
public static string HOTFIX_POST_UPDATE_LIVEPATCH_ACTIONS {
|
||||
get {
|
||||
|
@ -7162,9 +7162,7 @@ This might result in failure to migrate VMs to this server during the RPU or to
|
||||
{0}</value>
|
||||
</data>
|
||||
<data name="HOTFIX_POST_UPDATE_LIVEPATCH_ACTIONS" xml:space="preserve">
|
||||
<value>This server will be live patched.
|
||||
Post-update tasks to be performed if live patch fails:
|
||||
{0}</value>
|
||||
<value>This server will be live patched. If live patch fails, a server reboot will be required.</value>
|
||||
</data>
|
||||
<data name="HOTFIX_RPMS_TO_INSTALL" xml:space="preserve">
|
||||
<value>{0} packages will be updated</value>
|
||||
|
Loading…
Reference in New Issue
Block a user