Merge pull request #478 from MihaelaStoica/CP-12282

CP-12282: Semantics of Move / Migrate / Copy for suspended VMs
This commit is contained in:
Gabor Apati-Nagy 2015-05-27 14:38:36 +01:00
commit 0809dd2f56
4 changed files with 26 additions and 3 deletions

View File

@ -60,7 +60,7 @@ namespace XenAdmin.Commands
else
{
MainWindowCommandInterface.ShowPerConnectionWizard(con,
new CrossPoolMigrateWizard(con, selection, preSelectedHost, WizardMode.Move));
new CrossPoolMigrateWizard(con, selection, preSelectedHost, GetWizardMode(selection)));
}
}
@ -77,5 +77,13 @@ namespace XenAdmin.Commands
return CrossPoolMigrateCommand.CanExecute(vm, preSelectedHost);
}
public static WizardMode GetWizardMode(SelectedItemCollection selection)
{
return selection != null && selection.Count > 0 && selection[0].XenObject is VM
&& (selection[0].XenObject as VM).power_state == vm_power_state.Suspended
? WizardMode.Migrate
: WizardMode.Move;
}
}
}

View File

@ -32,6 +32,7 @@
using System.Linq;
using System.Collections.Generic;
using System.Text;
using XenAdmin.Wizards.CrossPoolMigrateWizard;
using XenAPI;
using XenAdmin.Dialogs;
using System.Collections.ObjectModel;
@ -41,7 +42,7 @@ using XenAdmin.Dialogs.VMDialogs;
namespace XenAdmin.Commands
{
/// <summary>
/// Launches the Copy-VM dialog for the selected VM.
/// Launches the Move-VM dialog for the selected VM.
/// </summary>
internal class MoveVMCommand : Command
{
@ -87,7 +88,9 @@ namespace XenAdmin.Commands
{
get
{
return Messages.MAINWINDOW_MOVEVM;
return CrossPoolMoveVMCommand.GetWizardMode(GetSelection()) == WizardMode.Migrate
? Messages.MAINWINDOW_MIGRATEVM
: Messages.MAINWINDOW_MOVEVM;
}
}
}

View File

@ -19889,6 +19889,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to &amp;Migrate VM....
/// </summary>
public static string MAINWINDOW_MIGRATEVM {
get {
return ResourceManager.GetString("MAINWINDOW_MIGRATEVM", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &amp;Move VM....
/// </summary>

View File

@ -6915,6 +6915,9 @@ This will permanently delete and reinitialize all local storage on the servers.
<data name="MAINWINDOW_LOG_REMOVECONNECTION" xml:space="preserve">
<value>Removed connection to {0}</value>
</data>
<data name="MAINWINDOW_MIGRATEVM" xml:space="preserve">
<value>&amp;Migrate VM...</value>
</data>
<data name="MAINWINDOW_MIGRATE_TO_SERVER" xml:space="preserve">
<value>M&amp;igrate to Server</value>
</data>