* Fixed a bug where definition files that used '<source file='X'/>' instead of '<source dev='X'/>' for the backing block device for disks.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent 873ed3e2b0
commit 7db542b9b0
  1. 41
      Anvil/Tools/Server.pm
  2. 3
      ocf/alteeve/server

@ -1006,15 +1006,15 @@ sub _parse_definition
{
#print Dumper $hash_ref;
my $device = $hash_ref->{device};
my $type = $hash_ref->{type};
my $alias = defined $hash_ref->{alias}->[0]->{name} ? $hash_ref->{alias}->[0]->{name} : "";
my $device_target = $hash_ref->{target}->[0]->{dev};
my $device_bus = $hash_ref->{target}->[0]->{bus};
my $address_type = $hash_ref->{address}->[0]->{type};
my $address_bus = $hash_ref->{address}->[0]->{bus};
my $boot_order = defined $hash_ref->{boot}->[0]->{order} ? $hash_ref->{boot}->[0]->{order} : 99;
my $driver_name = $hash_ref->{driver}->[0]->{name};
my $driver_type = $hash_ref->{driver}->[0]->{type};
my $type = defined $hash_ref->{type} ? $hash_ref->{type} : "";
my $alias = defined $hash_ref->{alias}->[0]->{name} ? $hash_ref->{alias}->[0]->{name} : "";
my $device_bus = defined $hash_ref->{target}->[0]->{bus} ? $hash_ref->{target}->[0]->{bus} : "";
my $address_type = defined $hash_ref->{address}->[0]->{type} ? $hash_ref->{address}->[0]->{type} : "";
my $address_bus = defined $hash_ref->{address}->[0]->{bus} ? $hash_ref->{address}->[0]->{bus} : "";
my $boot_order = defined $hash_ref->{boot}->[0]->{order} ? $hash_ref->{boot}->[0]->{order} : 99;
my $driver_name = defined $hash_ref->{driver}->[0]->{name} ? $hash_ref->{driver}->[0]->{name} : "";
my $driver_type = defined $hash_ref->{driver}->[0]->{type} ? $hash_ref->{driver}->[0]->{type} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
device => $device,
type => $type,
@ -1028,6 +1028,19 @@ sub _parse_definition
driver_type => $driver_type,
}});
# A device path can come from 'dev' or 'file'.
my $device_path = "";
if (defined $hash_ref->{source}->[0]->{dev})
{
$device_path = $hash_ref->{source}->[0]->{dev};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { device_path => $device_path }});
}
else
{
$device_path = $hash_ref->{source}->[0]->{file};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { device_path => $device_path }});
}
# Record common data
$anvil->data->{server}{$server}{$source}{device}{$device}{target}{$device_target}{alias} = $alias;
$anvil->data->{server}{$server}{$source}{device}{$device}{target}{$device_target}{boot_order} = $boot_order;
@ -1051,12 +1064,11 @@ sub _parse_definition
# Record type-specific data
if ($device eq "disk")
{
my $address_slot = $hash_ref->{address}->[0]->{slot};
my $address_domain = $hash_ref->{address}->[0]->{domain};
my $address_function = $hash_ref->{address}->[0]->{function};
my $device_path = $hash_ref->{source}->[0]->{dev};
my $driver_io = $hash_ref->{driver}->[0]->{io};
my $driver_cache = $hash_ref->{driver}->[0]->{cache};
my $address_slot = defined $hash_ref->{address}->[0]->{slot} ? $hash_ref->{address}->[0]->{slot} : "";
my $address_domain = defined $hash_ref->{address}->[0]->{domain} ? $hash_ref->{address}->[0]->{domain} : "";
my $address_function = defined $hash_ref->{address}->[0]->{function} ? $hash_ref->{address}->[0]->{function} : "";
my $driver_io = defined $hash_ref->{driver}->[0]->{io} ? $hash_ref->{driver}->[0]->{io} : "";
my $driver_cache = defined $hash_ref->{driver}->[0]->{cache} ? $hash_ref->{driver}->[0]->{cache} : "";
$anvil->data->{server}{$server}{$source}{device}{$device}{target}{$device_target}{address}{domain} = $address_domain;
$anvil->data->{server}{$server}{$source}{device}{$device}{target}{$device_target}{address}{slot} = $address_slot;
@ -1103,7 +1115,6 @@ sub _parse_definition
else
{
# Looks like IDE is no longer supported on RHEL 8.
my $device_path = defined $hash_ref->{source}->[0]->{file} ? $hash_ref->{source}->[0]->{file} : "";
my $address_controller = $hash_ref->{address}->[0]->{controller};
my $address_unit = $hash_ref->{address}->[0]->{unit};
my $address_target = $hash_ref->{address}->[0]->{target};

@ -720,7 +720,7 @@ sub validate_storage
### TODO: When checking on a running server, use 'from_memory'.
my $server = $anvil->data->{environment}{OCF_RESKEY_name};
my $source = "from_disk";
if (exists $anvil->data->{server}{$server}{from_memory})
if ($anvil->data->{server}{$server}{from_memory}{host})
{
$source = "from_memory";
}
@ -783,6 +783,7 @@ sub validate_storage_drbd
# Did I find a resource for each disk?
foreach my $device_path (sort {$a cmp $b} keys %{$anvil->data->{server}{$server}{device}})
{
next if not $device_path;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"server::${server}::device::${device_path}::resource" => $anvil->data->{server}{$server}{device}{$device_path}{resource},
}});

Loading…
Cancel
Save