From 9e00a633f379de37aac675d503aa0b70b3540adc Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Thu, 8 Sep 2022 11:41:47 +0100 Subject: [PATCH] Create vTPMs as non-unique by default. Added title and description to create/destroy vTPM actions. Signed-off-by: Konstantina Chremmou --- XenAdmin/Dialogs/VtmpManagementDialog.cs | 2 +- XenModel/Actions/VtpmAction.cs | 10 ++++--- XenModel/Messages.Designer.cs | 36 ++++++++++++++++++++++++ XenModel/Messages.resx | 12 ++++++++ 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/XenAdmin/Dialogs/VtmpManagementDialog.cs b/XenAdmin/Dialogs/VtmpManagementDialog.cs index a8de92c0c..14244558a 100644 --- a/XenAdmin/Dialogs/VtmpManagementDialog.cs +++ b/XenAdmin/Dialogs/VtmpManagementDialog.cs @@ -202,7 +202,7 @@ namespace XenAdmin.Dialogs return; } - var action = new RemoveVtpmAction(vtpm.Connection, vtpm); + var action = new RemoveVtpmAction(vtpm.Connection, vtpm, _vm); using (var dlg = new ActionProgressDialog(action, ProgressBarStyle.Marquee)) dlg.ShowDialog(this); } diff --git a/XenModel/Actions/VtpmAction.cs b/XenModel/Actions/VtpmAction.cs index 5d45a5109..14689c06d 100644 --- a/XenModel/Actions/VtpmAction.cs +++ b/XenModel/Actions/VtpmAction.cs @@ -41,7 +41,7 @@ namespace XenAdmin.Actions public VTPM Vtpm { get; private set; } public NewVtpmAction(IXenConnection connection, VM vm) - : base(connection, "", "", false) + : base(connection, string.Format(Messages.VTPM_ATTACH_TITLE, vm.Name()), Messages.VTPM_ATTACH_DESCRIPTION, false) { _vm = vm; @@ -50,8 +50,9 @@ namespace XenAdmin.Actions protected override void Run() { - var vtpmRef = VTPM.create(Session, _vm.opaque_ref, true); + var vtpmRef = VTPM.create(Session, _vm.opaque_ref, false); Vtpm = Connection.TryResolveWithTimeout(vtpmRef); + Description = Messages.COMPLETED; } } @@ -59,8 +60,8 @@ namespace XenAdmin.Actions { private readonly VTPM _vtpm; - public RemoveVtpmAction(IXenConnection connection, VTPM vtpm) - : base(connection, "", "", false) + public RemoveVtpmAction(IXenConnection connection, VTPM vtpm, VM vm) + : base(connection, string.Format(Messages.VTPM_REMOVE_TITLE, vm.Name()), Messages.VTPM_REMOVE_DESCRIPTION, false) { _vtpm = vtpm; @@ -70,6 +71,7 @@ namespace XenAdmin.Actions protected override void Run() { VTPM.destroy(Session, _vtpm.opaque_ref); + Description = Messages.COMPLETED; } } } diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 00af3a349..440342fd7 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -40571,6 +40571,24 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Attaching vTPM.... + /// + public static string VTPM_ATTACH_DESCRIPTION { + get { + return ResourceManager.GetString("VTPM_ATTACH_DESCRIPTION", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Attaching a new vTPM to VM '{0}'. + /// + public static string VTPM_ATTACH_TITLE { + get { + return ResourceManager.GetString("VTPM_ATTACH_TITLE", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} vTPMs are attached to this VM.. /// @@ -40667,6 +40685,24 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Removing vTPM.... + /// + public static string VTPM_REMOVE_DESCRIPTION { + get { + return ResourceManager.GetString("VTPM_REMOVE_DESCRIPTION", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing a vTPM from VM '{0}'. + /// + public static string VTPM_REMOVE_TITLE { + get { + return ResourceManager.GetString("VTPM_REMOVE_TITLE", resourceCulture); + } + } + /// /// Looks up a localized string similar to Removing the vTPM may result in the deactivation of some security features on the VM and prevent it from starting. Do you want to continue?. /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 978724633..0a4b84541 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -14009,6 +14009,12 @@ Schedule: Trusted Platform Module + + Attaching vTPM... + + + Attaching a new vTPM to VM '{0}' + {0} vTPMs are attached to this VM. @@ -14045,6 +14051,12 @@ Schedule: Remove vTPM + + Removing vTPM... + + + Removing a vTPM from VM '{0}' + Removing the vTPM may result in the deactivation of some security features on the VM and prevent it from starting. Do you want to continue?