Merge pull request #70 from stephen-turner/CA-135078

Ca 135078
This commit is contained in:
Mihaela Stoica 2014-05-16 10:49:59 +01:00
commit 273383c567
5 changed files with 14 additions and 60 deletions

View File

@ -730,7 +730,6 @@ namespace XenAdmin.Commands
items.Add(new DisconnectPoolCommand(mainWindow, selection));
items.Add(new PoolReconnectAsCommand(mainWindow, selection));
items.AddSeparator();
items.Add(new DeletePoolCommand(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.pool, selection);
items.AddSeparator();
items.Add(new PoolPropertiesCommand(mainWindow, selection));

View File

@ -74,12 +74,9 @@ namespace XenAdmin.Commands
return;
}
if (ShowConfirmationDialog())
if (conn.IsConnected)
{
if (conn.IsConnected)
{
new DestroyPoolAction(pool).RunAsync();
}
new DestroyPoolAction(pool).RunAsync();
}
}
@ -103,23 +100,5 @@ namespace XenAdmin.Commands
return Messages.MAINWINDOW_DELETE_POOL;
}
}
protected override string ConfirmationDialogText
{
get
{
SelectedItemCollection selection = GetSelection();
Pool pool = (Pool)selection[0].PoolAncestor;
return string.Format(Messages.MESSAGEBOX_POOL_DELETE, pool.Name);
}
}
public override string ContextMenuText
{
get
{
return Messages.MAINWINDOW_DELETE_POOL_CONTEXT_MENU;
}
}
}
}

View File

@ -29,6 +29,8 @@
* SUCH DAMAGE.
*/
using System;
namespace XenAdmin.Actions
{
public class DestroyPoolAction: PureAsyncAction
@ -36,7 +38,6 @@ namespace XenAdmin.Actions
public DestroyPoolAction(XenAPI.Pool pool)
: base(pool.Connection, string.Format(Messages.DESTROYING_POOL, pool.Name))
{
System.Diagnostics.Trace.Assert(pool != null);
Pool = pool;
this.Description = Messages.WAITING;
@ -46,21 +47,8 @@ namespace XenAdmin.Actions
{
this.Description = Messages.POOLCREATE_DESTROYING;
int n = Connection.Cache.HostCount;
string master = Pool.master;
double p = 100.0 / n; // We have n - 1 to eject, and then 1 to rename.
int i = 0;
foreach (XenAPI.Host host in Connection.Cache.Hosts)
{
if (host.opaque_ref != master)
{
int lo = (int)(i * p);
int hi = (int)((i + 1) * p);
RelatedTask = XenAPI.Pool.async_eject(Session, host.opaque_ref);
PollToCompletion(lo, hi);
i++;
}
}
if (Connection.Cache.HostCount != 1)
throw new Exception("Cannot destroy a pool of more than one host"); // We should not have any UI to reach here, and must not be allowed to proceed
XenAPI.Pool.set_name_label(Session, Pool.opaque_ref, "");
XenAPI.Pool.set_name_description(Session, Pool.opaque_ref, "");
this.Description = Messages.POOLCREATE_DESTROYED;

View File

@ -9425,7 +9425,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to Destroying pool &apos;{0}&apos;.
/// Looks up a localized string similar to Making pool &apos;{0}&apos; into standalone server.
/// </summary>
public static string DESTROYING_POOL {
get {
@ -18361,7 +18361,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to &amp;Delete Pool....
/// Looks up a localized string similar to Mak&amp;e into standalone server.
/// </summary>
public static string MAINWINDOW_DELETE_POOL {
get {
@ -18369,15 +18369,6 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Delete &amp;Pool....
/// </summary>
public static string MAINWINDOW_DELETE_POOL_CONTEXT_MENU {
get {
return ResourceManager.GetString("MAINWINDOW_DELETE_POOL_CONTEXT_MENU", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &amp;Delete Tag....
/// </summary>
@ -24805,7 +24796,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to Destroyed pool.
/// Looks up a localized string similar to Made pool into standalone server.
/// </summary>
public static string POOLCREATE_DESTROYED {
get {
@ -24814,7 +24805,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to Destroying pool.
/// Looks up a localized string similar to Making pool into standalone server.
/// </summary>
public static string POOLCREATE_DESTROYING {
get {

View File

@ -3349,7 +3349,7 @@ This will also delete its subfolders.</value>
<value>Destroying servers</value>
</data>
<data name="DESTROYING_POOL" xml:space="preserve">
<value>Destroying pool '{0}'</value>
<value>Making pool '{0}' into standalone server</value>
</data>
<data name="DESTROY_HOST_ACTION_COMPLETED_DESC" xml:space="preserve">
<value>Host destroyed</value>
@ -6404,10 +6404,7 @@ This will permanently delete and reinitialize all local storage on the servers.
<value>De&amp;lete...</value>
</data>
<data name="MAINWINDOW_DELETE_POOL" xml:space="preserve">
<value>&amp;Delete Pool...</value>
</data>
<data name="MAINWINDOW_DELETE_POOL_CONTEXT_MENU" xml:space="preserve">
<value>Delete &amp;Pool...</value>
<value>Mak&amp;e into standalone server</value>
</data>
<data name="MAINWINDOW_DELETE_TAG" xml:space="preserve">
<value>&amp;Delete Tag...</value>
@ -8567,10 +8564,10 @@ The VM protection policy for this VM does not have automatic archiving configure
<value>Creating pool</value>
</data>
<data name="POOLCREATE_DESTROYED" xml:space="preserve">
<value>Destroyed pool</value>
<value>Made pool into standalone server</value>
</data>
<data name="POOLCREATE_DESTROYING" xml:space="preserve">
<value>Destroying pool</value>
<value>Making pool into standalone server</value>
</data>
<data name="POOLCREATE_REMOVED" xml:space="preserve">
<value>Removed from pool</value>