diff --git a/XenAdmin/TabPages/GeneralTabPage.cs b/XenAdmin/TabPages/GeneralTabPage.cs index 6b6379cc9..cf1dfa86a 100644 --- a/XenAdmin/TabPages/GeneralTabPage.cs +++ b/XenAdmin/TabPages/GeneralTabPage.cs @@ -1825,17 +1825,11 @@ namespace XenAdmin.TabPages { double applyTime = Util.ToUnixTime(patch.AppliedOn(host)); - if (patch.after_apply_guidance.Contains(after_apply_guidance.restartHost) - && applyTime > bootTime) + if (patch.after_apply_guidance.Contains(after_apply_guidance.restartHost) && applyTime > bootTime + || patch.after_apply_guidance.Contains(after_apply_guidance.restartXAPI) && applyTime > agentStart) { warnings.Add(CreateWarningRow(host, patch)); } - else if (patch.after_apply_guidance.Contains(after_apply_guidance.restartXAPI) - && applyTime > agentStart) - { - // Actually, it only needs xapi restart, but we have no UI to do that. - warnings.Add(CreateWarningRow(host, patch)); - } } return warnings; } @@ -1848,6 +1842,8 @@ namespace XenAdmin.TabPages private List> CheckHostUpdatesRequiringReboot(Host host) { var warnings = new List>(); + + // Updates that require host restart var updateRefs = host.updates_requiring_reboot; foreach (var updateRef in updateRefs) { @@ -1855,21 +1851,49 @@ namespace XenAdmin.TabPages warnings.Add(CreateWarningRow(host, update)); } + // For Toolstack restart, legacy code has to be used to determine this - pool_patches are still populated for backward compatibility + List patches = host.AppliedPatches(); + double bootTime = host.BootTime; + double agentStart = host.AgentStartTime; + + if (bootTime == 0.0 || agentStart == 0.0) + return warnings; + + foreach (Pool_patch patch in patches) + { + double applyTime = Util.ToUnixTime(patch.AppliedOn(host)); + + if (patch.after_apply_guidance.Contains(after_apply_guidance.restartXAPI) + && applyTime > agentStart) + { + warnings.Add(CreateWarningRow(host, patch)); + } + } + return warnings; } private KeyValuePair CreateWarningRow(Host host, Pool_patch patch) { var key = String.Format(Messages.GENERAL_PANEL_UPDATE_KEY, patch.Name, host.Name); - var value = string.Format(Messages.GENERAL_PANEL_UPDATE_WARNING, host.Name, patch.Name); + string value = string.Empty; + if (patch.after_apply_guidance.Contains(after_apply_guidance.restartHost)) + { + value = string.Format(Messages.GENERAL_PANEL_UPDATE_REBOOT_WARNING, host.Name, patch.Name); + } + else if (patch.after_apply_guidance.Contains(after_apply_guidance.restartXAPI)) + { + value = string.Format(Messages.GENERAL_PANEL_UPDATE_RESTART_TOOLSTACK_WARNING, host.Name, patch.Name); + } + return new KeyValuePair(key, value); } private KeyValuePair CreateWarningRow(Host host, Pool_update update) { var key = String.Format(Messages.GENERAL_PANEL_UPDATE_KEY, update.Name, host.Name); - var value = string.Format(Messages.GENERAL_PANEL_UPDATE_WARNING, host.Name, update.Name); + var value = string.Format(Messages.GENERAL_PANEL_UPDATE_REBOOT_WARNING, host.Name, update.Name); return new KeyValuePair(key, value); } diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index fe5f6a45d..20c95cb74 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -15785,9 +15785,18 @@ namespace XenAdmin { /// /// Looks up a localized string similar to The server '{0}' needs to be rebooted for update '{1}' to take effect. /// - public static string GENERAL_PANEL_UPDATE_WARNING { + public static string GENERAL_PANEL_UPDATE_REBOOT_WARNING { get { - return ResourceManager.GetString("GENERAL_PANEL_UPDATE_WARNING", resourceCulture); + return ResourceManager.GetString("GENERAL_PANEL_UPDATE_REBOOT_WARNING", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Toolstack on server '{0}' needs to be restarted for update '{1}' to take effect. + /// + public static string GENERAL_PANEL_UPDATE_RESTART_TOOLSTACK_WARNING { + get { + return ResourceManager.GetString("GENERAL_PANEL_UPDATE_RESTART_TOOLSTACK_WARNING", resourceCulture); } } diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 60e0b1786..7bb3f958e 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -5533,9 +5533,12 @@ Would you like to eject these ISOs before continuing? {0} on {1} - + The server '{0}' needs to be rebooted for update '{1}' to take effect + + Toolstack on server '{0}' needs to be restarted for update '{1}' to take effect + Repair