From c0dd34334e776e83750918aab1b2e17187ea3d16 Mon Sep 17 00:00:00 2001 From: Digimer Date: Wed, 21 Aug 2019 01:14:10 -0400 Subject: [PATCH] * Fixed another bug in making ocf:alteeve:server work in pacemaker. Signed-off-by: Digimer --- Anvil/Tools/Server.pm | 6 +++--- notes | 1 + ocf/alteeve/server | 21 +++++++++++---------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Anvil/Tools/Server.pm b/Anvil/Tools/Server.pm index f4be6c00..f015051c 100755 --- a/Anvil/Tools/Server.pm +++ b/Anvil/Tools/Server.pm @@ -186,9 +186,9 @@ This is the password to use when connecting to a remote machine. If not set, but This is the TCP port to use when connecting to a remote machine. If not set, but C<< target >> is, C<< 22 >> will be used. -=head3 refresh (optional, default '0') +=head3 refresh (optional, default '1') -Is set to C<< 1 >>, and previously seen servers and their information is cleared. +Is set to C<< 0 >>, any previously seen servers and their information is cleared. =head3 remote_user (optional, default 'root') @@ -208,7 +208,7 @@ sub find my $password = defined $parameter->{password} ? $parameter->{password} : ""; my $port = defined $parameter->{port} ? $parameter->{port} : ""; - my $refresh = defined $parameter->{refresh} ? $parameter->{refresh} : 0; + my $refresh = defined $parameter->{refresh} ? $parameter->{refresh} : 1; my $remote_user = defined $parameter->{remote_user} ? $parameter->{remote_user} : "root"; my $target = defined $parameter->{target} ? $parameter->{target} : "local"; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { diff --git a/notes b/notes index 7e0665fd..1371ab28 100644 --- a/notes +++ b/notes @@ -1124,3 +1124,4 @@ pcs constraint show --full pcs constraint remove cli-ban-test_server-on-el8-a01n01 +pcs constraint remove $(pcs constraint show --full | grep ban-test_server | perl -pe 's/^.*?id:(.*?)\)/$1/') diff --git a/ocf/alteeve/server b/ocf/alteeve/server index 6b9e6aef..bd6d1db9 100755 --- a/ocf/alteeve/server +++ b/ocf/alteeve/server @@ -800,16 +800,20 @@ sub migrate_server # Pull the server here. Start by verifying it's on the 'meta_on_node' host. # Scan locally and on our peer $anvil->Server->find({debug => 2}); - $anvil->Server->find({debug => 2, target => $meta_on_node}); + $anvil->Server->find({debug => 2, target => $meta_on_node, refresh => 0}); - my $host = defined $anvil->data->{server}{location}{$server}{host} ? $anvil->data->{server}{location}{$server}{host} : ""; - my $status = defined $anvil->data->{server}{location}{$server}{status} ? $anvil->data->{server}{location}{$server}{status} : ""; + my $host = defined $anvil->data->{server}{location}{$server}{host} ? $anvil->data->{server}{location}{$server}{host} : ""; + my $short_host = ($host =~ /^(.*?)\..*$/)[0]; + my $status = defined $anvil->data->{server}{location}{$server}{status} ? $anvil->data->{server}{location}{$server}{status} : ""; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - host => $host, - status => $status, - target => $target, + host => $host, + short_host => $short_host, + status => $status, + target => $target, }}); + # Convert the host to a short name, in case the node's name is the short version. + my $server_host = defined $anvil->data->{server}{location}{$server}{host} ? $anvil->data->{server}{location}{$server}{host} : ""; my $server_status = defined $anvil->data->{server}{location}{$server}{status} ? $anvil->data->{server}{location}{$server}{status} : ""; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { @@ -821,11 +825,8 @@ sub migrate_server # make sure it is running and, if so, return '0'. The 'meta_on_node' is the new host. if (($target eq $anvil->_hostname) or ($target eq $anvil->_short_hostname) or ($target eq $meta_on_node)) { - # Yup. All we want to do if make sure it is running here. - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "log_0345", variables => { server => $server }}); - # If it's running, we're succesfully out. - if (($host eq $target) && ($status eq "running")) + if ((($host eq $target) or ($short_host eq $target)) && ($status eq "running")) { # Success! $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "log_0347", variables => { server => $server }});