From 0e0160645c18f0ae33755f356a26cd9c8444b4da Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Fri, 5 May 2023 02:14:38 +0100 Subject: [PATCH] CA-376894: The allowed_operations are not refreshed after vTPM removal in xapi 23.10.0. Signed-off-by: Konstantina Chremmou --- XenAdmin/Dialogs/VtpmManagementDialog.cs | 2 +- XenAdmin/Dialogs/VtpmManagementPage.cs | 4 ++-- XenModel/Actions/VM/CreateVMAction.cs | 2 +- XenModel/Utils/Helpers.Versions.cs | 4 ++-- XenModel/XenAPI-Extensions/VM.cs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/XenAdmin/Dialogs/VtpmManagementDialog.cs b/XenAdmin/Dialogs/VtpmManagementDialog.cs index 81ce43d23..7dfd8b4fa 100644 --- a/XenAdmin/Dialogs/VtpmManagementDialog.cs +++ b/XenAdmin/Dialogs/VtpmManagementDialog.cs @@ -179,7 +179,7 @@ namespace XenAdmin.Dialogs { cannotReason = null; - if (Helpers.XapiEqualOrGreater_23_10_0(vtpm.Connection)) + if (Helpers.XapiEqualOrGreater_23_11_0(vtpm.Connection)) { if (vtpm.allowed_operations.Contains(vtpm_operations.destroy)) return true; diff --git a/XenAdmin/Dialogs/VtpmManagementPage.cs b/XenAdmin/Dialogs/VtpmManagementPage.cs index 7c9c47ecf..41eedee69 100644 --- a/XenAdmin/Dialogs/VtpmManagementPage.cs +++ b/XenAdmin/Dialogs/VtpmManagementPage.cs @@ -93,7 +93,7 @@ namespace XenAdmin.Dialogs { cannotReason = null; - if (Helpers.XapiEqualOrGreater_23_10_0(Vtpm.Connection)) + if (Helpers.XapiEqualOrGreater_23_11_0(Vtpm.Connection)) { if (Vtpm.allowed_operations.Contains(vtpm_operations.destroy)) return true; @@ -114,7 +114,7 @@ namespace XenAdmin.Dialogs if (e.PropertyName == "is_protected" || e.PropertyName == "is_unique") Program.Invoke(this, UpdateProperties); - if (e.PropertyName == "allowed_operations" && Helpers.XapiEqualOrGreater_23_10_0(vtpm.Connection)) + if (e.PropertyName == "allowed_operations" && Helpers.XapiEqualOrGreater_23_11_0(vtpm.Connection)) Program.Invoke(this, UpdateButtons); } diff --git a/XenModel/Actions/VM/CreateVMAction.cs b/XenModel/Actions/VM/CreateVMAction.cs index a791ba9ea..754cd1aad 100644 --- a/XenModel/Actions/VM/CreateVMAction.cs +++ b/XenModel/Actions/VM/CreateVMAction.cs @@ -278,7 +278,7 @@ namespace XenAdmin.Actions.VMActions if (!_assignVtpm) return; - if (Helpers.XapiEqualOrGreater_23_10_0(Connection) && !VM.allowed_operations.Contains(vm_operations.create_vtpm)) + if (Helpers.XapiEqualOrGreater_23_11_0(Connection) && !VM.allowed_operations.Contains(vm_operations.create_vtpm)) return; new NewVtpmAction(Connection, VM).RunSync(Session); diff --git a/XenModel/Utils/Helpers.Versions.cs b/XenModel/Utils/Helpers.Versions.cs index 2ce4c59d9..866a92c99 100644 --- a/XenModel/Utils/Helpers.Versions.cs +++ b/XenModel/Utils/Helpers.Versions.cs @@ -456,10 +456,10 @@ namespace XenAdmin.Core return coordinator == null || ProductVersionCompare(coordinator.GetXapiVersion(), "23.9.0") >= 0; } - public static bool XapiEqualOrGreater_23_10_0(IXenConnection conn) + public static bool XapiEqualOrGreater_23_11_0(IXenConnection conn) { var coordinator = GetCoordinator(conn); - return coordinator == null || ProductVersionCompare(coordinator.GetXapiVersion(), "23.10.0") >= 0; + return coordinator == null || ProductVersionCompare(coordinator.GetXapiVersion(), "23.11.0") >= 0; } #endregion diff --git a/XenModel/XenAPI-Extensions/VM.cs b/XenModel/XenAPI-Extensions/VM.cs index 6e8c2d867..f47e3e244 100644 --- a/XenModel/XenAPI-Extensions/VM.cs +++ b/XenModel/XenAPI-Extensions/VM.cs @@ -1790,7 +1790,7 @@ namespace XenAPI { cannotReason = null; - if (Helpers.XapiEqualOrGreater_23_10_0(Connection)) + if (Helpers.XapiEqualOrGreater_23_11_0(Connection)) { if (allowed_operations.Contains(vm_operations.create_vtpm)) return true;