[pve-devel] [PATCH v3 manager 3/3] gui/cluster: add structured peerLinks to join info
Stefan Reiter
s.reiter at proxmox.com
Mon Mar 23 13:41:14 CET 2020
Instead of the old 'ring_addr' property (which is kept for
compatibility), we also encode the link numbers into the new peerLinks
structure. This allows us to display which IP is assigned to which link
on the cluster in the join dialog, helping a user identify which link
should receive which interface on the new node.
Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
www/manager6/dc/Cluster.js | 13 +++++++++----
www/manager6/dc/ClusterEdit.js | 9 +++++++--
www/manager6/dc/CorosyncLinkEdit.js | 18 ++++++++++++++++--
3 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/www/manager6/dc/Cluster.js b/www/manager6/dc/Cluster.js
index 963da098..3dc1b30c 100644
--- a/www/manager6/dc/Cluster.js
+++ b/www/manager6/dc/Cluster.js
@@ -85,14 +85,18 @@ Ext.define('PVE.ClusterAdministration', {
return el.name === data.preferred_node;
});
- var links = [];
- PVE.Utils.forEachCorosyncLink(nodeinfo,
- (num, link) => links.push(link));
+ let links = {};
+ let ring_addr = [];
+ PVE.Utils.forEachCorosyncLink(nodeinfo, (num, link) => {
+ links[num] = link;
+ ring_addr.push(link);
+ });
vm.set('preferred_node', {
name: data.preferred_node,
addr: nodeinfo.pve_addr,
- ring_addr: links,
+ peerLinks: links,
+ ring_addr: ring_addr,
fp: nodeinfo.pve_fp
});
},
@@ -116,6 +120,7 @@ Ext.define('PVE.ClusterAdministration', {
joinInfo: {
ipAddress: vm.get('preferred_node.addr'),
fingerprint: vm.get('preferred_node.fp'),
+ peerLinks: vm.get('preferred_node.peerLinks'),
ring_addr: vm.get('preferred_node.ring_addr'),
totem: vm.get('totem')
}
diff --git a/www/manager6/dc/ClusterEdit.js b/www/manager6/dc/ClusterEdit.js
index c18b546b..7bcb3880 100644
--- a/www/manager6/dc/ClusterEdit.js
+++ b/www/manager6/dc/ClusterEdit.js
@@ -223,10 +223,15 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
} else {
let interfaces = joinInfo.totem.interface;
let links = Object.values(interfaces).map(iface => {
+ let linkNumber = iface.linknumber;
+ let peerLink;
+ if (joinInfo.peerLinks) {
+ peerLink = joinInfo.peerLinks[linkNumber];
+ }
return {
- number: iface.linknumber,
+ number: linkNumber,
value: '',
- text: '',
+ text: peerLink ? Ext.String.format(gettext("peer's link address: {0}"), peerLink) : '',
allowBlank: false
};
});
diff --git a/www/manager6/dc/CorosyncLinkEdit.js b/www/manager6/dc/CorosyncLinkEdit.js
index e14ee85f..6dc3a143 100644
--- a/www/manager6/dc/CorosyncLinkEdit.js
+++ b/www/manager6/dc/CorosyncLinkEdit.js
@@ -14,7 +14,7 @@ Ext.define('PVE.form.CorosyncLinkEditorController', {
this.addLink();
},
- addLink: function(number, value, allowBlank) {
+ addLink: function(number, value, allowBlank, text) {
let me = this;
let view = me.getView();
let vm = view.getViewModel();
@@ -37,6 +37,7 @@ Ext.define('PVE.form.CorosyncLinkEditorController', {
allowBlankNetwork: allowBlank,
initNumber: number,
initNetwork: value,
+ text: text,
// needs to be set here, because we need to update the viewmodel
removeBtnHandler: function() {
@@ -130,6 +131,7 @@ Ext.define('PVE.form.CorosyncLinkSelector', {
// values
initNumber: 0,
initNetwork: '',
+ text: '',
layout: 'hbox',
bodyPadding: 5,
@@ -190,6 +192,17 @@ Ext.define('PVE.form.CorosyncLinkSelector', {
parent.removeBtnHandler();
}
}
+ },
+ {
+ xtype: 'label',
+ margin: '-1px 0 0 5px',
+
+ // for muted effect
+ cls: 'x-form-item-label-default',
+
+ cbind: {
+ text: '{text}'
+ }
}
],
@@ -327,7 +340,8 @@ Ext.define('PVE.form.CorosyncLinkEditor', {
vm.set('linkCount', 0);
Ext.Array.each(links, link => {
- controller.addLink(link['number'], link['value'], link['allowBlank']);
+ controller.addLink(link['number'], link['value'],
+ link['allowBlank'], link['text']);
});
},
--
2.25.2
More information about the pve-devel
mailing list