mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 06:16:37 +01:00
Merge pull request #2065 from kc284/release/kolkata/master2
Disable creation of SR-IOV network if the feature is disabled.
This commit is contained in:
commit
5b234d181d
@ -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;
|
||||
}
|
||||
|
9
XenModel/Messages.Designer.cs
generated
9
XenModel/Messages.Designer.cs
generated
@ -15288,6 +15288,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Feature '{0}' 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 &Next Section.
|
||||
/// </summary>
|
||||
|
@ -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>
|
||||
|
@ -455,12 +455,19 @@ 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)
|
||||
|
Loading…
Reference in New Issue
Block a user