ui: cluster: require ring0_addr if joinee's ring and node addr differ

Pass the ring addresses from the node we use to join a cluster with
the encoded cluster info. Use it to determine if the nodes public
address (i.e., the onei t's node name resolves to) differs from it'S
ring0 address, if that's the case and the cluster was created with
PVE tooling then we know that it's highly probable that the ring0 is
on another network than the public net, so require the ring0_addrss
field in this case. If we have a false positive, it's not to bad
here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2018-11-27 15:22:24 +01:00 committed by Dominik Csapak
parent 1f409296fb
commit 0f706ed86c
2 changed files with 22 additions and 1 deletions

View File

@ -88,6 +88,7 @@ Ext.define('PVE.ClusterAdministration', {
vm.set('preferred_node', {
name: data.preferred_node,
addr: nodeinfo.pve_addr,
ring_addr: [ nodeinfo.ring0_addr, nodeinfo.ring1_addr ],
fp: nodeinfo.pve_fp
});
},
@ -111,6 +112,7 @@ Ext.define('PVE.ClusterAdministration', {
joinInfo: {
ipAddress: vm.get('preferred_node.addr'),
fingerprint: vm.get('preferred_node.fp'),
ring_addr: vm.get('preferred_node.ring_addr'),
totem: vm.get('totem')
}
});

View File

@ -131,9 +131,19 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
info: {
fp: '',
ip: '',
ring0Needed: false,
ring1Possible: false,
ring1Needed: false
}
},
formulas: {
ring0EmptyText: function(get) {
if (get('info.ring0Needed')) {
return gettext("Cannot use default address safely");
} else {
return gettext("Default: IP resolved by node's hostname");
}
}
}
},
@ -188,9 +198,15 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
if (!(joinInfo && joinInfo.totem)) {
field.valid = false;
} else {
var ring0Needed = false;
if (joinInfo.ring_addr !== undefined) {
ring0Needed = joinInfo.ring_addr[0] !== joinInfo.ipAddress;
}
info = {
ip: joinInfo.ipAddress,
fp: joinInfo.fingerprint,
ring0Needed: ring0Needed,
ring1Possible: !!joinInfo.totem['interface']['1'],
ring1Needed: !!joinInfo.totem['interface']['1']
};
@ -282,7 +298,10 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
{
xtype: 'proxmoxtextfield',
fieldLabel: gettext('Corosync Ring 0'),
emptyText: gettext("Default: IP resolved by node's hostname"),
bind: {
emptyText: '{ring0EmptyText}',
allowBlank: '{!info.ring0Needed}'
},
skipEmptyText: true,
name: 'ring0_addr'
},