Merge pull request #516 from MihaelaStoica/CP-12154

CP-12154: Check whether the Health Check feature is available before…
This commit is contained in:
Gabor Apati-Nagy 2015-06-26 11:38:30 +01:00
commit 2210d480ae
4 changed files with 18 additions and 4 deletions

View File

@ -1,6 +1,6 @@
using System.Linq;
using XenAdmin.Dialogs;
using XenAdmin.Dialogs.CallHome;
using XenAdmin.Core;
using XenAPI;
namespace XenAdmin.Commands
{
@ -27,7 +27,8 @@ namespace XenAdmin.Commands
protected override bool CanExecuteCore(SelectedItemCollection selection)
{
return ConnectionsManager.XenConnectionsCopy.Any(xenConnection => xenConnection.IsConnected);
return ConnectionsManager.XenConnectionsCopy.Any(xenConnection => xenConnection.IsConnected
&& !Helpers.FeatureForbidden(xenConnection, Host.RestrictHealthCheck));
}
}
}

View File

@ -111,7 +111,7 @@ namespace XenAdmin.Dialogs.CallHome
var list = new List<DataGridViewRow>();
foreach (IXenConnection xenConnection in ConnectionsManager.XenConnectionsCopy)
{
if (!xenConnection.IsConnected)
if (!xenConnection.IsConnected || Helpers.FeatureForbidden(xenConnection, Host.RestrictHealthCheck))
continue;
var pool = Helpers.GetPoolOfOne(xenConnection);
if (pool != null)

View File

@ -162,6 +162,9 @@ namespace XenAdmin.Dialogs
/// <param name="connection">The connection to check enrollment on</param>
internal bool CheckHealthCheckEnrollment(IXenConnection connection)
{
if (Helpers.FeatureForbidden(connection, Host.RestrictHealthCheck))
return false;
Pool pool = Helpers.GetPoolOfOne(connection);
if (pool == null)
return false;

View File

@ -474,6 +474,16 @@ namespace XenAPI
return h._RestrictReadCaching;
}
private bool _RestrictHealthCheck
{
get { return BoolKeyPreferTrue(license_params, "restrict_health_check"); }
}
public static bool RestrictHealthCheck(Host h)
{
return h._RestrictHealthCheck;
}
public bool HasPBDTo(SR sr)
{
foreach (XenRef<PBD> pbd in PBDs)