* Fixed an issue with ocf:alteeve:server where, after a migration, the target host would invoke the RA as if it was trying to migrate, instead of verifying the server (resource) was OK post migration.

* Fixed a bug in Server->get_status() where the call to Storage->rsync's returned output checked for '!!errer!!' instead of '!!error!!'.
* Fixed a bug in Storage->rsync where, when no port was passed in, it would try to specify an empty port and fail.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent 1498e1b53c
commit 14bf323627
  1. 2
      Anvil/Tools/Remote.pm
  2. 6
      Anvil/Tools/Server.pm
  3. 7
      Anvil/Tools/Storage.pm
  4. 2
      Anvil/Tools/System.pm
  5. 10
      notes
  6. 53
      ocf/alteeve/server
  7. 2
      share/words.xml

@ -748,7 +748,7 @@ sub test_access
my $anvil = $self->parent; my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
my $password = defined $parameter->{password} ? $parameter->{password} : $anvil->data->{sys}{root_password}; my $password = defined $parameter->{password} ? $parameter->{password} : "";
my $port = defined $parameter->{port} ? $parameter->{port} : 22; my $port = defined $parameter->{port} ? $parameter->{port} : 22;
my $target = defined $parameter->{target} ? $parameter->{target} : ""; my $target = defined $parameter->{target} ? $parameter->{target} : "";
my $user = defined $parameter->{user} ? $parameter->{user} : getpwuid($<); my $user = defined $parameter->{user} ? $parameter->{user} : getpwuid($<);

