Merge pull request #1780 from jijiang/CP-24704

CP-24704: Add pool size license check
This commit is contained in:
Mihaela Stoica 2017-09-25 12:18:14 +01:00 committed by GitHub
commit f32e0a710b
4 changed files with 28 additions and 0 deletions

View File

@ -23564,6 +23564,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to The pool has already reached the maximum number of servers allowed by your license.
/// </summary>
public static string NEWPOOL_MAX_NUMBER_HOST_REACHED {
get {
return ResourceManager.GetString("NEWPOOL_MAX_NUMBER_HOST_REACHED", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Pooling is restricted with this server&apos;s license.
/// </summary>

View File

@ -8047,6 +8047,9 @@ You should only proceed if you have verified that these settings are correct.</v
<data name="NEWPOOL_MASTER_ROLE" xml:space="preserve">
<value>Your current role on the master is not authorized to add hosts to the master's pool</value>
</data>
<data name="NEWPOOL_MAX_NUMBER_HOST_REACHED" xml:space="preserve">
<value>The pool has already reached the maximum number of servers allowed by your license</value>
</data>
<data name="NEWPOOL_POOLINGRESTRICTED" xml:space="preserve">
<value>Pooling is restricted with this server's license</value>
</data>

View File

@ -59,6 +59,7 @@ namespace XenAdmin.Core
LicensedHostUnlicensedMaster,
UnlicensedHostLicensedMaster,
LicenseMismatch,
MasterPoolMaxNumberHostReached,
DifferentServerVersion,
DifferentHomogeneousUpdatesFromMaster,
DifferentHomogeneousUpdatesFromPool,
@ -130,6 +131,9 @@ namespace XenAdmin.Core
if (LicenseMismatch(slaveHost, masterHost))
return Reason.LicenseMismatch;
if (MasterPoolMaxNumberHostReached(masterConnection))
return Reason.MasterPoolMaxNumberHostReached;
if (!SameLinuxPack(slaveHost, masterHost))
return Reason.NotSameLinuxPack;
@ -193,6 +197,8 @@ namespace XenAdmin.Core
return Messages.NEWPOOL_UNLICENSED_HOST_LICENSED_MASTER;
case Reason.LicenseMismatch:
return Messages.NEWPOOL_LICENSEMISMATCH;
case Reason.MasterPoolMaxNumberHostReached:
return Messages.NEWPOOL_MAX_NUMBER_HOST_REACHED;
case Reason.DifferentServerVersion:
return Messages.NEWPOOL_DIFF_SERVER;
case Reason.DifferentHomogeneousUpdatesFromMaster:
@ -461,6 +467,11 @@ namespace XenAdmin.Core
return slaveEdition != Host.Edition.Free && masterEdition != Host.Edition.Free && slaveEdition != masterEdition;
}
private static bool MasterPoolMaxNumberHostReached(IXenConnection connection)
{
return Helpers.FeatureForbidden(connection, Host.RestrictPoolSize) && connection.Cache.HostCount > 2;
}
private static bool HaEnabled(IXenConnection connection)
{
Pool pool = Helpers.GetPoolOfOne(connection);

View File

@ -355,6 +355,11 @@ namespace XenAPI
return BoolKey(h.license_params, "restrict_vss");
}
public static bool RestrictPoolSize(Host h)
{
return BoolKey(h.license_params, "restrict_pool_size");
}
public static bool RestrictPvsCache(Host h)
{
return BoolKeyPreferTrue(h.license_params, "restrict_pvs_proxy");