CA-239951 - Patching wizard allows selection of unreachable hosts

Disabled the ability to select unreachable hosts and in addition
added a try/catch block to hide error message resulting from trying
to clean up an unreachable host.

Signed-off-by: Letsibogo Ramadi <letsibogo.ramadi@citrix.com>
This commit is contained in:
Letsibogo Ramadi 2017-01-24 17:41:35 +00:00
parent b14cc05968
commit 045c405f92
4 changed files with 42 additions and 5 deletions

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

@ -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>