From 9af8efdc24a3dd220845c90a62a39a11b82b8766 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Tue, 10 Aug 2021 15:14:52 +0100 Subject: [PATCH] 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 --- XenModel/Actions/VM/ImportVmAction.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/XenModel/Actions/VM/ImportVmAction.cs b/XenModel/Actions/VM/ImportVmAction.cs index 44243619c..d5f728af1 100644 --- a/XenModel/Actions/VM/ImportVmAction.cs +++ b/XenModel/Actions/VM/ImportVmAction.cs @@ -72,9 +72,10 @@ namespace XenAdmin.Actions public ImportVmAction(IXenConnection connection, Host affinity, string filename, SR sr, Action warningDelegate, Action failureDiagnosisDelegate) - : base(connection, string.Format(Messages.IMPORTVM_TITLE, filename, Helpers.GetName(connection)), Messages.IMPORTVM_PREP) - { - Pool = Helpers.GetPoolOfOne(connection); + : base(connection, GetTitle(filename, connection, affinity)) + { + Description = Messages.IMPORTVM_PREP; + Pool = Helpers.GetPoolOfOne(connection); m_affinity = affinity; Host = affinity ?? connection.Resolve(Pool.master); SR = sr; @@ -96,6 +97,12 @@ namespace XenAdmin.Actions #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() { SafeToExit = false;