* Fixed a SQL query bug in Database->get_drbd_data().

* Got more work done on anvil-manage-server-storage; Now shows DRBD resource size, backing LV and size, and calculates/displayes metadata size.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 2 years ago
parent 040bc02e26
commit 8ff40ec42c
  1. 8
      Anvil/Tools/Database.pm
  2. 35
      tools/anvil-manage-server-storage

@ -3133,7 +3133,6 @@ SELECT
scan_drbd_total_sync_speed
FROM
scan_drbd
WHERE
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
@ -3178,7 +3177,6 @@ SELECT
scan_drbd_resource_xml
FROM
scan_drbd_resources
WHERE
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
@ -3195,7 +3193,7 @@ WHERE
my $resource_uuid = $row->[0];
my $scan_drbd_resource_host_uuid = $row->[1];
my $scan_drbd_resource_name = $row->[2];
my $short_host_name = $anvil->data->{hosts}{host_uuid}{$scan_drbd_resource_name}{short_host_name};
my $short_host_name = $anvil->data->{hosts}{host_uuid}{$scan_drbd_resource_host_uuid}{short_host_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
resource_uuid => $resource_uuid,
scan_drbd_resource_host_uuid => $scan_drbd_resource_host_uuid,
@ -3230,7 +3228,6 @@ SELECT
scan_drbd_volume_size
FROM
scan_drbd_volumes
WHERE
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
@ -3300,7 +3297,6 @@ SELECT
scan_drbd_peer_fencing
FROM
scan_drbd_peers
WHERE
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
@ -5100,6 +5096,7 @@ FROM
$anvil->data->{lvm}{host_name}{$short_host_name}{lv}{$scan_lvm_lv_name}{scan_lvm_lv_size} = $scan_lvm_lv_size;
$anvil->data->{lvm}{host_name}{$short_host_name}{lv}{$scan_lvm_lv_name}{scan_lvm_lv_path} = $scan_lvm_lv_path;
$anvil->data->{lvm}{host_name}{$short_host_name}{lv}{$scan_lvm_lv_name}{scan_lvm_lv_on_pvs} = $scan_lvm_lv_on_pvs;
$anvil->data->{lvm}{host_name}{$short_host_name}{lv_path}{$scan_lvm_lv_path}{scan_lvm_lv_name} = $scan_lvm_lv_name;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"lvm::host_name::${short_host_name}::lv::${scan_lvm_lv_name}::scan_lvm_lv_uuid" => $anvil->data->{lvm}{host_name}{$short_host_name}{lv}{$scan_lvm_lv_name}{scan_lvm_lv_uuid},
"lvm::host_name::${short_host_name}::lv::${scan_lvm_lv_name}::scan_lvm_lv_internal_uuid" => $anvil->data->{lvm}{host_name}{$short_host_name}{lv}{$scan_lvm_lv_name}{scan_lvm_lv_internal_uuid},
@ -5108,6 +5105,7 @@ FROM
"lvm::host_name::${short_host_name}::lv::${scan_lvm_lv_name}::scan_lvm_lv_size" => $anvil->data->{lvm}{host_name}{$short_host_name}{lv}{$scan_lvm_lv_name}{scan_lvm_lv_size}." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{lvm}{host_name}{$short_host_name}{lv}{$scan_lvm_lv_name}{scan_lvm_lv_size}}).")",
"lvm::host_name::${short_host_name}::lv::${scan_lvm_lv_name}::scan_lvm_lv_path" => $anvil->data->{lvm}{host_name}{$short_host_name}{lv}{$scan_lvm_lv_name}{scan_lvm_lv_path},
"lvm::host_name::${short_host_name}::lv::${scan_lvm_lv_name}::scan_lvm_lv_on_pvs" => $anvil->data->{lvm}{host_name}{$short_host_name}{lv}{$scan_lvm_lv_name}{scan_lvm_lv_on_pvs},
"lvm::host_name::${short_host_name}::lv_path::${scan_lvm_lv_path}::scan_lvm_lv_name" => $anvil->data->{lvm}{host_name}{$short_host_name}{lv_path}{$scan_lvm_lv_path}{scan_lvm_lv_name},
}});
}

