Merge pull request #1401 from letsboogey/master

CA-239951 - Patching wizard allows selection of unreachable hosts
This commit is contained in:
Mihaela Stoica 2017-01-30 11:02:38 +00:00 committed by GitHub
commit 73293c7e4b
8 changed files with 92 additions and 9 deletions

View File

@ -115,6 +115,11 @@ namespace XenAdmin.Diagnostics.Checks
if (livePatchCodesByHost != null)
livePatchCodesByHost[Host.uuid] = livepatchStatus;
}
//trying to apply update to partially upgraded pool
else if (Helpers.ElyOrGreater(Helpers.GetMaster(Host.Connection)) && !Helpers.ElyOrGreater(Host))
{
return new WrongServerVersion(this, Host);
}
return null;
}

View File

@ -1677,7 +1677,7 @@ namespace XenAdmin.TabPages
if (Helpers.ElyOrGreater(host))
{
foreach (var update in host.AppliedUpdates())
result.Add(update.Name);
result.Add(UpdatesFriendlyName(update.Name));
}
else
{
@ -1770,7 +1770,7 @@ namespace XenAdmin.TabPages
foreach (var update in updates)
if (predicate(update))
output.Add(update.name_label);
output.Add(UpdatesFriendlyName(update.Name));
output.Sort(StringUtility.NaturalCompare);
@ -1893,8 +1893,8 @@ namespace XenAdmin.TabPages
private KeyValuePair<string, string> 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_REBOOT_WARNING, host.Name, update.Name);
var key = String.Format(Messages.GENERAL_PANEL_UPDATE_KEY, UpdatesFriendlyName(update.Name), host.Name);
var value = string.Format(Messages.GENERAL_PANEL_UPDATE_REBOOT_WARNING, host.Name, UpdatesFriendlyName(update.Name));
return new KeyValuePair<string, string>(key, value);
}
@ -1909,6 +1909,11 @@ namespace XenAdmin.TabPages
return Core.PropertyManager.GetFriendlyName(string.Format("Label-{0}", propertyName)) ?? propertyName;
}
private static string UpdatesFriendlyName(string propertyName)
{
return Core.PropertyManager.FriendlyNames.GetString(string.Format("Label-{0}", propertyName)) ?? propertyName;
}
private void linkLabelExpand_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
foreach (PDSection s in sections)

View File

@ -208,6 +208,14 @@ namespace XenAdmin.Wizards.PatchingWizard
return;
}
//if host is unreachable
if (!host.IsLive)
{
row.Enabled = false;
row.Cells[3].ToolTipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_HOST_UNREACHABLE;
return;
}
return;
}
@ -228,6 +236,13 @@ namespace XenAdmin.Wizards.PatchingWizard
return;
}
if (!host.IsLive)
{
row.Enabled = false;
row.Cells[3].ToolTipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_HOST_UNREACHABLE;
return;
}
switch (type)
{
case UpdateType.NewRetail:
@ -430,14 +445,18 @@ namespace XenAdmin.Wizards.PatchingWizard
{
if (poolSelectionOnly)
{
return SelectedPools.SelectMany(p => p.Connection.Cache.Hosts).ToList();
if (IsInAutomaticMode)
//prechecks will fail in automated updates mode if one of the hosts is unreachable
return SelectedPools.SelectMany(p => p.Connection.Cache.Hosts).ToList();
//prechecks will issue warning but allow updates to be installed on the reachable hosts only
return SelectedPools.SelectMany(p => p.Connection.Cache.Hosts.Where(host => host.IsLive)).ToList();
}
else
{
List<Host> hosts = new List<Host>();
foreach (PatchingHostsDataGridViewRow row in dataGridViewHosts.Rows)
{
if (row.Tag is Host)
if (row.IsSelectableHost)
{
if ((row.HasPool && ((int)row.Cells[POOL_ICON_HOST_CHECKBOX_COL].Value) == CHECKED) || (!row.HasPool && ((int)row.Cells[POOL_CHECKBOX_COL].Value) == CHECKED))
hosts.Add((Host)row.Tag);

View File

@ -61,9 +61,15 @@ namespace XenAdmin.Actions
protected override void Run()
{
Description = String.Format(Messages.REMOVING_UPDATE, patch.Name);
RelatedTask=Pool_patch.async_destroy(Session, patch.opaque_ref);
PollToCompletion(0, 100);
try
{
RelatedTask = Pool_patch.async_destroy(Session, patch.opaque_ref);
PollToCompletion(0, 100);
}
catch (Failure f)
{
log.Error("Clean up failed", f);
}
Description = String.Format(Messages.REMOVED_UPDATE, patch.Name);
}

View File

@ -2769,6 +2769,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to PVS-Accelerator.
/// </summary>
public static string Label_pvsaccelerator {
get {
return ResourceManager.GetString("Label-pvsaccelerator", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Disk space allocations.
/// </summary>
@ -3462,6 +3471,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Measured Boot.
/// </summary>
public static string Label_xenserver_measured_boot {
get {
return ResourceManager.GetString("Label-xenserver-measured-boot", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Container Management.
/// </summary>
public static string Label_xscontainer {
get {
return ResourceManager.GetString("Label-xscontainer", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to HA Settings.
/// </summary>

View File

@ -1916,4 +1916,13 @@
<data name="Label-performance.sr_rw_write_latency" xml:space="preserve">
<value>'{0}' Write Latency</value>
</data>
<data name="Label-pvsaccelerator" xml:space="preserve">
<value>PVS-Accelerator</value>
</data>
<data name="Label-xenserver-measured-boot" xml:space="preserve">
<value>Measured Boot</value>
</data>
<data name="Label-xscontainer" xml:space="preserve">
<value>Container Management</value>
</data>
</root>

View File

@ -26889,6 +26889,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to The server is unreachable.
/// </summary>
public static string PATCHINGWIZARD_SELECTSERVERPAGE_HOST_UNREACHABLE {
get {
return ResourceManager.GetString("PATCHINGWIZARD_SELECTSERVERPAGE_HOST_UNREACHABLE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Update already applied.
/// </summary>

View File

@ -9286,6 +9286,9 @@ However, there is not enough space to perform the repartitioning, so the current
<data name="PATCHINGWIZARD_SELECTSERVERPAGE_HOST_UNLICENSED_FOR_AUTOMATED_UPDATES" xml:space="preserve">
<value>The server is not licensed for automated updates</value>
</data>
<data name="PATCHINGWIZARD_SELECTSERVERPAGE_HOST_UNREACHABLE" xml:space="preserve">
<value>The server is unreachable</value>
</data>
<data name="PATCHINGWIZARD_SELECTSERVERPAGE_PATCH_ALREADY_APPLIED" xml:space="preserve">
<value>Update already applied</value>
</data>