* Fixed another bug in making ocf:alteeve:server work in pacemaker.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent ed2e83a1a4
commit c0dd34334e
  1. 6
      Anvil/Tools/Server.pm
  2. 1
      notes
  3. 11
      ocf/alteeve/server

@ -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. 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') =head3 remote_user (optional, default 'root')
@ -208,7 +208,7 @@ sub find
my $password = defined $parameter->{password} ? $parameter->{password} : ""; my $password = defined $parameter->{password} ? $parameter->{password} : "";
my $port = defined $parameter->{port} ? $parameter->{port} : ""; 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 $remote_user = defined $parameter->{remote_user} ? $parameter->{remote_user} : "root";
my $target = defined $parameter->{target} ? $parameter->{target} : "local"; my $target = defined $parameter->{target} ? $parameter->{target} : "local";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {

@ -1124,3 +1124,4 @@ pcs constraint show --full
pcs constraint remove cli-ban-test_server-on-el8-a01n01 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/')

@ -800,16 +800,20 @@ sub migrate_server
# Pull the server here. Start by verifying it's on the 'meta_on_node' host. # Pull the server here. Start by verifying it's on the 'meta_on_node' host.
# Scan locally and on our peer # Scan locally and on our peer
$anvil->Server->find({debug => 2}); $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 $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} : ""; 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 => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
host => $host, host => $host,
short_host => $short_host,
status => $status, status => $status,
target => $target, 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_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} : ""; 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 => { $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. # 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)) 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 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! # Success!
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "log_0347", variables => { server => $server }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "log_0347", variables => { server => $server }});

Loading…
Cancel
Save