CP-17690: Block RPU for clusters with the hci-forbid-rpu flag (disable the relevant pools/hosts on the select pool page; do not launch the RPU wizard at all if there are no upgradable clusters).

This commit is contained in:
Konstantina Chremmou 2016-06-20 13:11:21 +01:00
parent b5199573bc
commit b575fd3d44
3 changed files with 23 additions and 8 deletions

View File

@ -64,10 +64,14 @@ namespace XenAdmin.Commands
{
foreach (IXenConnection xenConnection in ConnectionsManager.XenConnectionsCopy)
{
if (xenConnection.IsConnected)
{
return true;
}
if (!xenConnection.IsConnected)
continue;
var pool = Helpers.GetPoolOfOne(xenConnection);
if (pool != null && pool.IsUpgradeForbidden)
continue;
return true;
}
return false;
}

View File

@ -189,17 +189,18 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard
dataGridView1.Rows.Clear();
List<IXenConnection> xenConnections = ConnectionsManager.XenConnectionsCopy;
xenConnections.Sort();
var currentVersion = Program.VersionThreePart;
foreach (IXenConnection xenConnection in xenConnections)
{
Pool pool = Helpers.GetPool(xenConnection);
Pool poolOfOne = Helpers.GetPoolOfOne(xenConnection);
bool hasPool = true;
if (pool != null)
{
int index = dataGridView1.Rows.Add(new UpgradeDataGridViewRow(pool));
if (IsNotAnUpgradeableVersion(pool.SmallerVersionHost) && !pool.RollingUpgrade)
if ((IsNotAnUpgradeableVersion(pool.SmallerVersionHost) && !pool.RollingUpgrade) || pool.IsUpgradeForbidden)
((DataGridViewExRow)dataGridView1.Rows[index]).Enabled = false;
else if (masters.Contains(pool.Connection.Resolve(pool.master)))
dataGridView1.CheckBoxChange(index, 1);
@ -208,12 +209,13 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard
{
hasPool = false;
}
Host[] hosts = xenConnection.Cache.Hosts;
Array.Sort(hosts);
foreach (Host host in hosts)
{
int index = dataGridView1.Rows.Add(new UpgradeDataGridViewRow(host, hasPool));
if (IsNotAnUpgradeableVersion(host))
if (IsNotAnUpgradeableVersion(host) || (poolOfOne != null && poolOfOne.IsUpgradeForbidden))
((DataGridViewExRow)dataGridView1.Rows[index]).Enabled = false;
else if (!hasPool && masters.Contains(host))
dataGridView1.CheckBoxChange(index, 1);

View File

@ -140,7 +140,8 @@ namespace XenAPI
}
}
private const String ROLLING_UPGRADE_IN_PROGRESS = "rolling_upgrade_in_progress";
private const string ROLLING_UPGRADE_IN_PROGRESS = "rolling_upgrade_in_progress";
private const string FORBID_RPU_FOR_HCI = "hci-forbid-rpu";
public bool RollingUpgrade
{
@ -150,6 +151,14 @@ namespace XenAPI
}
}
public bool IsUpgradeForbidden
{
get
{
return other_config != null && other_config.ContainsKey(FORBID_RPU_FOR_HCI);
}
}
public static Dictionary<string, string> retrieve_wlb_default_configuration(Session session)
{
return Maps.convert_from_proxy_string_string(session.proxy.pool_retrieve_wlb_configuration("default").parse());