CP-24704: Add pool size license check

Signed-off-by: Ji Jiang <ji.jiang@citrix.com>
This commit is contained in:
Ji Jiang 2017-09-22 16:57:09 +01:00
parent 9fec33d892
commit 0018981782
4 changed files with 66 additions and 43 deletions

View File

@ -563,18 +563,16 @@ namespace XenAdmin {
return ResourceManager.GetString("ACTION_DETACHING_MULTIPLE_VDIS_TITLE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Disable IGMP snooping.
/// </summary>
public static string ACTION_DISABLE_IGMP_SNOOPING
{
get
{
public static string ACTION_DISABLE_IGMP_SNOOPING {
get {
return ResourceManager.GetString("ACTION_DISABLE_IGMP_SNOOPING", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Disable live patching.
/// </summary>
@ -934,18 +932,16 @@ namespace XenAdmin {
return ResourceManager.GetString("ACTION_DR_TASK_DESTROY_TITLE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Enable IGMP Snooping.
/// Looks up a localized string similar to Enable IGMP snooping.
/// </summary>
public static string ACTION_ENABLE_IGMP_SNOOPING
{
get
{
public static string ACTION_ENABLE_IGMP_SNOOPING {
get {
return ResourceManager.GetString("ACTION_ENABLE_IGMP_SNOOPING", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Enable live patching.
/// </summary>
@ -22675,6 +22671,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Network Options.
/// </summary>
public static string NETWORK_OPTIONS {
get {
return ResourceManager.GetString("NETWORK_OPTIONS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The connection to the server was lost. No changes have been made..
/// </summary>
@ -22692,35 +22697,7 @@ namespace XenAdmin {
return ResourceManager.GetString("NETWORK_SETTINGS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Network Options.
/// </summary>
public static string NETWORK_OPTIONS {
get
{
return ResourceManager.GetString("NETWORK_OPTIONS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to IGMP snooping enabled.
/// </summary>
public static string NETWORKOPTIONSEDITPAGE_SUBTEXT_IGMP_SNOOPING_ENABLED {
get {
return ResourceManager.GetString("NETWORKOPTIONSEDITPAGE_SUBTEXT_IGMP_SNOOPING_ENABLED", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to IGMP snooping disabled.
/// </summary>
public static string NETWORKOPTIONSEDITPAGE_SUBTEXT_IGMP_SNOOPING_DISABLED {
get {
return ResourceManager.GetString("NETWORKOPTIONSEDITPAGE_SUBTEXT_IGMP_SNOOPING_DISABLED", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} on {1}.
/// </summary>
@ -22871,6 +22848,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to IGMP snooping disabled.
/// </summary>
public static string NETWORKOPTIONSEDITPAGE_SUBTEXT_IGMP_SNOOPING_DISABLED {
get {
return ResourceManager.GetString("NETWORKOPTIONSEDITPAGE_SUBTEXT_IGMP_SNOOPING_DISABLED", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to IGMP snooping enabled.
/// </summary>
public static string NETWORKOPTIONSEDITPAGE_SUBTEXT_IGMP_SNOOPING_ENABLED {
get {
return ResourceManager.GetString("NETWORKOPTIONSEDITPAGE_SUBTEXT_IGMP_SNOOPING_ENABLED", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Auto.
/// </summary>
@ -23569,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>
@ -29969,7 +29973,7 @@ namespace XenAdmin {
return ResourceManager.GetString("SECURITYEDITPAGE_SUBTEXT_TLS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Select a filter....
/// </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");