* Updated Cluster->parse_cib() to pre-fill some hashes to avoid undefined errors.

* Updated Storage->rsync() to only create the rsync wrapper if a password was given, allowing for rsync to work to/from a remote system when passwordless SSH is enabled.
* Updated anvil-join-anvil to disable/stop drbd.service, and to properly wait until both nodes are online.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent 01974d7efe
commit 345d2e33d4
  1. 10
      Anvil/Tools/Cluster.pm
  2. 28
      Anvil/Tools/Storage.pm
  3. 25
      tools/anvil-join-anvil

@ -332,6 +332,16 @@ sub parse_cib
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"cib::parsed::data::node::${node}::id" => $anvil->data->{cib}{parsed}{data}{node}{$node}{id},
}});
# Preload state values (in case they're not read in this CIB.
$anvil->data->{cib}{parsed}{cib}{node_state}{$node_id}{in_ccm} = "false";
$anvil->data->{cib}{parsed}{cib}{node_state}{$node_id}{crmd} = "offline";
$anvil->data->{cib}{parsed}{cib}{node_state}{$node_id}{'join'} = "down";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"cib::parsed::cib::node_state::${node_id}::in_ccm" => $anvil->data->{cib}{parsed}{cib}{node_state}{$node_id}{in_ccm},
"cib::parsed::cib::node_state::${node_id}::crmd" => $anvil->data->{cib}{parsed}{cib}{node_state}{$node_id}{crmd},
"cib::parsed::cib::node_state::${node_id}::join" => $anvil->data->{cib}{parsed}{cib}{node_state}{$node_id}{'join'},
}});
}
}
}

@ -2340,7 +2340,7 @@ sub rsync
}});
}
# If local, call rsync directly. If remote, setup the rsync wrapper
# If local, call rsync directly. If remote, and if we've got a password, setup the rsync wrapper
my $wrapper_script = "";
my $shell_call = $anvil->data->{path}{exe}{rsync}." ".$switches." ".$source." ".$destination;
if (not $anvil->Network->is_local({host => $target}))
@ -2360,16 +2360,21 @@ sub rsync
user => $<,
});
# Remote target, wrapper needed.
$wrapper_script = $anvil->Storage->_create_rsync_wrapper({
debug => $debug,
target => $target,
password => $password,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => { wrapper_script => $wrapper_script }});
# And make the shell call
$shell_call = $wrapper_script." ".$switches." ".$source." ".$destination;
# Do we have a password? If so, create a wrapper.
if ($password)
{
# Remote target, wrapper needed.
$wrapper_script = $anvil->Storage->_create_rsync_wrapper({
debug => $debug,
target => $target,
password => $password,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => { wrapper_script => $wrapper_script }});
# And make the shell call
$shell_call = $wrapper_script." ".$switches." ".$source." ".$destination;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
}
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => { shell_call => $shell_call }});
@ -2405,6 +2410,7 @@ sub rsync
if ($line_number)
{
$conflict = $anvil->data->{path}{exe}{cp}." ".$source." ".$destination." && ".$anvil->data->{path}{exe}{sed}." -ie '".$line_number."d' ".$source;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { conflict => $conflict }});
}
}
}

@ -134,21 +134,24 @@ sub configure_pacemaker
update_progress($anvil, ($anvil->data->{job}{progress} += 2), "job_0094,!!daemon!pcsd!!");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0094", variables => { daemon => "pcsd" }});
# Disabled and stop the libvirtd daemons.
($return_code) = $anvil->System->disable_daemon({daemon => "libvirtd"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { return_code => $return_code }});
$return_code = undef;
($return_code) = $anvil->System->stop_daemon({daemon => "libvirtd"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { return_code => $return_code }});
$return_code = undef;
update_progress($anvil, ($anvil->data->{job}{progress} += 2), "job_0095,!!daemon!libvirtd!!");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0095", variables => { daemon => "libvirtd" }});
# Disabled and stop the libvirtd daemon.
foreach my $daemon ("libvirtd.service", "drbd.service")
{
my ($return_code) = $anvil->System->disable_daemon({daemon => $daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { return_code => $return_code }});
$return_code = undef;
($return_code) = $anvil->System->stop_daemon({daemon => $daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { return_code => $return_code }});
$return_code = undef;
update_progress($anvil, ($anvil->data->{job}{progress} += 2), "job_0095,!!daemon!".$daemon."!!");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0095", variables => { daemon => $daemon }});
}
# If there is no corosync.conf, see if the peer has it. If so, copy it. If not, we'll initialize the
# cluster shortly.
if (not -e $anvil->data->{path}{configs}{'corosync.conf'})
{
my $cluster_conf = $anvil->Storeage->read_file({
my $cluster_conf = $anvil->Storage->read_file({
file => $anvil->data->{path}{configs}{'corosync.conf'},
target => $peer_host_name,
});
@ -365,6 +368,8 @@ sub configure_pacemaker
sleep 5 if not $both_online;
}
}
die;
=cut
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed};

Loading…
Cancel
Save