Re-enabled DB connections in ocf:alteeve:server.

Added DB connections to ocf:alteeve:server when starting or stopping
servers. This is to ensure that the servers -> server_state are updated
properly.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent 57cb98e9dd
commit 0014cc591d
  1. 7
      Anvil/Tools/Server.pm
  2. 14
      ocf/alteeve/server

@ -2633,8 +2633,6 @@ sub shutdown_virsh
if ($shutdown) if ($shutdown)
{ {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { "sys::database::connections" => $anvil->data->{sys}{database}{connections} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { "sys::database::connections" => $anvil->data->{sys}{database}{connections} }});
if ($anvil->data->{sys}{database}{connections})
{
if ($anvil->data->{sys}{database}{connections}) if ($anvil->data->{sys}{database}{connections})
{ {
my $anvil_uuid = $anvil->Cluster->get_anvil_uuid({debug => $debug}); my $anvil_uuid = $anvil->Cluster->get_anvil_uuid({debug => $debug});
@ -2672,7 +2670,6 @@ WHERE
} }
} }
} }
}
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "log_0520", variables => { server => $server }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "log_0520", variables => { server => $server }});
my ($output, $return_code) = $anvil->System->call({ my ($output, $return_code) = $anvil->System->call({
debug => $debug, debug => $debug,
@ -2729,8 +2726,12 @@ WHERE
}}); }});
# Mark it as stopped now. (if we have a server_uuid, we have a database connection) # Mark it as stopped now. (if we have a server_uuid, we have a database connection)
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { server_uuid => $server_uuid }});
if ($server_uuid) if ($server_uuid)
{ {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"sys::database::connections" => $anvil->data->{sys}{database}{connections},
}});
if ($anvil->data->{sys}{database}{connections}) if ($anvil->data->{sys}{database}{connections})
{ {
$anvil->Database->get_servers({debug => $debug}); $anvil->Database->get_servers({debug => $debug});

@ -623,6 +623,13 @@ sub start_server
# Start the resource, if needed. # Start the resource, if needed.
start_drbd_resource($anvil); start_drbd_resource($anvil);
# Get a connection so that we can mark is as being in shutdown and shut off.
$anvil->Database->connect({
check_for_resync => 0,
retry => 0,
sensitive => 1,
});
# Still alive? Boot! # Still alive? Boot!
my ($success) = $anvil->Server->boot_virsh({debug => 2, server => $server}); my ($success) = $anvil->Server->boot_virsh({debug => 2, server => $server});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { success => $success }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { success => $success }});
@ -1174,6 +1181,13 @@ sub stop_server
$anvil->System->check_storage(); $anvil->System->check_storage();
$anvil->Server->get_status({debug => 2, server => $server}); $anvil->Server->get_status({debug => 2, server => $server});
# Get a connection so that we can mark is as being in shutdown and shut off.
$anvil->Database->connect({
check_for_resync => 0,
retry => 0,
sensitive => 1,
});
$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_virsh({server => $server}); my $success = $anvil->Server->shutdown_virsh({server => $server});
if (not $success) if (not $success)

Loading…
Cancel
Save