Skip to content

Commit

Permalink
CP-14647: Intermediate check-in #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Turner committed Oct 26, 2015
1 parent 20076d6 commit 05d4b8e
Show file tree
Hide file tree
Showing 118 changed files with 542 additions and 2,005 deletions.
2 changes: 1 addition & 1 deletion XenAdmin/Actions/GUIActions/ExternalPluginAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private void CheckPermission(IXenConnection xenConnection)
{
ShellCmd cmd = _menuItemFeature.ShellCmd;
RbacMethodList methodsToCheck = cmd.RequiredMethods.Count == 0 ? _menuItemFeature.GetMethodList(cmd.RequiredMethodList) : cmd.RequiredMethods;
if (methodsToCheck == null || xenConnection.Session == null || xenConnection.Session.IsLocalSuperuser || !Helpers.MidnightRideOrGreater(xenConnection))
if (methodsToCheck == null || xenConnection.Session == null || xenConnection.Session.IsLocalSuperuser)
{
return;
}
Expand Down
7 changes: 0 additions & 7 deletions XenAdmin/Actions/GUIActions/Wlb/WlbOptimizePoolAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public WlbOptimizePoolAction(Pool pool, Dictionary<VM, WlbOptimizationRecommenda
ApiMethodsToRoleCheck.Add("pool.sync_database");
ApiMethodsToRoleCheck.Add("pool.set_ha_host_failures_to_tolerate");
ApiMethodsToRoleCheck.Add("vm.set_ha_restart_priority");
ApiMethodsToRoleCheck.Add("vm.set_ha_always_run");

ApiMethodsToRoleCheck.Add("vm.assert_can_boot_here");
ApiMethodsToRoleCheck.Add("vm.assert_agile");
Expand Down Expand Up @@ -405,12 +404,6 @@ private static void DoAction(AsyncAction action, VM vm, Host host, int start, in
/// <param name="end">progress bar end point</param>
private static void SetHaProtection(bool protect, AsyncAction action, VM vm, int start, int end)
{
if (!Helpers.BostonOrGreater(vm.Connection))
{
// Enable or disable HA protection for the VM.
XenAPI.VM.set_ha_always_run(action.Session, vm.opaque_ref, protect);
}

// Do database sync. Helps to ensure that the change persists over master failover.
action.RelatedTask = XenAPI.Pool.async_sync_database(action.Session);
action.PollToCompletion(start, end);
Expand Down
2 changes: 1 addition & 1 deletion XenAdmin/Actions/SetCslgCredentialsAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public SetCslgCredentialsAction(IEnumerable<IXenConnection> connections, string
{
Util.ThrowIfEnumerableParameterNullOrEmpty(connections, "connections");

_connections = Util.GetList(connections).FindAll(c => c.IsConnected && Helpers.GetPoolOfOne(c) != null && Helpers.MidnightRideOrGreater(c) && !Helpers.FeatureForbidden(c, XenAPI.Host.RestrictStorageChoices));
_connections = Util.GetList(connections).FindAll(c => c.IsConnected && Helpers.GetPoolOfOne(c) != null && !Helpers.FeatureForbidden(c, XenAPI.Host.RestrictStorageChoices));
_host = host;
_username = username;
_password = password;
Expand Down
5 changes: 0 additions & 5 deletions XenAdmin/Actions/SetCslgCredentialsToPoolAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ public SetCslgCredentialsToPoolAction(IXenConnection connection, string host, st
throw new ArgumentException("Pool not licensed.", "host");
}

if (!Helpers.MidnightRideOrGreater(connection))
{
throw new ArgumentException("Pool must by Midnight Ride or later.", "host");
}

XenAPI.Pool pool = Helpers.GetPool(Connection);

if (pool != null)
Expand Down
2 changes: 1 addition & 1 deletion XenAdmin/Commands/DRConfigureCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private static void ShowUpsellDialog(IWin32Window parent)

protected override bool CanExecuteCore(SelectedItemCollection selection)
{
return selection.FirstAsXenObject != null && selection.FirstAsXenObject.Connection != null && selection.FirstAsXenObject.Connection.IsConnected && Helpers.BostonOrGreater(selection.FirstAsXenObject.Connection)
return selection.FirstAsXenObject != null && selection.FirstAsXenObject.Connection != null && selection.FirstAsXenObject.Connection.IsConnected
&& (selection.PoolAncestor != null || selection.HostAncestor != null); //CA-61207: this check ensures there's no cross-pool selection
}

Expand Down
2 changes: 1 addition & 1 deletion XenAdmin/Commands/DRDryrunCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static void ShowUpsellDialog(IWin32Window parent)

protected override bool CanExecuteCore(SelectedItemCollection selection)
{
return selection.Count == 1 && selection.FirstAsXenObject != null && selection.FirstAsXenObject.Connection != null && Helpers.BostonOrGreater(selection.FirstAsXenObject.Connection);
return selection.Count == 1 && selection.FirstAsXenObject != null && selection.FirstAsXenObject.Connection != null;
}

public override string ContextMenuText
Expand Down
2 changes: 1 addition & 1 deletion XenAdmin/Commands/DRFailbackCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static void ShowUpsellDialog(IWin32Window parent)

protected override bool CanExecuteCore(SelectedItemCollection selection)
{
return selection.Count == 1 && selection.FirstAsXenObject != null && selection.FirstAsXenObject.Connection != null && Helpers.BostonOrGreater(selection.FirstAsXenObject.Connection);
return selection.Count == 1 && selection.FirstAsXenObject != null && selection.FirstAsXenObject.Connection != null;
}

public override string ContextMenuText
Expand Down
2 changes: 1 addition & 1 deletion XenAdmin/Commands/DRFailoverCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static void ShowUpsellDialog(IWin32Window parent)

protected override bool CanExecuteCore(SelectedItemCollection selection)
{
return selection.Count==1&&selection.FirstAsXenObject != null && selection.FirstAsXenObject.Connection != null && Helpers.BostonOrGreater(selection.FirstAsXenObject.Connection);
return selection.Count==1 && selection.FirstAsXenObject != null && selection.FirstAsXenObject.Connection != null;
}

public override string ContextMenuText
Expand Down
17 changes: 2 additions & 15 deletions XenAdmin/Commands/DestroyBondCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,7 @@ protected sealed override void ExecuteCore(SelectedItemCollection selection)
// We just want one, so that we can name it.
PIF pif = pifs[0];

string new_name;
string msg;
if (network != null && !Helpers.BostonOrGreater(network.Connection) && network.Connection.ResolveAll(network.VIFs).Count > 0)
{
// We have a live pre-Boston network. Tell the user that we're going to rename it.
new_name = Helpers.MakeUniqueName(Messages.RENAMED_BOND, GetAllNetworkNames(network.Connection));
msg = string.Format(Messages.DELETE_BOND_WITH_VIFS_MESSAGE, pif.Name, new_name);
}
else
{
// It's not in use -- delete the network as well as the bonds and PIFs.
new_name = null;
msg = string.Format(Messages.DELETE_BOND_MESSAGE, pif.Name);
}
string msg = string.Format(Messages.DELETE_BOND_MESSAGE, pif.Name);

bool will_disturb_primary = NetworkingHelper.ContainsPrimaryManagement(pifs);
bool will_disturb_secondary = NetworkingHelper.ContainsSecondaryManagement(pifs);
Expand Down Expand Up @@ -147,7 +134,7 @@ protected sealed override void ExecuteCore(SelectedItemCollection selection)
// done the right thing and that the bond hasn't been deleted in the meantime. (CA-27436).
Bond bond = pif.BondMasterOf;
if (bond != null)
new Actions.DestroyBondAction(bond, new_name).RunAsync();
new Actions.DestroyBondAction(bond, null).RunAsync();
}
}
}
11 changes: 1 addition & 10 deletions XenAdmin/Commands/DisasterRecoveryCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static void ShowUpsellDialog(IWin32Window parent)

protected override bool CanExecuteCore(SelectedItemCollection selection)
{
return selection.FirstAsXenObject != null && selection.FirstAsXenObject.Connection != null && selection.FirstAsXenObject.Connection.IsConnected && Helpers.BostonOrGreater(selection.FirstAsXenObject.Connection)
return selection.FirstAsXenObject != null && selection.FirstAsXenObject.Connection != null && selection.FirstAsXenObject.Connection.IsConnected
&& (selection.PoolAncestor != null || selection.HostAncestor != null); //CA-61207: this check ensures there's no cross-pool selection
}

Expand Down Expand Up @@ -137,14 +137,5 @@ public override string ContextMenuText
return Messages.DISASTER_RECOVERY_CONTEXT_MENU;
}
}

protected override string GetCantExecuteReasonCore(SelectedItem item)
{
if (!Helpers.BostonOrGreater(item.XenObject.Connection))
return Messages.ONLY_IN_BOSTON_OR_LATER;


return base.GetCantExecuteReasonCore(item);
}
}
}
9 changes: 0 additions & 9 deletions XenAdmin/Commands/DisconnectWlbServerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,5 @@ protected override bool CanExecuteCore(SelectedItemCollection selection)
}
return false;
}

