mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
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:
commit
51c08c7433
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -33,6 +33,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using XenAdmin.Core;
|
||||
using XenAPI;
|
||||
|
||||
|
||||
@ -107,18 +108,21 @@ namespace XenAdmin.Actions
|
||||
|
||||
// get required disk space
|
||||
long requiredDiskSpace = updateSize;
|
||||
try
|
||||
if (!Helpers.ElyOrGreater(Host)) // for ElyOrGreater we don't need to call get_required_space, because it will always return updateSize
|
||||
{
|
||||
var args = new Dictionary<string, string>();
|
||||
args.Add("size", updateSize.ToString());
|
||||
try
|
||||
{
|
||||
var args = new Dictionary<string, string>();
|
||||
args.Add("size", updateSize.ToString());
|
||||
|
||||
result = Host.call_plugin(Session, Host.opaque_ref, "disk-space", "get_required_space", args);
|
||||
requiredDiskSpace = Convert.ToInt64(result);
|
||||
}
|
||||
catch (Failure failure)
|
||||
{
|
||||
log.WarnFormat("Plugin call disk-space.get_required_space on {0} failed with {1}", Host.Name, failure.Message);
|
||||
requiredDiskSpace = 0;
|
||||
result = Host.call_plugin(Session, Host.opaque_ref, "disk-space", "get_required_space", args);
|
||||
requiredDiskSpace = Convert.ToInt64(result);
|
||||
}
|
||||
catch (Failure failure)
|
||||
{
|
||||
log.WarnFormat("Plugin call disk-space.get_required_space on {0} failed with {1}", Host.Name, failure.Message);
|
||||
requiredDiskSpace = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// get available disk space
|
||||
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user