foreach my $resource (sort {$a cmp $b} keys %{$anvil->data->{server}{'local'}{$server}{resource}})
{
my $peer_ip = $anvil->data->{drbd}{config}{$host}{resource}{$resource}{connection}{$peer}{ip_address};
@ -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 }});
# Is the current resource up locally already? If it is, we're done.
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.