protected override string GetCantExecuteReasonCore(SelectedItem item)
{
IXenConnection connection = item.Connection;
Host best_host = item.HostAncestor ?? (connection == null ? null : Helpers.GetMaster(connection));
bool george_or_greater = best_host != null && Helpers.GeorgeOrGreater(best_host);

return george_or_greater ? base.GetCantExecuteReasonCore(item) : string.Format(Messages.FEATURE_NOT_AVAILABLE_NEED_GEORGE, Messages.WLB);
}
}
}
6 changes: 3 additions & 3 deletions XenAdmin/Commands/HACommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void Execute(IXenConnection connection)
if (pool == null)
return;

if (Helpers.FeatureForbidden(pool, Host.RestrictHAFloodgate))
if (Helpers.FeatureForbidden(pool, Host.RestrictHA))
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(Messages.UPSELL_BLURB_HA, InvisibleMessages.UPSELL_LEARNMOREURL_HA);
Expand Down Expand Up @@ -113,7 +113,7 @@ protected override bool CanExecuteCore(SelectedItemCollection selection)
{
Host master = Helpers.GetMaster(poolAncestor.Connection);

if (master == null || master.RestrictHAOrlando || HelpersGUI.FindActiveHaAction(poolAncestor.Connection) != null || poolAncestor.Locked)
if (master == null || HelpersGUI.FindActiveHaAction(poolAncestor.Connection) != null || poolAncestor.Locked)
{
return false;
}
Expand All @@ -135,7 +135,7 @@ protected override string GetCantExecuteReasonCore(SelectedItem item)
{
Host master = Helpers.GetMaster(poolAncestor.Connection);

if (master == null || master.RestrictHAOrlando)
if (master == null)
{
return Messages.FIELD_DISABLED;
}
Expand Down
2 changes: 0 additions & 2 deletions XenAdmin/Commands/HostReconnectAsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ protected override bool CanExecuteCore(SelectedItemCollection selection)
if (selection.Count == 1)
{
IXenConnection connection = selection[0].Connection;
if (!XenAdmin.Core.Helpers.GeorgeOrGreater(connection))
return false;
bool connected = connection != null && connection.IsConnected;
Host host = selection[0].XenObject as Host;
bool is_host = (host != null);
Expand Down
2 changes: 0 additions & 2 deletions XenAdmin/Commands/InstallToolsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,6 @@ private static bool CanViewVMConsole(XenAdmin.Network.IXenConnection xenConnecti
if (xenConnection.Session == null)
return false;

if (!Helpers.MidnightRideOrGreater(xenConnection))
return true;
RbacMethodList r = new RbacMethodList("http/connect_console");
if (Role.CanPerform(r, xenConnection, false))
return true;
Expand Down
2 changes: 0 additions & 2 deletions XenAdmin/Commands/PoolReconnectAsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ protected override bool CanExecuteCore(SelectedItemCollection selection)
if (selection.Count == 1)
{
IXenConnection connection = selection[0].Connection;
if (!XenAdmin.Core.Helpers.GeorgeOrGreater(connection))
return false;
bool connected = connection != null && connection.IsConnected;
bool inPool = selection[0].PoolAncestor != null;

Expand Down
19 changes: 1 addition & 18 deletions XenAdmin/Commands/TakeSnapshotCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected override void ExecuteCore(SelectedItemCollection selection)

private static bool CanExecute(VM vm)
{
return vm != null && !vm.is_a_template && !vm.Locked && Helpers.GeorgeOrGreater(vm.Connection) && (vm.allowed_operations.Contains(vm_operations.snapshot) || vm.allowed_operations.Contains(vm_operations.checkpoint));
return vm != null && !vm.is_a_template && !vm.Locked && (vm.allowed_operations.Contains(vm_operations.snapshot) || vm.allowed_operations.Contains(vm_operations.checkpoint));
}

protected override bool CanExecuteCore(SelectedItemCollection selection)
Expand All @@ -153,23 +153,6 @@ protected virtual void OnCompleted(TakeSnapshotCommandCompletedEventArgs e)
}
}

protected override string GetCantExecuteReasonCore(SelectedItem item)
{
Host host = item.HostAncestor;

if (host == null && item.Connection != null)
{
host = Helpers.GetMaster(item.Connection);
}

if (host == null || !Helpers.GeorgeOrGreater(host))
{
return Messages.SNAPSHOT_REQUIRE_GEORGE;
}

return base.GetCantExecuteReasonCore(item);
}

public override string MenuText
{
get
Expand Down
13 changes: 0 additions & 13 deletions XenAdmin/Commands/VMGroupCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,6 @@ protected override bool CanExecuteCore(SelectedItemCollection selection)
&& (selection.PoolAncestor != null || selection.HostAncestor != null); //CA-61207: this check ensures there's no cross-pool selection
}

protected override string GetCantExecuteReasonCore(SelectedItem item)
{
Pool poolAncestor = item.PoolAncestor;

if (poolAncestor != null)
{
string reason = VMGroup<T>.CantExecuteReason(poolAncestor.Connection);
if (!string.IsNullOrEmpty(reason))
return reason;
}
return base.GetCantExecuteReasonCore(item);
}

public override string ContextMenuText
{
get
Expand Down
9 changes: 0 additions & 9 deletions XenAdmin/Commands/ViewWorkloadReportsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,5 @@ protected override bool CanExecuteCore(SelectedItemCollection selection)
}
return false;
}

protected override string GetCantExecuteReasonCore(SelectedItem item)
{
IXenConnection connection = item.Connection;
Host best_host = item.HostAncestor ?? (connection == null ? null : Helpers.GetMaster(connection));
bool george_or_greater = best_host != null && Helpers.GeorgeOrGreater(best_host);

return george_or_greater ? base.GetCantExecuteReasonCore(item) : string.Format(Messages.FEATURE_NOT_AVAILABLE_NEED_GEORGE, Messages.WLB);
}
}
}
3 changes: 1 addition & 2 deletions XenAdmin/Controls/AD/LoggedInLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ private void setLabelText()
labelLoggedInAs.Visible = true;