@ -140,6 +140,9 @@ sub load_storage
# Load LVM and Storage Group data
$anvil->Database->get_lvm_data({debug => 2});
# Load DRBD data from the database.
$anvil->Database->get_drbd_data({debug => 2});
# Load DRBD resource data so that we can map DRBD resources / volumes to volume groups.
my $drbd_resource = "";
foreach my $device_path (sort {$a cmp $b} keys %{$anvil->data->{server}{$short_host_name}{$server_name}{device}})
@ -601,20 +604,28 @@ sub show_server_details
my $on_lv = $anvil->data->{server}{$short_host_name}{$server_name}{device}{$device_path}{on_lv};
my $drbd_resource = $anvil->data->{server}{$short_host_name}{$server_name}{device}{$device_path}{resource};
my $drbd_volume = $anvil->data->{lvm}{host_name}{$short_host_name}{lv_path}{$on_lv}{drbd}{volume};
my $volume_size = $anvil->data->{lvm}{host_name}{$short_host_name}{lv_path}{$on_lv}{drbd}{volume};
my $resource_size = $anvil->data->{drbd}{host_name}{$short_host_name}{resource_name}{$drbd_resource}{volume}{$drbd_volume}{volume_size};
my $lv_name = $anvil->data->{lvm}{host_name}{$short_host_name}{lv_path}{$on_lv}{scan_lvm_lv_name};
my $lv_size = $anvil->data->{lvm}{host_name}{$short_host_name}{lv}{$lv_name}{scan_lvm_lv_size};
my $metadata_size = $lv_size - $resource_size;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:address_domain' => $address_domain,
's2:address_slot' => $address_slot,
's3:address_function' => $address_function,
's4:device_path' => $device_path,
's5:driver_io' => $driver_io,
's6:driver_cache' => $driver_cache,
's7:on_lv' => $on_lv,
's8:drbd_resource' => $drbd_resource,
's9:drbd_volume' => $drbd_volume,
's01:address_domain' => $address_domain,
's02:address_slot' => $address_slot,
's03:address_function' => $address_function,
's04:device_path' => $device_path,
's05:driver_io' => $driver_io,
's06:driver_cache' => $driver_cache,
's07:on_lv' => $on_lv,
's08:lv_name' => $lv_name,
's09:drbd_resource' => $drbd_resource,
's10:drbd_volume' => $drbd_volume,
's11:resource_size' => $anvil->Convert->bytes_to_human_readable({'bytes' => $resource_size})." (".$anvil->Convert->add_commas({number => $resource_size}).")",
's12:lv_size' => $anvil->Convert->bytes_to_human_readable({'bytes' => $lv_size})."] (".$anvil->Convert->add_commas({number => $lv_size}).")",
's13:metadata_size' => $anvil->Convert->bytes_to_human_readable({'bytes' => $metadata_size})."] (".$anvil->Convert->add_commas({number => $metadata_size}).")",
}});
print "- Target: [".$device_target."], boot: [".$say_boot."], replication resource: [".$drbd_resource."/".$drbd_volume."], size: [".$anvil->Convert->bytes_to_human_readable({'bytes' => $volume_size})."] (".$anvil->Convert->add_commas({number => $volume_size})." Bytes)\n";
print " - Replcation path: [".$device_path."], backed by: [".$on_lv."], cache: [".$driver_cache."]\n";
print "- Target: [".$device_target."], boot: [".$say_boot."], Replication Volume: [".$drbd_resource."/".$drbd_volume."]\n";
print " - Resource / LV / Metadata sizes: [".$anvil->Convert->bytes_to_human_readable({'bytes' => $resource_size})." / ".$anvil->Convert->bytes_to_human_readable({'bytes' => $lv_size})." / ".$anvil->Convert->bytes_to_human_readable({'bytes' => $metadata_size})."], cache: [".$driver_cache."], IO Policy: [".$driver_io."]\n";
# Get the backing LV from the DRBD resource.

Loading…
Cancel
Save