* Added 'timeout' and 'wfc-timeout' to drbd'd global-common.conf in DRBD->update_global_common().

* Fixed a minor bug in ocf:alteeve:server found in testing the RA.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent e35800c413
commit 6eeb4e48c7
  1. 88
      Anvil/Tools/DRBD.pm
  2. 3
      notes
  3. 37
      ocf/alteeve/server

@ -1017,6 +1017,8 @@ sub update_global_common
my $after_sb_0pri_seen = 0;
my $after_sb_1pri_seen = 0;
my $after_sb_2pri_seen = 0;
my $timeout_seen = 0;
my $wfc_timeout_seen = 0;
my $in_global = 0;
my $in_common = 0;
@ -1036,6 +1038,8 @@ sub update_global_common
my $say_after_sb_0pri = "discard-zero-changes";
my $say_after_sb_1pri = "discard-secondary";
my $say_after_sb_2pri = "disconnect";
my $say_timeout = "100";
my $say_wfc_timeout = 120;
# Read in the existing config.
my $new_global_common = "";
@ -1117,7 +1121,17 @@ sub update_global_common
$in_startup = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { in_startup => $in_startup }});
# We don't do anything here yet.
if (not $wfc_timeout_seen)
{
$update = 1;
my $new_line = "\t\twfc-timeout ".$say_wfc_timeout.";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:update' => $update,
's2:new_line' => $new_line,
}});
$new_global_common .= $new_line."\n";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0518", variables => { file => $anvil->data->{path}{configs}{'global-common.conf'}, line => $line }});
}
}
elsif ($in_options)
{
@ -1216,6 +1230,18 @@ sub update_global_common
$new_global_common .= $new_line."\n";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0518", variables => { file => $anvil->data->{path}{configs}{'global-common.conf'}, line => $line }});
}
if (not $timeout_seen)
{
$update = 1;
my $new_line = "\t\ttimeout ".$say_timeout.";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:update' => $update,
's2:new_line' => $new_line,
}});
$new_global_common .= $new_line."\n";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0518", variables => { file => $anvil->data->{path}{configs}{'global-common.conf'}, line => $line }});
}
}
else
{
@ -1335,7 +1361,35 @@ sub update_global_common
}
if ($in_startup)
{
# Not doing anything here yet.
if ($line =~ /(\s*)wfc-timeout(\s+)(.*?)(;.*)$/)
{
my $left_space = $1;
my $middle_space = $2;
my $value = $3;
my $right_side = $4;
$wfc_timeout_seen = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:left_space' => $left_space,
's2:middle_space' => $middle_space,
's3:value' => $value,
's4:right_side' => $right_side,
's5:wfc_timeout_seen' => $wfc_timeout_seen,
}});
if ($value ne $say_wfc_timeout)
{
$update = 1;
my $new_line = $left_space."wfc-timeout".$middle_space.$say_wfc_timeout.$right_side;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:update' => $update,
's2:new_line' => $new_line,
}});
$new_global_common .= $new_line.$comment."\n";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0518", variables => { file => $anvil->data->{path}{configs}{'global-common.conf'}, line => $line }});
next;
}
}
}
if ($in_options)
{
@ -1548,6 +1602,36 @@ sub update_global_common
next;
}
}
if ($line =~ /(\s*)timeout(\s+)(.*?)(;.*)$/)
{
my $left_space = $1;
my $middle_space = $2;
my $value = $3;
my $right_side = $4;
$timeout_seen = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:left_space' => $left_space,
's2:middle_space' => $middle_space,
's3:value' => $value,
's4:right_side' => $right_side,
's5:after_sb_2pri_seen' => $after_sb_2pri_seen,
}});
if ($value ne $say_timeout)
{
$update = 1;
my $new_line = $left_space."timeout".$middle_space.$say_timeout.$right_side;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:update' => $update,
's2:new_line' => $new_line,
}});
$new_global_common .= $new_line.$comment."\n";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0518", variables => { file => $anvil->data->{path}{configs}{'global-common.conf'}, line => $line }});
next;
}
}
}
# Add this line (will have 'next'ed if the line was modified before getting here).

@ -323,7 +323,8 @@ cluster-recheck-interval puts an upper bound on the "i give up" time
** Shrinking online is ONLY possible if the metadata is external. Worth creating *_md LVs? Offline requires backing up and restoring the MD
Provisioning a server will need to:
* Open up a DRBD port (or more, if multiple resources are created).
* Create the LVs
* Open up the DRBD ports
* Create the DRBD resource(s); Find the lowest free rX.res, create it locally and on the peer (if up),
firewall-cmd --zone=public --permanent --add-port=7788-7790/tcp

