CA-286582: Hide the Provisioning method page if the feature is not present or disabled

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2018-03-23 11:56:54 +00:00 committed by Konstantina Chremmou
parent b7d3a2b3b5
commit d3fa68e210
7 changed files with 29 additions and 2 deletions

View File

@ -284,12 +284,14 @@ namespace XenAdmin.Wizards
AddPage(xenTabPageVhdoNFS);
else if (m_srWizardType is SrWizardType_Iscsi)
{
AddPage(xenTabPageChooseSrProv);
if (Helpers.KolkataOrGreater(xenConnection) && !Helpers.FeatureForbidden(xenConnection, Host.CorosyncDisabled))
AddPage(xenTabPageChooseSrProv);
AddPage(xenTabPageLvmoIscsi);
}
else if (m_srWizardType is SrWizardType_Hba)
{
AddPage(xenTabPageChooseSrProv);
if (Helpers.KolkataOrGreater(xenConnection) && !Helpers.FeatureForbidden(xenConnection, Host.CorosyncDisabled))
AddPage(xenTabPageChooseSrProv);
AddPage(xenTabPageLvmoHba);
AddPage(xenTabPageLvmoHbaSummary);
}

View File

@ -38,6 +38,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends
public LVMoFCoE()
{
InitializeComponent();
SrType = SR.SRTypes.lvmofcoe;
}
#region LVMoHBA overrides

View File

@ -54,6 +54,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends
public LVMoHBA()
{
InitializeComponent();
SrType = SR.SRTypes.lvmohba;
}
public virtual SR.SRTypes SrType { get; set; }

View File

@ -107,6 +107,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends
public LVMoISCSI()
{
InitializeComponent();
SrType = SR.SRTypes.lvmoiscsi;
}
#region XentabPage overrides

View File

@ -52,6 +52,7 @@ namespace XenAdmin.Network
private readonly ChangeableDictionary<XenRef<Cluster>, Cluster> _cluster = new ChangeableDictionary<XenRef<Cluster>, Cluster>();
private readonly ChangeableDictionary<XenRef<Cluster_host>, Cluster_host> _cluster_host = new ChangeableDictionary<XenRef<Cluster_host>, Cluster_host>();
private readonly ChangeableDictionary<XenRef<XenAPI.Console>, XenAPI.Console> _console = new ChangeableDictionary<XenRef<XenAPI.Console>, XenAPI.Console>();
private readonly ChangeableDictionary<XenRef<Feature>, Feature> _feature = new ChangeableDictionary<XenRef<Feature>, Feature>();
private readonly ChangeableDictionary<XenRef<Folder>, Folder> _folders = new ChangeableDictionary<XenRef<Folder>, Folder>();
private readonly ChangeableDictionary<XenRef<DockerContainer>, DockerContainer> _dockerContainers = new ChangeableDictionary<XenRef<DockerContainer>, DockerContainer>();
@ -141,6 +142,11 @@ namespace XenAdmin.Network
get { return contents(_cluster_host); }
}
public Feature[] Features
{
get { return contents(_feature); }
}
public Folder[] Folders
{
get { return contents(_folders); }

View File

@ -91,5 +91,6 @@ namespace XenAdmin.Network
void CheckDockerContainersBatchChange();
Cluster[] Clusters { get; }
Cluster_host[] Cluster_hosts { get; }
Feature[] Features { get; }
}
}

View File

@ -439,6 +439,21 @@ namespace XenAPI
{
return BoolKeyPreferTrue(h.license_params, "restrict_corosync");
}
public static bool CorosyncDisabled(Host h)
{
return RestrictCorosync(h) && FeatureDisabled(h, "corosync");
}
public static bool FeatureDisabled(Host h, string featureName)
{
foreach (var feature in h.Connection.ResolveAll(h.features))
{
if (feature.name_label.Equals(featureName, StringComparison.OrdinalIgnoreCase))
return !feature.enabled;
}
return false;
}
public bool HasPBDTo(SR sr)
{