mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-24 22:06:59 +01:00
CA-339273: Mention source and destination Host/Pool in VM migrate action
Also removed useless `this` calls and tidied code Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
parent
d5e2324408
commit
4f2a6f8995
@ -42,10 +42,9 @@ namespace XenAdmin.Actions.VMActions
|
||||
public VMMigrateAction(VM vm, Host destinationHost)
|
||||
: base(vm.Connection, GetTitle(vm, destinationHost))
|
||||
{
|
||||
this.Description = Messages.ACTION_PREPARING;
|
||||
this.VM = vm;
|
||||
this.Host = destinationHost;
|
||||
this.Pool = Core.Helpers.GetPool(vm.Connection);
|
||||
VM = vm;
|
||||
Host = destinationHost;
|
||||
Pool = Helpers.GetPool(vm.Connection);
|
||||
}
|
||||
|
||||
private static string GetTitle(VM vm, Host toHost)
|
||||
@ -53,14 +52,14 @@ namespace XenAdmin.Actions.VMActions
|
||||
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());
|
||||
? string.Format(Messages.ACTION_VM_MIGRATING_NON_RESIDENT, vm.NameWithLocation(), toHost.NameWithLocation())
|
||||
: string.Format(Messages.ACTION_VM_MIGRATING_RESIDENT, vm.Name(), residentOn.NameWithLocation(), toHost.NameWithLocation());
|
||||
}
|
||||
|
||||
protected override void Run()
|
||||
{
|
||||
this.Description = Messages.ACTION_VM_MIGRATING;
|
||||
RelatedTask = XenAPI.VM.async_live_migrate(Session, VM.opaque_ref, Host.opaque_ref);
|
||||
Description = Messages.ACTION_VM_MIGRATING;
|
||||
RelatedTask = VM.async_live_migrate(Session, VM.opaque_ref, Host.opaque_ref);
|
||||
try
|
||||
{
|
||||
PollToCompletion();
|
||||
@ -68,17 +67,15 @@ namespace XenAdmin.Actions.VMActions
|
||||
catch (Failure f)
|
||||
{
|
||||
if (f.ErrorDescription.Count >= 5 && f.ErrorDescription[0] == "VM_MIGRATE_FAILED"
|
||||
&& f.ErrorDescription[4].Contains("VDI_MISSING"))
|
||||
&& f.ErrorDescription[4].Contains("VDI_MISSING"))
|
||||
{
|
||||
throw new Exception(Messages.MIGRATE_EJECT_TOOLS_ON_UPGRADE);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
this.Description = Messages.ACTION_VM_MIGRATED;
|
||||
Description = Messages.ACTION_VM_MIGRATED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user