[pve-devel] [PATCH cluster v4 14/15] use resolved IP address for ring0_addr as default

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jan 9 15:53:02 CET 2018


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 data/PVE/API2/ClusterConfig.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/data/PVE/API2/ClusterConfig.pm b/data/PVE/API2/ClusterConfig.pm
index e44cd85..2ef3733 100644
--- a/data/PVE/API2/ClusterConfig.pm
+++ b/data/PVE/API2/ClusterConfig.pm
@@ -481,7 +481,7 @@ __PACKAGE__->register_method ({
 	    ring0_addr => {
 		type => 'string', format => 'address',
 		description => "Hostname (or IP) of the corosync ring0 address of this node.".
-		    " Defaults to nodes hostname.",
+		    " Defaults IP resolved by nodes hostname.",
 		optional => 1,
 	    },
 	    ring1_addr => {
@@ -522,6 +522,7 @@ __PACKAGE__->register_method ({
 	    PVE::Cluster::ssh_unmerge_known_hosts();
 
 	    my $host = $param->{hostname};
+	    my $local_ip_address = PVE::Cluster::remote_node_ip($nodename);
 
 	    my $conn_args = {
 		username => 'root at pam',
@@ -554,7 +555,7 @@ __PACKAGE__->register_method ({
 	    $args->{force} = $param->{force} if defined($param->{force});
 	    $args->{nodeid} = $param->{nodeid} if $param->{nodeid};
 	    $args->{votes} = $param->{votes} if defined($param->{votes});
-	    $args->{ring0_addr} = $ring0_addr if defined($ring0_addr);
+	    $args->{ring0_addr} = $ring0_addr // $local_ip_address;
 	    $args->{ring1_addr} = $ring1_addr if defined($ring1_addr);
 
 	    print "Request addition of this node\n";
-- 
2.11.0





More information about the pve-devel mailing list