# THis makes sure that the needed backing DRBD devices are on this node. If so, and if they are not up, they
# will be brought up. If that fails, it errors out.
sub validate_storage_drbd
{
my ($conf) = @_;
# Read in the DRBD configuration XML.
my ($return_code, $drbd_body) = shell_call($conf, $conf->{path}{exe}{drbdadm}." dump-xml");
if ($return_code)
{
# Something went wrong.
to_log($conf, {message => "The attempt to read the DRBD configuration returned a non-zero code: [$return_code]. The returned output (if any) was: [$drbd_body].", 'line' => __LINE__, level => 0, priority => "err"});
if (($local_hostname eq $short_hostname) or ($local_hostname =~ /^$short_hostname\./))
{
# This is us.
to_log($conf, {message => "Recording the local connection details for the resource: [$resource] -> [$address:$port].", 'line' => __LINE__, level => 2});
}
else
{
# This is our peer
to_log($conf, {message => "Recording the peer's connection details for the resource: [$resource] -> [$address:$port].", 'line' => __LINE__, level => 2});
}
}
}
}
=cut
$VAR1 = {
'resource' => {
'srv01-c7_0' => {
'host' => {
'm3-a02n02.alteeve.com' => {
'volume' => {
'0' => {
'meta-disk' => [
'internal'
],
'disk' => [
'/dev/node02_vg0/srv01-c7'
],
'device' => [
{
'content' => '/dev/drbd0',
'minor' => '0'
}
]
}
},
'address' => [
{
'content' => '(null)',
'port' => '(null)',
'family' => '(null)'
}
]
},
'm3-a02n01.alteeve.com' => {
'volume' => {
'0' => {
'meta-disk' => [
'internal'
],
'disk' => [
'/dev/node01_vg0/srv01-c7'
],
'device' => [
{
'content' => '/dev/drbd0',
'minor' => '0'
}
]
}
},
'address' => [
{
'content' => '(null)',
'port' => '(null)',
'family' => '(null)'
}
]
}
}
}
},
'file' => '/etc/drbd.conf',
'common' => [
{
'section' => {
'disk' => {
'option' => {
'md-flushes' => {
'value' => 'no'
},
'disk-flushes' => {
'value' => 'no'
}
}
},
'options' => {
'option' => {
'auto-promote' => {
'value' => 'yes'
}
}
},
'handlers' => {
'option' => {
'fence-peer' => {
'value' => '/usr/sbin/fence_pacemaker'
}
}
},
'net' => {
'option' => {
'after-sb-2pri' => {
'value' => 'disconnect'
},
'allow-two-primaries' => {
'value' => 'no'
},
'after-sb-1pri' => {
'value' => 'discard-secondary'
},
'after-sb-0pri' => {
'value' => 'discard-zero-changes'
},
'data-integrity-alg' => {
'value' => 'md5'
},
'csums-alg' => {
'value' => 'md5'
}
}
}
}
}
]
};
=cut
foreach my $disk (sort {$a cmp $b} keys %{$conf->{server}{disks}})
foreach my $disk (sort {$a cmp $b} keys %{$conf->{server}{disks}})
{
{
to_log($conf, {message => "Checking that the DRBD device: [$disk] is ready.", 'line' => __LINE__, level => 2});
to_log($conf, {message => "Checking that the DRBD device: [$disk] is ready.", 'line' => __LINE__, level => 2});
}
}
# Verify optical disks now
return(0);
}
# This makes sure that any media in the server's optical drive exists here and is readable.
sub validate_storage_optical
{
my ($conf) = @_;
foreach my $file (sort {$a cmp $b} keys %{$conf->{server}{optical}})
foreach my $file (sort {$a cmp $b} keys %{$conf->{server}{optical}})
{
{
to_log($conf, {message => "Checking that the optical disc image: [$file] exists.", 'line' => __LINE__, level => 2});
to_log($conf, {message => "Checking that the optical disc image: [$file] exists.", 'line' => __LINE__, level => 2});
@ -562,13 +765,20 @@ sub validate_storage
# OCF_ERR_PERM (4).
# OCF_ERR_PERM (4).
if (not -e $file)
if (not -e $file)
{
{
# It doesn't exist. Exit with OCF_ERR_INSTALLED (5).
to_log($conf, {message => "The server has the ISO: [$file] mounted in its optical drive, but that file doesn't exist on this system.", 'line' => __LINE__, level => 0, priority => "err"});
exit(5);
}
}
elsif (not -r $file)
elsif (not -r $file)
{
{
# We can't read it. Exit with OCF_ERR_PERM (4).
to_log($conf, {message => "The server has the ISO: [$file] mounted in its optical drive, which we have, but we can't read it. Check permissions and for SELinux denials.", 'line' => __LINE__, level => 0, priority => "err"});
exit(4);
}
}
else
else
{
{
# We're OK.
# We're OK.
to_log($conf, {message => "The server has the ISO: [$file] mounted in its optical drive, which we have.", 'line' => __LINE__, level => 2});