Add 'use-location-rules' feature flag to the datacenter options input
panel to control the behavior of the HA Manager, API endpoints, and web
interface to either use and show HA Groups (disabled), or use and show
HA Location rules (enabled).

The util helper is used in following patches to control existing and new
behavior to act correctly.

Signed-off-by: Daniel Kral <d.k...@proxmox.com>
---
I'm not that happy with the many calls that are made to the
getHALocationFeatureStatus(...) helper function and in general the calls
to the API endpoint. I'd like some more feedback how we could handle the
migration part better (for this and the following patches).

changes since v1:
    - NEW!

 www/manager6/Utils.js         |  5 +++++
 www/manager6/dc/OptionView.js | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 29334111..6f58fd20 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -45,6 +45,11 @@ Ext.define('PVE.Utils', {
             return levelMap;
         },
 
+        getHALocationFeatureStatus: async function () {
+            let { result } = await Proxmox.Async.api2({ url: 
'/cluster/options' });
+            return result?.data?.ha?.['use-location-rules'] === 1;
+        },
+
         kvm_ostypes: {
             Linux: [
                 { desc: '6.x - 2.6 Kernel', val: 'l26' },
diff --git a/www/manager6/dc/OptionView.js b/www/manager6/dc/OptionView.js
index 20d74b6f..68309e39 100644
--- a/www/manager6/dc/OptionView.js
+++ b/www/manager6/dc/OptionView.js
@@ -148,6 +148,19 @@ Ext.define('PVE.dc.OptionView', {
                     ],
                     defaultValue: '__default__',
                 },
+                {
+                    xtype: 'proxmoxcheckbox',
+                    name: 'use-location-rules',
+                    fieldLabel: gettext('Use HA Location rules'),
+                    boxLabel: gettext('Replace HA Groups with HA Location 
rules'),
+                    value: 0,
+                },
+                {
+                    xtype: 'box',
+                    html:
+                        `<span class='pmx-hint'>${gettext('Note:')}</span> ` +
+                        gettext('HA Groups need to be manually migrated to HA 
Location rules.'),
+                },
             ],
         });
         me.add_inputpanel_row('crs', gettext('Cluster Resource Scheduling'), {
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to