From 1acc71741766f9773339ff3efab11832c9936011 Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Fri, 30 Sep 2016 12:39:26 +0100 Subject: [PATCH] CA-205791: Added detail to the action migrating a VM that's not resident on a host. Signed-off-by: Konstantina Chremmou --- XenModel/Actions/VM/VMCrossPoolMigrateAction.cs | 16 ++++------------ XenModel/Actions/VM/VMMigrateAction.cs | 14 +++++--------- XenModel/Messages.Designer.cs | 13 +++++++++++-- XenModel/Messages.resx | 5 ++++- XenModel/XenAPI-Extensions/Task.cs | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/XenModel/Actions/VM/VMCrossPoolMigrateAction.cs b/XenModel/Actions/VM/VMCrossPoolMigrateAction.cs index 022e8033b..630cb3593 100644 --- a/XenModel/Actions/VM/VMCrossPoolMigrateAction.cs +++ b/XenModel/Actions/VM/VMCrossPoolMigrateAction.cs @@ -63,11 +63,6 @@ namespace XenAdmin.Actions.VMActions this.copy = copy; } - public VMCrossPoolMigrateAction(VM vm, Host destinationHost, XenAPI.Network transferNetwork, VmMapping mapping) - : this(vm, destinationHost, transferNetwork, mapping, false) - { - } - public static RbacMethodList StaticRBACDependencies { get @@ -88,13 +83,10 @@ namespace XenAdmin.Actions.VMActions return string.Format(Messages.ACTION_VM_CROSS_POOL_COPY_TITLE, vm.Name, toHost.Name); Host residentOn = vm.Connection.Resolve(vm.resident_on); - if (residentOn == null) - { - return Messages.ACTION_VM_MIGRATING; - } - - return string.Format(Messages.ACTION_VM_MIGRATING_TITLE, vm.Name, Helpers.GetName(residentOn), toHost.Name); - + + return residentOn == null + ? string.Format(Messages.ACTION_VM_MIGRATING_NON_RESIDENT, vm.Name, toHost.Name) + : string.Format(Messages.ACTION_VM_MIGRATING_RESIDENT, vm.Name, Helpers.GetName(residentOn), toHost.Name); } protected override void Run() diff --git a/XenModel/Actions/VM/VMMigrateAction.cs b/XenModel/Actions/VM/VMMigrateAction.cs index 8b6e4a377..c0eae8a51 100644 --- a/XenModel/Actions/VM/VMMigrateAction.cs +++ b/XenModel/Actions/VM/VMMigrateAction.cs @@ -50,15 +50,11 @@ namespace XenAdmin.Actions.VMActions private static string GetTitle(VM vm, Host toHost) { - XenAPI.Host residentOn = vm.Connection.Resolve(vm.resident_on); - if (residentOn == null) - { - return Messages.ACTION_VM_MIGRATING; - } - else - { - return string.Format(Messages.ACTION_VM_MIGRATING_TITLE, vm.Name, Helpers.GetName(residentOn), toHost.Name); - } + Host residentOn = vm.Connection.Resolve(vm.resident_on); + + return residentOn == null + ? string.Format(Messages.ACTION_VM_MIGRATING_NON_RESIDENT, vm.Name, toHost.Name) + : string.Format(Messages.ACTION_VM_MIGRATING_RESIDENT, vm.Name, Helpers.GetName(residentOn), toHost.Name); } protected override void Run() diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index ad7c44afb..6fd3b50f7 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -2886,12 +2886,21 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Migrating VM '{0}' to '{1}'. + /// + public static string ACTION_VM_MIGRATING_NON_RESIDENT { + get { + return ResourceManager.GetString("ACTION_VM_MIGRATING_NON_RESIDENT", resourceCulture); + } + } + /// /// Looks up a localized string similar to Migrating VM '{0}' from '{1}' to '{2}'. /// - public static string ACTION_VM_MIGRATING_TITLE { + public static string ACTION_VM_MIGRATING_RESIDENT { get { - return ResourceManager.GetString("ACTION_VM_MIGRATING_TITLE", resourceCulture); + return ResourceManager.GetString("ACTION_VM_MIGRATING_RESIDENT", resourceCulture); } } diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 888a6bf0a..a28e241be 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -1074,7 +1074,10 @@ Migrating - + + Migrating VM '{0}' to '{1}' + + Migrating VM '{0}' from '{1}' to '{2}' diff --git a/XenModel/XenAPI-Extensions/Task.cs b/XenModel/XenAPI-Extensions/Task.cs index 1a636fac5..16a2e289d 100644 --- a/XenModel/XenAPI-Extensions/Task.cs +++ b/XenModel/XenAPI-Extensions/Task.cs @@ -81,7 +81,7 @@ namespace XenAPI // Titles["VM.export"] = ...; Titles["VM.hard_reboot"] = Messages.ACTION_VM_REBOOTING_TITLE; Titles["VM.hard_shutdown"] = Messages.ACTION_VM_SHUTTING_DOWN_TITLE; - Titles["VM.migrate_send"] = Messages.ACTION_VM_MIGRATING_TITLE; + Titles["VM.migrate_send"] = Messages.ACTION_VM_MIGRATING_RESIDENT; Titles["VM.resume"] = Messages.ACTION_VM_RESUMING_ON_TITLE; Titles["VM.resume_on"] = Messages.ACTION_VM_RESUMING_ON_TITLE; Titles["VM.start"] = Messages.ACTION_VM_STARTING_ON_TITLE;