Create vTPMs as non-unique by default. Added title and description to create/destroy vTPM actions.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2022-09-08 11:41:47 +01:00
parent fc5ccf77be
commit 9e00a633f3
4 changed files with 55 additions and 5 deletions

View File

@ -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);
}

View File

@ -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;
}
}
}

View File

@ -40571,6 +40571,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Attaching vTPM....
/// </summary>
public static string VTPM_ATTACH_DESCRIPTION {
get {
return ResourceManager.GetString("VTPM_ATTACH_DESCRIPTION", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Attaching a new vTPM to VM &apos;{0}&apos;.
/// </summary>
public static string VTPM_ATTACH_TITLE {
get {
return ResourceManager.GetString("VTPM_ATTACH_TITLE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} vTPMs are attached to this VM..
/// </summary>
@ -40667,6 +40685,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Removing vTPM....
/// </summary>
public static string VTPM_REMOVE_DESCRIPTION {
get {
return ResourceManager.GetString("VTPM_REMOVE_DESCRIPTION", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Removing a vTPM from VM &apos;{0}&apos;.
/// </summary>
public static string VTPM_REMOVE_TITLE {
get {
return ResourceManager.GetString("VTPM_REMOVE_TITLE", resourceCulture);
}
}
/// <summary>
/// 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?.
/// </summary>

View File

@ -14009,6 +14009,12 @@ Schedule:
<data name="VTPM" xml:space="preserve">
<value>Trusted Platform Module</value>
</data>
<data name="VTPM_ATTACH_DESCRIPTION" xml:space="preserve">
<value>Attaching vTPM...</value>
</data>
<data name="VTPM_ATTACH_TITLE" xml:space="preserve">
<value>Attaching a new vTPM to VM '{0}'</value>
</data>
<data name="VTPM_ATTACHED_MANY" xml:space="preserve">
<value>{0} vTPMs are attached to this VM.</value>
</data>
@ -14045,6 +14051,12 @@ Schedule:
<data name="VTPM_REMOVE" xml:space="preserve">
<value>Remove vTPM</value>
</data>
<data name="VTPM_REMOVE_DESCRIPTION" xml:space="preserve">
<value>Removing vTPM...</value>
</data>
<data name="VTPM_REMOVE_TITLE" xml:space="preserve">
<value>Removing a vTPM from VM '{0}'</value>
</data>
<data name="VTPM_REMOVE_WARNING" xml:space="preserve">
<value>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?</value>
</data>