Merge pull request #1666 from MihaelaStoica/CP-21161

CP-21161: Do not call the disk-space plugin cleanup functions on Ely …
This commit is contained in:
Gabor Apati-Nagy 2017-07-04 15:37:34 +01:00 committed by GitHub
commit 51c08c7433
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": 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.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(found, out foundSpace);
long.TryParse(required, out requiredSpace); long.TryParse(required, out requiredSpace);
@ -287,9 +288,11 @@ namespace XenAdmin.Diagnostics.Checks
return new HostOutOfSpaceProblem(this, Host, Update, diskSpaceReq); return new HostOutOfSpaceProblem(this, Host, Update, diskSpaceReq);
case "OUT_OF_SPACE": 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 try
{ {
action.RunExternal(action.Session); action.RunExternal(action.Session);
@ -299,7 +302,9 @@ namespace XenAdmin.Diagnostics.Checks
log.WarnFormat("Could not get disk space requirements"); log.WarnFormat("Could not get disk space requirements");
} }
if (action.Succeeded) 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; break;
} }

View File

@ -292,7 +292,7 @@ namespace XenAdmin.Wizards.PatchingWizard
canUpload = true; canUpload = true;
diskSpaceRequirements = null; diskSpaceRequirements = null;
var diskSpaceActions = new List<AsyncAction>(); 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; AsyncAction action = null;
switch (SelectedUpdateType) switch (SelectedUpdateType)

View File

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