@ -100,7 +100,7 @@ $anvil->Log->secure({set => 1});
### Read or Set the environment variables
# This is the name of the server we're managing. # Example values:
$anvil->data->{environment}{OCF_RESKEY_name} = defined $ENV{OCF_RESKEY_name} ? $ENV{OCF_RESKEY_name} : ""; # srv01-sql
$anvil->data->{environment}{OCF_RESKEY_name} = defined $ENV{OCF_RESKEY_name} ? $ENV{OCF_RESKEY_name} : ""; # srv07-el6
# This is our node name
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_on_node} = defined $ENV{OCF_RESKEY_CRM_meta_on_node} ? $ENV{OCF_RESKEY_CRM_meta_on_node} : ""; # mk-a02n01.digimer.ca
# This says "UUID", but it's the node ID.
@ -133,7 +133,7 @@ if ($anvil->data->{environment}{PCMK_debug})
# to show this prone to higher risk of fencing if something goes wrong. As such, we're changing the default
# behaviour to leave DRBD resources up. Set this to '1' (here or by switch) to revert back to the old
# behaviour.
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_stop_drbd_resources} = 0;
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_stop_drbd_resources} = 1;
# Get any command line switches.
$anvil->Get->switches;
@ -149,7 +149,7 @@ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 0, level
### TEST: to be removed later
if ($anvil->data->{switches}{test1})
{
$anvil->data->{environment}{OCF_RESKEY_name} = "srv01-sql";
$anvil->data->{environment}{OCF_RESKEY_name} = "srv07-el6";
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_timeout} = 20000;
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_on_node} = "mk-a02n01.digimer.ca";
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_migrate_source} = "mk-a02n01.digimer.ca";
@ -158,7 +158,7 @@ if ($anvil->data->{switches}{test1})
}
if ($anvil->data->{switches}{test2})
{
$anvil->data->{environment}{OCF_RESKEY_name} = "srv01-sql";
$anvil->data->{environment}{OCF_RESKEY_name} = "srv07-el6";
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_timeout} = 20000;
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_on_node} = "mk-a02n02.digimer.ca";
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_migrate_source} = "mk-a02n02.digimer.ca";
@ -167,10 +167,16 @@ if ($anvil->data->{switches}{test2})
}
if ($anvil->data->{switches}{test3})
{
$anvil->data->{environment}{OCF_RESKEY_name} = "srv01-sql";
$anvil->data->{environment}{OCF_RESKEY_name} = "srv07-el6";
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_on_node} = "mk-a02n01.digimer.ca";
print "Running test 3; Boot or shutdown of: [".$anvil->data->{environment}{OCF_RESKEY_name}."].\n";
}
if ($anvil->data->{switches}{test4})
{
$anvil->data->{environment}{OCF_RESKEY_name} = "srv07-el6";
$anvil->data->{environment}{OCF_RESKEY_CRM_meta_on_node} = "mk-a02n01.digimer.ca";
print "Status check of: [".$anvil->data->{environment}{OCF_RESKEY_name}."] on: [".$anvil->data->{environment}{OCF_RESKEY_CRM_meta_on_node}."].\n";
}
# This is for debugging.
if (($anvil->data->{switches}{monitor}) or
@ -295,6 +301,7 @@ sub check_daemons
if ($task eq "start")
{
### It doesn't look like we need to start drbd. Up'ing the first resource works without it.
#foreach my $daemon ("libvirtd.service", "drbd.service")
foreach my $daemon ("libvirtd.service")
{
@ -434,7 +441,7 @@ sub check_daemons
elsif ($return_code eq "0")
{
# Running, nothing to do.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "log_0485", variables => {
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "log_0489", variables => {
daemon => $daemon,
host => $peer_name,
}});
@ -695,6 +702,7 @@ sub stop_drbd_resource
# Bring the peer's resource down.
$anvil->DRBD->manage_resource({
debug => 2,
resource => $resource,
task => "down",
target => $peer_ip,
@ -702,6 +710,7 @@ sub stop_drbd_resource
# Bring the local resource down
$anvil->DRBD->manage_resource({
debug => 2,
resource => $resource,
task => "down",
});
@ -726,12 +735,15 @@ sub start_drbd_resource
# Do we need startup?
my $startup_needed = 0;
$anvil->DRBD->get_status({debug => 3});
$anvil->DRBD->get_status({debug => 2});
foreach my $resource (sort {$a cmp $b} keys %{$anvil->data->{server}{'local'}{$server}{resource}})
{
# Is the current resource up locally already? If it is, we're done.
my $role = $anvil->data->{drbd}{status}{$host}{resource}{$resource}{role};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { role => $role }});
my $role = defined $anvil->data->{drbd}{status}{$host}{resource}{$resource}{role} ? $anvil->data->{drbd}{status}{$host}{resource}{$resource}{role} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
resource => $resource,
role => $role,
}});
if ((lc($role) ne "secondary") && (lc($role) ne "primary"))
{
@ -783,7 +795,7 @@ sub start_drbd_resource
my $waiting = 1;
while($waiting)
{
$anvil->DRBD->get_status({debug => 3});
$anvil->DRBD->get_status({debug => 2});
my $connection_state = $anvil->data->{drbd}{status}{$host}{resource}{$resource}{connection}{$peer}{'connection-state'};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
@ -944,8 +956,9 @@ sub stop_server
stop_drbd_resource($anvil);
}
### Disabled, we'll leave daemons running.
# If this was the last running server, stop the daemons.
check_daemons($anvil, "stop");
#check_daemons($anvil, "stop");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "log_0324", variables => { server => $server }});
$anvil->nice_exit({exit_code => 0});
@ -970,6 +983,8 @@ sub server_status
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, priority => "alert", key => "log_0331", variables => { timeout => $anvil->data->{environment}{OCF_RESKEY_CRM_meta_timeout} }});
}
### TODO
$anvil->nice_exit({exit_code => 0});
}

Loading…
Cancel
Save