// get the logged in username from the session to update the logged in label
if (connection.Session.IsLocalSuperuser || XenAdmin.Core.Helpers.GetMaster(connection).external_auth_type != Auth.AUTH_TYPE_AD ||
!Helpers.MidnightRideOrGreater(Connection))
if (connection.Session.IsLocalSuperuser || XenAdmin.Core.Helpers.GetMaster(connection).external_auth_type != Auth.AUTH_TYPE_AD)
{
labelUsername.Text = connection.Session.UserFriendlyName;
}
Expand Down
1 change: 0 additions & 1 deletion XenAdmin/Controls/BondDetails.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions XenAdmin/Controls/BondDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,22 +215,13 @@ private void PopulateDataGridView(List<PIF> pifs)

private void ShowHideControls()
{
labelMTU.Visible = numericUpDownMTU.Visible = Helpers.CowleyOrGreater(Connection);
groupBoxBondMode.Visible = Helpers.BostonOrGreater(Connection);
radioButtonLacpSrcMac.Visible = radioButtonLacpTcpudpPorts.Visible = Helpers.SupportsLinkAggregationBond(Connection);
}

private string PIFDescription(PIF pif)
{
Bond bond = pif.BondSlaveOf;
if (bond != null)
return string.Format(Messages.ALREADY_IN_BOND, bond.Name);

XenAPI.Network network = Connection.Resolve(pif.network);
if (network != null && !Helpers.BostonOrGreater(network.Connection) && network.HasActiveVIFs) // in Boston, can make a bond even if there are active VMs (PR-1006)
return Messages.PIF_IN_USE_BY_VMS;

return "";
return bond == null ? "" : string.Format(Messages.ALREADY_IN_BOND, bond.Name);
}

internal DialogResult ShowCreationWarning()
Expand Down
Loading

0 comments on commit 05d4b8e

Please sign in to comment.