diff --git a/share/words.xml b/share/words.xml
index ac1751d8..f870eb18 100644
--- a/share/words.xml
+++ b/share/words.xml
@@ -521,6 +521,11 @@ The definition data passed in was:
]]>
[ Error ] - Failed to wipe and delete the logical volume: [#!variable!local_lv!#] that was volume number: [#!variable!volume!#] under the server: [#!variable!server!#].
There was a problem deleting: [#!variable!config_file!#]. The rest of the process completed successfully. Please manually remove this file if it still exists.
+ [ Error ] - Failed to connect the DRBD resource. Expected return code '0', but got: [#!variable!return_code!#]. The error output, if anything, was
+====
+#!variable!output!#
+====
+ Can not (dis)connect the server: [#!variable!server!#] as the resource config file: [#!variable!config_file!#] doesn't exist. Do you need to '--protect' it?
@@ -1320,7 +1325,7 @@ Note: Depending on the disk write load and storage network speed to the DR host,
About to connect the DR resource for the server: [#!variable!server!#].
Brought up the connection locally. Now checking that the resource is up on the nodes.
Making sure the resource is up on: [#!variable!host_name!#].
- Waiting now for the our resource to connect.
+ Waiting now for the resource to connect.
Done! The server: [#!variable!server!#] is now connected.
Do you want to disconnect the DR host for the server: [#!variable!server!#]?
diff --git a/tools/anvil-manage-dr b/tools/anvil-manage-dr
index 1bcf4267..15b469be 100755
--- a/tools/anvil-manage-dr
+++ b/tools/anvil-manage-dr
@@ -59,7 +59,7 @@ if (not $anvil->data->{switches}{'job-uuid'})
my $termios = new POSIX::Termios;
$termios->getattr;
my $ospeed = $termios->getospeed;
- $terminal = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };
+ $terminal = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { terminal => $terminal }});
$terminal->Trequire(qw/ce ku kd/);
@@ -94,6 +94,31 @@ sub sanity_check
anvil_uuid => $anvil_uuid,
}});
+ # If we're (dis}connecting, is the server being protected in the first place?
+ if (($anvil->data->{switches}{'connect'}) or ($anvil->data->{switches}{'disconnect'}))
+ {
+ # Is this server configured to be protected?
+ my $server_name = $anvil->data->{switches}{server};
+ my $config_file = $anvil->data->{path}{directories}{drbd_resources}."/".$server_name.".res";
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { config_file => $config_file }});
+ if (not -e $config_file)
+ {
+ # Can't connect an unprotected server.
+ my $variables = {
+ server => $server_name,
+ config_file => $config_file,
+ };
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "error_0371", variables => $variables});
+ $anvil->Job->update_progress({
+ progress => 100,
+ message => "error_0371",
+ variables => $variables,
+ job_status => "failed",
+ });
+ }
+ $anvil->nice_exit({exit_code => 1});
+ }
+
# If we're doing a --protect or --remove, make sure we're a node, the cluster is up, and both nodes
# are ready.
if (($anvil->data->{switches}{protect}) or ($anvil->data->{switches}{remove}))
@@ -240,9 +265,9 @@ sub sanity_check
### peer to be online.
# If we're protecting or removing a server from DR, the peer needs to be up.
if ((($anvil->data->{switches}{protect}) or
- ($anvil->data->{switches}{remove}) or
- ($anvil->data->{switches}{protocol})) &&
- (not $anvil->data->{cib}{parsed}{peer}{ready}))
+ ($anvil->data->{switches}{remove}) or
+ ($anvil->data->{switches}{protocol})) &&
+ (not $anvil->data->{cib}{parsed}{peer}{ready}))
{
if ($anvil->data->{switches}{protect})
{
@@ -250,8 +275,8 @@ sub sanity_check
# isn't at this time.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "error_0338"});
$anvil->Job->update_progress({
- progress => 0,
- message => "error_0338",
+ progress => 0,
+ message => "error_0338",
job_status => "failed",
});
}
@@ -261,8 +286,8 @@ sub sanity_check
# this time.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "error_0339"});
$anvil->Job->update_progress({
- progress => 0,
- message => "error_0339",
+ progress => 0,
+ message => "error_0339",
job_status => "failed",
});
}
@@ -279,8 +304,8 @@ sub sanity_check
# Please specify the server to manager using '--server '.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "error_0340"});
$anvil->Job->update_progress({
- progress => 100,
- message => "error_0340",
+ progress => 100,
+ message => "error_0340",
job_status => "failed",
});
$anvil->nice_exit({exit_code => 1});
@@ -986,6 +1011,24 @@ sub process_connect
output => $output,
return_code => $return_code,
}});
+
+ # If this was an error, abort.
+ if ($return_code)
+ {
+ # Failed.
+ my $variables = {
+ return_code => $return_code,
+ output => $output,
+ };
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "error_0370", variables => $variables});
+ $anvil->Job->update_progress({
+ progress => 100,
+ message => "error_0370",
+ variables => $variables,
+ });
+ $anvil->nice_exit({exit_code => 1});
+ }
+
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0388", variables => $variables});
$anvil->Job->update_progress({
progress => 60,