CA-339273: Mention destination Host/Pool in VM import action

Also moved initial description update from base constructor call to body of subclass constructor.

Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
Danilo Del Busso 2021-08-10 15:14:52 +01:00
parent 73f1f620da
commit 9af8efdc24

View File

@ -72,9 +72,10 @@ namespace XenAdmin.Actions
public ImportVmAction(IXenConnection connection, Host affinity, string filename, SR sr, public ImportVmAction(IXenConnection connection, Host affinity, string filename, SR sr,
Action<VM, bool> warningDelegate, Action<VMStartAbstractAction, Failure> failureDiagnosisDelegate) Action<VM, bool> warningDelegate, Action<VMStartAbstractAction, Failure> failureDiagnosisDelegate)
: base(connection, string.Format(Messages.IMPORTVM_TITLE, filename, Helpers.GetName(connection)), Messages.IMPORTVM_PREP) : base(connection, GetTitle(filename, connection, affinity))
{ {
Pool = Helpers.GetPoolOfOne(connection); Description = Messages.IMPORTVM_PREP;
Pool = Helpers.GetPoolOfOne(connection);
m_affinity = affinity; m_affinity = affinity;
Host = affinity ?? connection.Resolve(Pool.master); Host = affinity ?? connection.Resolve(Pool.master);
SR = sr; SR = sr;
@ -96,6 +97,12 @@ namespace XenAdmin.Actions
#endregion #endregion
} }
private static string GetTitle(string filename, IXenConnection connection, Host affinity)
{
var toHost = affinity ?? connection.Resolve(Helpers.GetPoolOfOne(connection).master);
return string.Format(Messages.IMPORTVM_TITLE, filename, toHost.NameWithLocation());
}
protected override void Run() protected override void Run()
{ {
SafeToExit = false; SafeToExit = false;