CP-21161: Do not call the disk-space plugin cleanup functions on Ely and above hosts

- Ensure that the disk-space plugin functions are not called on Ely or greater hosts, except for the 'get_avail_host_disk_space' function, which is still needed

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2017-06-27 13:48:54 +01:00
parent 94f3650c16
commit 537e569a62
3 changed files with 24 additions and 15 deletions

View File

@ -258,6 +258,7 @@ namespace XenAdmin.Diagnostics.Checks
case "PATCH_PRECHECK_FAILED_OUT_OF_SPACE":
System.Diagnostics.Trace.Assert(Helpers.CreamOrGreater(Host.Connection)); // If not Cream or greater, we shouldn't get this error
System.Diagnostics.Trace.Assert(!Helpers.ElyOrGreater(Host.Connection)); // If Ely or greater, we shouldn't get this error
long.TryParse(found, out foundSpace);
long.TryParse(required, out requiredSpace);
@ -287,9 +288,11 @@ namespace XenAdmin.Diagnostics.Checks
return new HostOutOfSpaceProblem(this, Host, Update, diskSpaceReq);
case "OUT_OF_SPACE":
if (Helpers.CreamOrGreater(Host.Connection))
if (Helpers.CreamOrGreater(Host.Connection) && (Patch != null || Update != null))
{
var action = new GetDiskSpaceRequirementsAction(Host, Patch, true);
var action = Patch != null
? new GetDiskSpaceRequirementsAction(Host, Patch, true)
: new GetDiskSpaceRequirementsAction(Host, Update.Name, Update.installation_size, true);
try
{
action.RunExternal(action.Session);
@ -299,7 +302,9 @@ namespace XenAdmin.Diagnostics.Checks
log.WarnFormat("Could not get disk space requirements");
}
if (action.Succeeded)
return new HostOutOfSpaceProblem(this, Host, Patch, action.DiskSpaceRequirements);
return Patch != null
? new HostOutOfSpaceProblem(this, Host, Patch, action.DiskSpaceRequirements)
: new HostOutOfSpaceProblem(this, Host, Update, action.DiskSpaceRequirements);
}
break;
}

View File

@ -292,7 +292,7 @@ namespace XenAdmin.Wizards.PatchingWizard
canUpload = true;
diskSpaceRequirements = null;
var diskSpaceActions = new List<AsyncAction>();
foreach (Host master in SelectedMasters.Where(master => Helpers.CreamOrGreater(master.Connection)))
foreach (Host master in SelectedMasters.Where(master => Helpers.CreamOrGreater(master.Connection) && !Helpers.ElyOrGreater(master.Connection)))
{
AsyncAction action = null;
switch (SelectedUpdateType)

View File

@ -33,6 +33,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using XenAdmin.Core;
using XenAPI;
@ -107,6 +108,8 @@ namespace XenAdmin.Actions
// get required disk space
long requiredDiskSpace = updateSize;
if (!Helpers.ElyOrGreater(Host)) // for ElyOrGreater we don't need to call get_required_space, because it will always return updateSize
{
try
{
var args = new Dictionary<string, string>();
@ -120,6 +123,7 @@ namespace XenAdmin.Actions
log.WarnFormat("Plugin call disk-space.get_required_space on {0} failed with {1}", Host.Name, failure.Message);
requiredDiskSpace = 0;
}
}
// get available disk space
long availableDiskSpace = 0;
@ -136,7 +140,7 @@ namespace XenAdmin.Actions
// get reclaimable disk space (excluding current patch)
long reclaimableDiskSpace = 0;
if (availableDiskSpace < requiredDiskSpace)
if (availableDiskSpace < requiredDiskSpace && !Helpers.ElyOrGreater(Host)) // for ElyOrGreater we shouldn't call get_reclaimable_disk_space
{
try
{