Merge pull request #2066 from kc284/release/kolkata/master2

Disable creation of SR-IOV network if the feature is disabled.
This commit is contained in:
Mihaela Stoica 2018-05-09 13:01:19 +01:00 committed by GitHub
commit fcfc4cacf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 8 deletions

View File

@ -104,21 +104,25 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages
bool hasNicCanEnableSriov = pool.Connection.Cache.PIFs.Any(pif => pif.IsPhysical() && pif.SriovCapable() && !pif.IsSriovPhysicalPIF());
bool sriovFeatureForbidden = Helpers.FeatureForbidden(connection, Host.RestrictSriovNetwork);
if( !Helpers.KolkataOrGreater(pool.Connection))
if (!Helpers.KolkataOrGreater(pool.Connection))
{
iconWarningSriovOption.Visible = labelWarningSriovOption.Visible = false;
rbtnSriov.Visible = labelSriov.Visible = false;
}
else if (sriovFeatureForbidden || !pool.HasSriovNic() || !hasNicCanEnableSriov)
else if (Helpers.FeatureForbidden(pool.Connection, Host.SriovNetworkDisabled) ||
sriovFeatureForbidden || !pool.HasSriovNic() || !hasNicCanEnableSriov)
{
rbtnSriov.Checked = false;
rbtnSriov.Enabled = labelSriov.Enabled = false;
labelWarningSriovOption.Text = sriovFeatureForbidden ?
String.Format(Messages.FEATURE_DISABLED, Messages.NETWORK_SRIOV) :
pool.HasSriovNic() ?
Messages.NICS_ARE_SRIOV_ENABLED :
Messages.SRIOV_NEED_NICSUPPORT;
labelWarningSriovOption.Text =
Helpers.FeatureForbidden(pool.Connection, Host.SriovNetworkDisabled)
? String.Format(Messages.FEATURE_EXPERIMENTAL, Messages.NETWORK_SRIOV)
: sriovFeatureForbidden
? String.Format(Messages.FEATURE_DISABLED, Messages.NETWORK_SRIOV)
: pool.HasSriovNic()
? Messages.NICS_ARE_SRIOV_ENABLED
: Messages.SRIOV_NEED_NICSUPPORT;
iconWarningSriovOption.Visible = labelWarningSriovOption.Visible = true;
}

View File

@ -15288,6 +15288,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Feature &apos;{0}&apos; must be enabled on all hosts in the pool before use. See release notes..
/// </summary>
public static string FEATURE_EXPERIMENTAL {
get {
return ResourceManager.GetString("FEATURE_EXPERIMENTAL", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &amp;Next Section.
/// </summary>

View File

@ -5369,6 +5369,9 @@ Warning: to prevent data loss you must ensure that the LUN is not in use by any
<data name="FEATURE_DISABLED_IN_REGISTER" xml:space="preserve">
<value>Feature disabled in the registry</value>
</data>
<data name="FEATURE_EXPERIMENTAL" xml:space="preserve">
<value>Feature '{0}' must be enabled on all hosts in the pool before use. See release notes.</value>
</data>
<data name="FETCHED_POSSIBLE_HOSTS" xml:space="preserve">
<value>Fetched possible hosts of VM {0}</value>
</data>

View File

@ -456,11 +456,18 @@ namespace XenAPI
return BoolKeyPreferTrue(h.license_params, "restrict_corosync");
}
#region Experimental Features
public static bool CorosyncDisabled(Host h)
{
return RestrictCorosync(h) && FeatureDisabled(h, "corosync");
}
public static bool SriovNetworkDisabled(Host h)
{
return RestrictSriovNetwork(h) && FeatureDisabled(h, "network_sriov");
}
public static bool FeatureDisabled(Host h, string featureName)
{
foreach (var feature in h.Connection.ResolveAll(h.features))
@ -471,6 +478,8 @@ namespace XenAPI
return false;
}
#endregion
public bool HasPBDTo(SR sr)
{
foreach (XenRef<PBD> pbd in PBDs)