mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CA-227067: General tab: XenCenter does not show Reboot required when Toolstack restart required
On the General tab XenCenter shows a list of updates that requires the host to be restarted. This is shown for applied updates for which the required guidance hasn't been done (eg. restartHost or restartAgent after-apply-guidances) This commit fixes a regression that caused restartToolstack warnings to be not shown in the list of warnings. The displayed messages are also improved, XenCenter will show Toolstack restart or host restart appropriately and not just restart only as it used to. Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
parent
e36eea4a8e
commit
fa7dbc14ed
@ -1825,17 +1825,11 @@ namespace XenAdmin.TabPages
|
|||||||
{
|
{
|
||||||
double applyTime = Util.ToUnixTime(patch.AppliedOn(host));
|
double applyTime = Util.ToUnixTime(patch.AppliedOn(host));
|
||||||
|
|
||||||
if (patch.after_apply_guidance.Contains(after_apply_guidance.restartHost)
|
if (patch.after_apply_guidance.Contains(after_apply_guidance.restartHost) && applyTime > bootTime
|
||||||
&& applyTime > bootTime)
|
|| patch.after_apply_guidance.Contains(after_apply_guidance.restartXAPI) && applyTime > agentStart)
|
||||||
{
|
{
|
||||||
warnings.Add(CreateWarningRow(host, patch));
|
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;
|
return warnings;
|
||||||
}
|
}
|
||||||
@ -1848,6 +1842,8 @@ namespace XenAdmin.TabPages
|
|||||||
private List<KeyValuePair<String, String>> CheckHostUpdatesRequiringReboot(Host host)
|
private List<KeyValuePair<String, String>> CheckHostUpdatesRequiringReboot(Host host)
|
||||||
{
|
{
|
||||||
var warnings = new List<KeyValuePair<String, String>>();
|
var warnings = new List<KeyValuePair<String, String>>();
|
||||||
|
|
||||||
|
// Updates that require host restart
|
||||||
var updateRefs = host.updates_requiring_reboot;
|
var updateRefs = host.updates_requiring_reboot;
|
||||||
foreach (var updateRef in updateRefs)
|
foreach (var updateRef in updateRefs)
|
||||||
{
|
{
|
||||||
@ -1855,21 +1851,49 @@ namespace XenAdmin.TabPages
|
|||||||
warnings.Add(CreateWarningRow(host, update));
|
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<Pool_patch> 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;
|
return warnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyValuePair<string, string> CreateWarningRow(Host host, Pool_patch patch)
|
private KeyValuePair<string, string> CreateWarningRow(Host host, Pool_patch patch)
|
||||||
{
|
{
|
||||||
var key = String.Format(Messages.GENERAL_PANEL_UPDATE_KEY, patch.Name, host.Name);
|
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<string, string>(key, value);
|
return new KeyValuePair<string, string>(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyValuePair<string, string> CreateWarningRow(Host host, Pool_update update)
|
private KeyValuePair<string, string> CreateWarningRow(Host host, Pool_update update)
|
||||||
{
|
{
|
||||||
var key = String.Format(Messages.GENERAL_PANEL_UPDATE_KEY, update.Name, host.Name);
|
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<string, string>(key, value);
|
return new KeyValuePair<string, string>(key, value);
|
||||||
}
|
}
|
||||||
|
13
XenModel/Messages.Designer.cs
generated
13
XenModel/Messages.Designer.cs
generated
@ -15785,9 +15785,18 @@ namespace XenAdmin {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to The server '{0}' needs to be rebooted for update '{1}' to take effect.
|
/// Looks up a localized string similar to The server '{0}' needs to be rebooted for update '{1}' to take effect.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GENERAL_PANEL_UPDATE_WARNING {
|
public static string GENERAL_PANEL_UPDATE_REBOOT_WARNING {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("GENERAL_PANEL_UPDATE_WARNING", resourceCulture);
|
return ResourceManager.GetString("GENERAL_PANEL_UPDATE_REBOOT_WARNING", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Toolstack on server '{0}' needs to be restarted for update '{1}' to take effect.
|
||||||
|
/// </summary>
|
||||||
|
public static string GENERAL_PANEL_UPDATE_RESTART_TOOLSTACK_WARNING {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("GENERAL_PANEL_UPDATE_RESTART_TOOLSTACK_WARNING", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5533,9 +5533,12 @@ Would you like to eject these ISOs before continuing?</value>
|
|||||||
<data name="GENERAL_PANEL_UPDATE_KEY" xml:space="preserve">
|
<data name="GENERAL_PANEL_UPDATE_KEY" xml:space="preserve">
|
||||||
<value>{0} on {1}</value>
|
<value>{0} on {1}</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GENERAL_PANEL_UPDATE_WARNING" xml:space="preserve">
|
<data name="GENERAL_PANEL_UPDATE_REBOOT_WARNING" xml:space="preserve">
|
||||||
<value>The server '{0}' needs to be rebooted for update '{1}' to take effect</value>
|
<value>The server '{0}' needs to be rebooted for update '{1}' to take effect</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="GENERAL_PANEL_UPDATE_RESTART_TOOLSTACK_WARNING" xml:space="preserve">
|
||||||
|
<value>Toolstack on server '{0}' needs to be restarted for update '{1}' to take effect</value>
|
||||||
|
</data>
|
||||||
<data name="GENERAL_SR_CONTEXT_REPAIR" xml:space="preserve">
|
<data name="GENERAL_SR_CONTEXT_REPAIR" xml:space="preserve">
|
||||||
<value>Repair</value>
|
<value>Repair</value>
|
||||||
</data>
|
</data>
|
||||||
|
Loading…
Reference in New Issue
Block a user