foreach my $resource (sort {$a cmp $b} keys %{$drbd_xml->{resource}})
foreach my $resource (sort {$a cmp $b} keys %{$drbd_xml->{resource}})
{
{
@ -625,24 +622,20 @@ sub validate_storage_drbd
# This is us.
# This is us.
$local = $host;
$local = $host;
to_log($conf, {message => "Recording the local connection details for the resource: [$resource] -> [$address:$port].", 'line' => __LINE__, level => 2});
to_log($conf, {message => "Recording the local connection details for the resource: [$resource] -> [$address:$port].", 'line' => __LINE__, level => 2});
if (not $conf->{server}{drbd}{'local'}{device}{$device_path}{lv})
if (not $conf->{server}{drbd}{'local'}{device}{$device_path}{lv})
{
{
# The backing LV doesn't exist.
# The backing LV doesn't exist.
@ -683,6 +677,27 @@ sub validate_storage_drbd
}
}
}
}
# Now read in the status of the drbd devices
$return_code = undef;
($return_code, my $status_json) = shell_call($conf, $conf->{path}{exe}{drbdsetup}." status --json");
if ($return_code)
{
# Something went wrong.
to_log($conf, {message => "The attempt to read the DRBD status returned a non-zero code: [$return_code]. The returned output (if any) was: [$status_json].", 'line' => __LINE__, level => 0, priority => "err"});
exit(1);
}
my $json = JSON->new->allow_nonref;
my $drbd_status = $json->decode($status_json);
# Pull out my data
#my $local_disk_state =
foreach my $connection_ref (@{$drbd_status->[0]->{connections}})