From d41cd94baf04f39a7eff65e746d5ebd0a498a31c Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Tue, 10 Aug 2021 13:54:06 +0100 Subject: [PATCH] CA-339273: Mention source Host/Pool in VM clone action Also removed useless `this` calls and tidied code Signed-off-by: Danilo Del Busso --- XenModel/Actions/VM/VMCloneAction.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/XenModel/Actions/VM/VMCloneAction.cs b/XenModel/Actions/VM/VMCloneAction.cs index 2da1ee64b..10693eb42 100644 --- a/XenModel/Actions/VM/VMCloneAction.cs +++ b/XenModel/Actions/VM/VMCloneAction.cs @@ -29,6 +29,7 @@ * SUCH DAMAGE. */ +using XenAdmin.Core; using XenAPI; @@ -40,14 +41,13 @@ namespace XenAdmin.Actions.VMActions protected string _cloneName; protected string _cloneDescription; public VMCloneAction(VM vm, string name, string description) - : base(vm.Connection, string.Format(Messages.CREATEVM_CLONE, name, vm.Name())) + : base(vm.Connection, string.Format(Messages.CREATEVM_CLONE, name, vm.NameWithLocation())) { - this.Description = Messages.ACTION_PREPARING; - this.VM = vm; - this.Host = vm.Home(); - this.Pool = Core.Helpers.GetPool(vm.Connection); + VM = vm; + Host = vm.Home(); + Pool = Helpers.GetPool(vm.Connection); if (vm.is_a_template) - this.Template = vm; + Template = vm; _cloneName = name; _cloneDescription = description; ApiMethodsToRoleCheck.AddRange(Role.CommonSessionApiList); @@ -58,15 +58,15 @@ namespace XenAdmin.Actions.VMActions protected override void Run() { - this.Description = Messages.ACTION_TEMPLATE_CLONING; - RelatedTask = XenAPI.VM.async_clone(Session, VM.opaque_ref, _cloneName); + Description = Messages.ACTION_TEMPLATE_CLONING; + RelatedTask = VM.async_clone(Session, VM.opaque_ref, _cloneName); PollToCompletion(); { VM created = Connection.WaitForCache(new XenRef(Result)); - XenAPI.VM.set_name_description(Session, created.opaque_ref, _cloneDescription); + VM.set_name_description(Session, created.opaque_ref, _cloneDescription); Result = created.opaque_ref; } - this.Description = Messages.ACTION_TEMPLATE_CLONED; + Description = Messages.ACTION_TEMPLATE_CLONED; } }