@ -421,7 +421,7 @@ sub get_status
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"server::${host}::${server}::from_disk::xml" => $anvil->data->{server}{$host}{$server}{from_disk}{xml}, "server::${host}::${server}::from_disk::xml" => $anvil->data->{server}{$host}{$server}{from_disk}{xml},
}}); }});
if (($anvil->data->{server}{$host}{$server}{from_disk}{xml} eq "!!errer!!") or (not $anvil->data->{server}{$host}{$server}{from_disk}{xml})) if (($anvil->data->{server}{$host}{$server}{from_disk}{xml} eq "!!error!!") or (not $anvil->data->{server}{$host}{$server}{from_disk}{xml}))
{ {
# Failed to read it. # Failed to read it.
$anvil->data->{server}{$host}{$server}{from_disk}{xml} = ""; $anvil->data->{server}{$host}{$server}{from_disk}{xml} = "";
@ -707,6 +707,10 @@ sub migrate
# Call the migration now # Call the migration now
my ($output, $return_code) = $anvil->System->call({shell_call => $migration_command}); my ($output, $return_code) = $anvil->System->call({shell_call => $migration_command});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
}});
if ($return_code) if ($return_code)
{ {
# Something went wrong. # Something went wrong.

@ -2307,6 +2307,13 @@ sub rsync
try_again => $try_again, try_again => $try_again,
}}); }});
# Make sure the port is sane;
if ((not $port) or ($port =~ /\D/) or ($port < 0) or ($port > 65535))
{
$port = 22;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => { port => $port }});
}
# Add an argument for the port if set # Add an argument for the port if set
if ($port ne "22") if ($port ne "22")
{ {

@ -1187,7 +1187,7 @@ sub check_storage
This uses the host information along with the Anvil! the host is in to find and configure the local IPMI BMC. This uses the host information along with the Anvil! the host is in to find and configure the local IPMI BMC.
If this host is not in an Anvil!, or if the host is in an Anvil!, but no IPMI BMC was found, or any other issue arises, C<< 0 >> is returned. If there is any problem, C<< !!errer!! >> will be returned. If this host is not in an Anvil!, or if the host is in an Anvil!, but no IPMI BMC was found, or any other issue arises, C<< 0 >> is returned. If there is any problem, C<< !!error!! >> will be returned.
If a BMC is found and configured, the C<< fence_ipmilan >> call used to check the status is stored in C<< hosts >> -> C<< host_ipmi >>, and the same string is returned. If a BMC is found and configured, the C<< fence_ipmilan >> call used to check the status is stored in C<< hosts >> -> C<< host_ipmi >>, and the same string is returned.

10
notes

@ -293,9 +293,9 @@ pcs resource clone hypervisor clone-max=2 notify="false"
pcs resource create drbd systemd:drbd op monitor interval=60 pcs resource create drbd systemd:drbd op monitor interval=60
pcs resource clone drbd clone-max=2 notify="false" pcs resource clone drbd clone-max=2 notify="false"
pcs resource create srv01-sql ocf:alteeve:server name="srv01-sql" meta allow-migrate="true" op monitor interval="60" on-fail="block" pcs resource create srv07-el6 ocf:alteeve:server name="srv07-el6" meta allow-migrate="true" op monitor interval="60" on-fail="block"
- or - - or -
pcs resource update srv01-sql ocf:alteeve:server name="srv01-sql" meta allow-migrate="true" op monitor interval="60" on-fail="block" pcs resource update srv07-el6 ocf:alteeve:server name="srv07-el6" meta allow-migrate="true" op monitor interval="60" on-fail="block"
# Test # Test
stonith_admin --fence el8-a01n02 --verbose; crm_error $? stonith_admin --fence el8-a01n02 --verbose; crm_error $?
@ -912,13 +912,13 @@ virt-install --connect qemu:///system \
# Migration; # Migration;
pcs resource move srv01-sql pcs resource move srv07-el6 mk-a02n02
# (then remove the constraint); # (then remove the constraint);
pcs constraint show --full pcs constraint show --full
pcs constraint remove cli-ban-srv01-sql-on-el8-a01n01 pcs constraint remove cli-ban-srv07-el6-on-mk-a02n01
pcs constraint remove $(pcs constraint show --full | grep ban-srv01-sql | perl -pe 's/^.*?id:(.*?)\)/$1/') pcs constraint remove $(pcs constraint show --full | grep ban-srv07-el6 | perl -pe 's/^.*?id:(.*?)\)/$1/')
DRBD 9 - Check; DRBD 9 - Check;

@ -211,11 +211,17 @@ if (not $anvil->data->{switches}{monitor})
# help -(usage maps here) Displays a usage message when the resource agent is invoked from the command line, rather than by the cluster manager. # help -(usage maps here) Displays a usage message when the resource agent is invoked from the command line, rather than by the cluster manager.
# notify -Inform resource about changes in state of other clones. # notify -Inform resource about changes in state of other clones.
if (($anvil->data->{switches}{migrate_to}) or ($anvil->data->{switches}{migrate_from})) if ($anvil->data->{switches}{migrate_to})
{ {
# We don't support this, so we return OCF_ERR_UNIMPLEMENTED (3) # We don't support this, so we return OCF_ERR_UNIMPLEMENTED (3)
migrate_server($anvil); migrate_server($anvil);
} }
elsif ($anvil->data->{switches}{migrate_from})
{
# This is called after a migration is complete, so we're basically just doing a status check.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0529", variables => { server => $anvil->data->{environment}{OCF_RESKEY_name} }});
server_status($anvil);
}
elsif ($anvil->data->{switches}{start}) elsif ($anvil->data->{switches}{start})
{ {
# Start the server # Start the server
@ -659,7 +665,7 @@ sub start_server
start_drbd_resource($anvil); start_drbd_resource($anvil);
# Still alive? Boot! # Still alive? Boot!
my ($success) = $anvil->Server->boot({debug => 2, server => $server}); my ($success) = $anvil->Server->boot({debug => 3, server => $server});
if ($success) if ($success)
{ {
# Success! # Success!
@ -709,7 +715,7 @@ sub stop_drbd_resource
# Bring the peer's resource down. # Bring the peer's resource down.
$anvil->DRBD->manage_resource({ $anvil->DRBD->manage_resource({
debug => 2, debug => 3,
resource => $resource, resource => $resource,
task => "down", task => "down",
target => $peer_ip, target => $peer_ip,
@ -717,7 +723,7 @@ sub stop_drbd_resource
# Bring the local resource down # Bring the local resource down
$anvil->DRBD->manage_resource({ $anvil->DRBD->manage_resource({
debug => 2, debug => 3,
resource => $resource, resource => $resource,
task => "down", task => "down",
}); });
@ -946,7 +952,7 @@ sub stop_server
# Read in an parse the server's XML. # Read in an parse the server's XML.
$anvil->System->check_storage({debug => 3}); $anvil->System->check_storage({debug => 3});
$anvil->Server->get_status({debug => 2, server => $server}); $anvil->Server->get_status({debug => 3, server => $server});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0313", variables => { server => $server }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0313", variables => { server => $server }});
my $success = $anvil->Server->shutdown({debug => 3, server => $server}); my $success = $anvil->Server->shutdown({debug => 3, server => $server});
@ -1159,17 +1165,6 @@ sub migrate_server
{ {
my ($anvil) = @_; my ($anvil) = @_;
# Before migrating, make sure the daemons are running on the peer.
check_daemons($anvil, "start");
# Make sure switches are at least defined.
$anvil->data->{switches}{migrate_to} = "" if not defined $anvil->data->{switches}{migrate_to};
$anvil->data->{switches}{migrate_from} = "" if not defined $anvil->data->{switches}{migrate_from};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
'switches::migrate_to' => $anvil->data->{switches}{migrate_to},
'switches::migrate_from' => $anvil->data->{switches}{migrate_from},
}});
### NOTE: For now, we're not going to block if the target is not UpToDate. There are times when a ### NOTE: For now, we're not going to block if the target is not UpToDate. There are times when a
### user might want to do this (ie: sync will be done soon and the need to evacuate the node ### user might want to do this (ie: sync will be done soon and the need to evacuate the node
### ASAP is high). Maybe we'll enforce this and require a '--force' switch later? ### ASAP is high). Maybe we'll enforce this and require a '--force' switch later?
@ -1190,6 +1185,23 @@ sub migrate_server
meta_on_node => $meta_on_node, meta_on_node => $meta_on_node,
}}); }});
# Make sure switches are at least defined.
$anvil->data->{switches}{migrate_to} = "" if not defined $anvil->data->{switches}{migrate_to};
$anvil->data->{switches}{migrate_from} = "" if not defined $anvil->data->{switches}{migrate_from};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
'switches::migrate_to' => $anvil->data->{switches}{migrate_to},
'switches::migrate_from' => $anvil->data->{switches}{migrate_from},
}});
# Log what we're doing.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0528", variables => {
server => $server,
target_host => $target,
}});
# Before migrating, make sure the daemons are running on the peer.
check_daemons($anvil, "start");
# The actual migration command will involve enabling dual primary, then beginning the migration. The # The actual migration command will involve enabling dual primary, then beginning the migration. The
# virsh call will depend on if we're pushing or pulling. Once the migration completes, regardless of # virsh call will depend on if we're pushing or pulling. Once the migration completes, regardless of
# success or failure, dual primary will be disabled again. # success or failure, dual primary will be disabled again.
@ -1347,7 +1359,7 @@ sub migrate_server
# If we're still alive, we're ready to migrate. # If we're still alive, we're ready to migrate.
($migrated) = $anvil->Server->migrate({ ($migrated) = $anvil->Server->migrate({
debug => 2, debug => 3,
server => $server, server => $server,
source => $source, source => $source,
target => $target target => $target
@ -1356,6 +1368,7 @@ sub migrate_server
} }
elsif ($source) elsif ($source)
{ {
### NOTE: Pacemaker doesn't seem to ever pull servers.
# 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 => 3}); $anvil->Server->find({debug => 3});
@ -1401,7 +1414,7 @@ sub migrate_server
# Call the pull migation. # Call the pull migation.
($migrated) = $anvil->Server->migrate({ ($migrated) = $anvil->Server->migrate({
debug => 2, debug => 3,
server => $server, server => $server,
source => $source, source => $source,
target => $target target => $target
@ -1440,8 +1453,8 @@ sub validate_all
}}); }});
# Read in an parse the server's XML. # Read in an parse the server's XML.
$anvil->System->check_storage({debug => 2}); $anvil->System->check_storage({debug => 3});
$anvil->Server->get_status({debug => 2, server => $server}); $anvil->Server->get_status({debug => 3, server => $server});
# Is the name in the definition file what we expect (and did we read the XML data at all)? # Is the name in the definition file what we expect (and did we read the XML data at all)?
validate_name($anvil); validate_name($anvil);

@ -1005,6 +1005,8 @@ The file: [#!variable!file!#] needs to be updated. The difference is:
<key name="log_0525">The server is shutting down. Will wait for it to finish...</key> <key name="log_0525">The server is shutting down. Will wait for it to finish...</key>
<key name="log_0526">The server is off.</key> <key name="log_0526">The server is off.</key>
<key name="log_0527">The server is running (state is: [#!variable!state!#]).</key> <key name="log_0527">The server is running (state is: [#!variable!state!#]).</key>
<key name="log_0528">We've been asked to migrating the server: [#!variable!server!#] to: [#!variable!target_host!#].</key>
<key name="log_0529">Checking server state after: [#!variable!server!#] was migrated to this host.</key>
<!-- Messages for users (less technical than log entries), though sometimes used for logs, too. --> <!-- Messages for users (less technical than log entries), though sometimes used for logs, too. -->
<key name="message_0001">The host name: [#!variable!target!#] does not resolve to an IP address.</key> <key name="message_0001">The host name: [#!variable!target!#] does not resolve to an IP address.</key>

Loading…
Cancel
Save