* Fixed a bug in DRBD->get_devices() where old test host UUIDs were left hard-coded.

* Fixed a duplicate header in words.xml
* Fixed display bugs in anvil-report-usage and removed the old DR host display info.

Signed-off-by: digimer <digimer@gravitar.alteeve.com>
main
digimer 2 years ago
parent 65a483273e
commit a5cee52153
  1. 4
      Anvil/Tools/DRBD.pm
  2. 2
      share/words.xml
  3. 56
      tools/anvil-report-usage

@ -1396,9 +1396,9 @@ SELECT
FROM FROM
scan_drbd scan_drbd
WHERE WHERE
scan_drbd_host_uuid = '618e8007-3a0b-4bbf-a616-a64fd7d2dc30' scan_drbd_host_uuid = ".$anvil->Database->quote($node1_host_uuid)."
OR OR
scan_drbd_host_uuid = '75070e21-a0e3-4ba5-b4f7-476bf5d08107' scan_drbd_host_uuid = ".$anvil->Database->quote($node2_host_uuid)."
ORDER BY modified_date DESC ORDER BY modified_date DESC
LIMIT 1 LIMIT 1
;"; ;";

@ -961,7 +961,7 @@ resource #!variable!server!# {
<key name="header_0075">RAM Used</key> <key name="header_0075">RAM Used</key>
<key name="header_0076">RAM Free</key> <key name="header_0076">RAM Free</key>
<key name="header_0077">Bridges</key> <key name="header_0077">Bridges</key>
<key name="header_0078">Storage Group</key> <key name="header_0078">#!free!#</key>
<key name="header_0079">Used</key> <key name="header_0079">Used</key>
<key name="header_0080">Free</key> <key name="header_0080">Free</key>
<key name="header_0081">Anvil! Node</key> <key name="header_0081">Anvil! Node</key>

@ -73,12 +73,10 @@ sub collect_anvil_data
$anvil->data->{anvil_data}{$anvil_name}{description} = $anvil->data->{anvils}{anvil_name}{$anvil_name}{anvil_description}; $anvil->data->{anvil_data}{$anvil_name}{description} = $anvil->data->{anvils}{anvil_name}{$anvil_name}{anvil_description};
$anvil->data->{anvil_data}{$anvil_name}{node1_host_uuid} = $anvil->data->{anvils}{anvil_name}{$anvil_name}{anvil_node1_host_uuid}; $anvil->data->{anvil_data}{$anvil_name}{node1_host_uuid} = $anvil->data->{anvils}{anvil_name}{$anvil_name}{anvil_node1_host_uuid};
$anvil->data->{anvil_data}{$anvil_name}{node2_host_uuid} = $anvil->data->{anvils}{anvil_name}{$anvil_name}{anvil_node2_host_uuid}; $anvil->data->{anvil_data}{$anvil_name}{node2_host_uuid} = $anvil->data->{anvils}{anvil_name}{$anvil_name}{anvil_node2_host_uuid};
$anvil->data->{anvil_data}{$anvil_name}{dr1_host_uuid} = $anvil->data->{anvils}{anvil_name}{$anvil_name}{anvil_dr1_host_uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"s1:anvil_data::${anvil_name}::anvil_description" => $anvil->data->{anvil_data}{$anvil_name}{description}, "s1:anvil_data::${anvil_name}::anvil_description" => $anvil->data->{anvil_data}{$anvil_name}{description},
"s2:anvil_data::${anvil_name}::node1_host_uuid" => $anvil->data->{anvil_data}{$anvil_name}{node1_host_uuid}, "s2:anvil_data::${anvil_name}::node1_host_uuid" => $anvil->data->{anvil_data}{$anvil_name}{node1_host_uuid},
"s3:anvil_data::${anvil_name}::node2_host_uuid" => $anvil->data->{anvil_data}{$anvil_name}{node2_host_uuid}, "s3:anvil_data::${anvil_name}::node2_host_uuid" => $anvil->data->{anvil_data}{$anvil_name}{node2_host_uuid},
"s4:anvil_data::${anvil_name}::dr1_host_uuid" => $anvil->data->{anvil_data}{$anvil_name}{dr1_host_uuid},
}}); }});
if (length($anvil_name) > $anvil->data->{longest}{anvil_name}) if (length($anvil_name) > $anvil->data->{longest}{anvil_name})
@ -99,34 +97,22 @@ sub collect_anvil_data
my $node1_host_uuid = $anvil->data->{anvil_data}{$anvil_name}{node1_host_uuid}; my $node1_host_uuid = $anvil->data->{anvil_data}{$anvil_name}{node1_host_uuid};
my $node2_host_uuid = $anvil->data->{anvil_data}{$anvil_name}{node2_host_uuid}; my $node2_host_uuid = $anvil->data->{anvil_data}{$anvil_name}{node2_host_uuid};
my $dr1_host_uuid = $anvil->data->{anvil_data}{$anvil_name}{dr1_host_uuid};
if ($anvil->data->{switches}{detailed}) if ($anvil->data->{switches}{detailed})
{ {
$anvil->data->{anvil_data}{$anvil_name}{node1_host_name} = $anvil->data->{hosts}{host_uuid}{$node1_host_uuid}{host_name}; $anvil->data->{anvil_data}{$anvil_name}{node1_host_name} = $anvil->data->{hosts}{host_uuid}{$node1_host_uuid}{host_name};
$anvil->data->{anvil_data}{$anvil_name}{node2_host_name} = $anvil->data->{hosts}{host_uuid}{$node2_host_uuid}{host_name}; $anvil->data->{anvil_data}{$anvil_name}{node2_host_name} = $anvil->data->{hosts}{host_uuid}{$node2_host_uuid}{host_name};
$anvil->data->{anvil_data}{$anvil_name}{dr1_host_name} = "";
if ($dr1_host_uuid)
{
$anvil->data->{anvil_data}{$anvil_name}{dr1_host_name} = $anvil->data->{hosts}{host_uuid}{$dr1_host_uuid}{host_name};
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"s1:anvil_data::${anvil_name}::node1_host_name" => $anvil->data->{anvil_data}{$anvil_name}{node1_host_name}, "s1:anvil_data::${anvil_name}::node1_host_name" => $anvil->data->{anvil_data}{$anvil_name}{node1_host_name},
"s2:anvil_data::${anvil_name}::node2_host_name" => $anvil->data->{anvil_data}{$anvil_name}{node2_host_name}, "s2:anvil_data::${anvil_name}::node2_host_name" => $anvil->data->{anvil_data}{$anvil_name}{node2_host_name},
"s3:anvil_data::${anvil_name}::dr1_host_name" => $anvil->data->{anvil_data}{$anvil_name}{dr1_host_name},
}}); }});
} }
else else
{ {
$anvil->data->{anvil_data}{$anvil_name}{node1_host_name} = $anvil->data->{hosts}{host_uuid}{$node1_host_uuid}{short_host_name}; $anvil->data->{anvil_data}{$anvil_name}{node1_host_name} = $anvil->data->{hosts}{host_uuid}{$node1_host_uuid}{short_host_name};
$anvil->data->{anvil_data}{$anvil_name}{node2_host_name} = $anvil->data->{hosts}{host_uuid}{$node2_host_uuid}{short_host_name}; $anvil->data->{anvil_data}{$anvil_name}{node2_host_name} = $anvil->data->{hosts}{host_uuid}{$node2_host_uuid}{short_host_name};
if ($dr1_host_uuid)
{
$anvil->data->{anvil_data}{$anvil_name}{dr1_host_name} = $anvil->data->{hosts}{host_uuid}{$dr1_host_uuid}{short_host_name};
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"s1:anvil_data::${anvil_name}::node1_host_name" => $anvil->data->{anvil_data}{$anvil_name}{node1_host_name}, "s1:anvil_data::${anvil_name}::node1_host_name" => $anvil->data->{anvil_data}{$anvil_name}{node1_host_name},
"s2:anvil_data::${anvil_name}::node2_host_name" => $anvil->data->{anvil_data}{$anvil_name}{node2_host_name}, "s2:anvil_data::${anvil_name}::node2_host_name" => $anvil->data->{anvil_data}{$anvil_name}{node2_host_name},
"s3:anvil_data::${anvil_name}::dr1_host_name" => $anvil->data->{anvil_data}{$anvil_name}{dr1_host_name},
}}); }});
} }
@ -202,18 +188,12 @@ sub collect_anvil_data
my $vg_size = $anvil->data->{anvil_resources}{$anvil_uuid}{storage_group}{$storage_group_uuid}{vg_size}; my $vg_size = $anvil->data->{anvil_resources}{$anvil_uuid}{storage_group}{$storage_group_uuid}{vg_size};
my $free_size = $anvil->data->{anvil_resources}{$anvil_uuid}{storage_group}{$storage_group_uuid}{free_size}; my $free_size = $anvil->data->{anvil_resources}{$anvil_uuid}{storage_group}{$storage_group_uuid}{free_size};
my $sg_used = $vg_size - $free_size; my $sg_used = $vg_size - $free_size;
my $vg_size_on_dr = $anvil->data->{anvil_resources}{$anvil_uuid}{storage_group}{$storage_group_uuid}{vg_size_on_dr};
my $free_size_on_dr = $anvil->data->{anvil_resources}{$anvil_uuid}{storage_group}{$storage_group_uuid}{available_on_dr};
my $sg_used_on_dr = $vg_size_on_dr - $free_size_on_dr;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:storage_group_name' => $storage_group_name, 's1:storage_group_name' => $storage_group_name,
's2:storage_group_uuid' => $storage_group_uuid, 's2:storage_group_uuid' => $storage_group_uuid,
's3:vg_size' => $anvil->Convert->add_commas({number => $vg_size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $vg_size}).")", 's3:vg_size' => $anvil->Convert->add_commas({number => $vg_size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $vg_size}).")",
's4:free_size' => $anvil->Convert->add_commas({number => $free_size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $free_size}).")", 's4:free_size' => $anvil->Convert->add_commas({number => $free_size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $free_size}).")",
's5:sg_used' => $anvil->Convert->add_commas({number => $sg_used})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $sg_used}).")", 's5:sg_used' => $anvil->Convert->add_commas({number => $sg_used})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $sg_used}).")",
's6:vg_size_on_dr' => $anvil->Convert->add_commas({number => $vg_size_on_dr})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $vg_size_on_dr}).")",
's7:free_size_on_dr' => $anvil->Convert->add_commas({number => $free_size_on_dr})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $free_size_on_dr}).")",
's8:sg_used_on_dr' => $anvil->Convert->add_commas({number => $sg_used_on_dr})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $sg_used_on_dr}).")",
}}); }});
$anvil->data->{anvil_data}{$anvil_name}{storage_group}{$storage_group_name}{say_used_size} = $anvil->Convert->bytes_to_human_readable({'bytes' => $sg_used}); $anvil->data->{anvil_data}{$anvil_name}{storage_group}{$storage_group_name}{say_used_size} = $anvil->Convert->bytes_to_human_readable({'bytes' => $sg_used});
@ -266,7 +246,7 @@ sub show_anvils
my $longest_ram_free = length($ram_free_header) > $anvil->data->{longest}{ram_free} ? length($ram_free_header) : $anvil->data->{longest}{ram_free}; my $longest_ram_free = length($ram_free_header) > $anvil->data->{longest}{ram_free} ? length($ram_free_header) : $anvil->data->{longest}{ram_free};
my $bridge_header = $anvil->Words->string({key => "header_0077"}); my $bridge_header = $anvil->Words->string({key => "header_0077"});
my $longest_bridge_string = length($bridge_header) > $anvil->data->{longest}{bridge_string} ? length($bridge_header) : $anvil->data->{longest}{bridge_string}; my $longest_bridge_string = length($bridge_header) > $anvil->data->{longest}{bridge_string} ? length($bridge_header) : $anvil->data->{longest}{bridge_string};
my $storage_group_header = $anvil->Words->string({key => "header_0078"}); my $storage_group_header = $anvil->Words->string({key => "header_0070"});
my $longest_storage_group = length($storage_group_header) > $anvil->data->{longest}{storage_group} ? length($storage_group_header) : $anvil->data->{longest}{storage_group}; my $longest_storage_group = length($storage_group_header) > $anvil->data->{longest}{storage_group} ? length($storage_group_header) : $anvil->data->{longest}{storage_group};
my $sg_used_header = $anvil->Words->string({key => "header_0079"}); my $sg_used_header = $anvil->Words->string({key => "header_0079"});
my $longest_sg_used = length($sg_used_header) > $anvil->data->{longest}{sg_used} ? length($sg_used_header) : $anvil->data->{longest}{sg_used}; my $longest_sg_used = length($sg_used_header) > $anvil->data->{longest}{sg_used} ? length($sg_used_header) : $anvil->data->{longest}{sg_used};
@ -287,37 +267,37 @@ sub show_anvils
# Anvil! # Anvil!
my $break_line = "+-".sprintf("%0${longest_anvil_name}d", 0); my $break_line = "+-".sprintf("%0${longest_anvil_name}d", 0);
my $header_line = "| ".sprintf("%-${longest_anvil_name}s", $anvil_header)." "; my $header_line = "| ".sprintf("%-${longest_anvil_name}s", $anvil_header)." ";
my $blank_lead = "| ".sprintf("%-${longest_anvil_name}s", $anvil_header)." "; my $blank_lead = "| ".sprintf("%-${longest_anvil_name}s", "")." ";
if ($anvil->data->{switches}{detailed}) if ($anvil->data->{switches}{detailed})
{ {
# Description # Description
$break_line .= "-+-".sprintf("%0${longest_description}d", 0); $break_line .= "-+-".sprintf("%0${longest_description}d", 0);
$header_line .= "| ".sprintf("%-${longest_description}s", $description_header)." "; $header_line .= "| ".sprintf("%-${longest_description}s", $description_header)." ";
$blank_lead .= " ".sprintf("%-${longest_description}s", $description_header)." "; $blank_lead .= "| ".sprintf("%-${longest_description}s", "")." ";
} }
# CPU String # CPU String
$break_line .= "-+-".sprintf("%0${longest_cpu_string}d", 0); $break_line .= "-+-".sprintf("%0${longest_cpu_string}d", 0);
$header_line .= "| ".sprintf("%-${longest_cpu_string}s", $cpu_header)." "; $header_line .= "| ".sprintf("%-${longest_cpu_string}s", $cpu_header)." ";
$blank_lead .= " ".sprintf("%-${longest_cpu_string}s", $cpu_header)." "; $blank_lead .= "| ".sprintf("%-${longest_cpu_string}s", "")." ";
if ($anvil->data->{switches}{detailed}) if ($anvil->data->{switches}{detailed})
{ {
# RAM used # RAM used
$break_line .= "-+-".sprintf("%0${longest_ram_used}d", 0); $break_line .= "-+-".sprintf("%0${longest_ram_used}d", 0);
$header_line .= "| ".sprintf("%-${longest_ram_used}s", $ram_used_header)." "; $header_line .= "| ".sprintf("%-${longest_ram_used}s", $ram_used_header)." ";
$blank_lead .= " ".sprintf("%-${longest_ram_used}s", $ram_used_header)." "; $blank_lead .= "| ".sprintf("%-${longest_ram_used}s", "")." ";
} }
# RAM Free # RAM Free
$break_line .= "-+-".sprintf("%0${longest_ram_free}d", 0); $break_line .= "-+-".sprintf("%0${longest_ram_free}d", 0);
$header_line .= "| ".sprintf("%-${longest_ram_free}s", $ram_free_header)." "; $header_line .= "| ".sprintf("%-${longest_ram_free}s", $ram_free_header)." ";
$blank_lead .= " ".sprintf("%-${longest_ram_free}s", $ram_free_header)." "; $blank_lead .= "| ".sprintf("%-${longest_ram_free}s", "")." ";
# Bridges # Bridges
$break_line .= "-+-".sprintf("%0${longest_bridge_string}d", 0); $break_line .= "-+-".sprintf("%0${longest_bridge_string}d", 0);
$header_line .= "| ".sprintf("%-${longest_bridge_string}s", $bridge_header)." "; $header_line .= "| ".sprintf("%-${longest_bridge_string}s", $bridge_header)." ";
$blank_lead .= " ".sprintf("%-${longest_bridge_string}s", $bridge_header)." "; $blank_lead .= "| ".sprintf("%-${longest_bridge_string}s", "");
# Storage Group # Storage Group
$break_line .= "-+-".sprintf("%0${longest_storage_group}d", 0); $break_line .= "-+-".sprintf("%0${longest_storage_group}d", 0);
@ -379,7 +359,8 @@ sub show_anvils
$storage_line .= " | ".sprintf("%-${longest_sg_used}s", $say_used_size); $storage_line .= " | ".sprintf("%-${longest_sg_used}s", $say_used_size);
} }
$storage_line .= " | ".sprintf("%-${longest_sg_free}s", $say_free_size)." |"; $storage_line .= " | ".sprintf("%-${longest_sg_free}s", $say_free_size)." |";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { storage_line => $storage_line }});
push @{$storage_groups}, $storage_line; push @{$storage_groups}, $storage_line;
} }
@ -741,27 +722,17 @@ sub collect_server_data
# have a matching node name. # have a matching node name.
my $node1_host_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node1_host_uuid}; my $node1_host_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node1_host_uuid};
my $node2_host_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node2_host_uuid}; my $node2_host_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node2_host_uuid};
my $dr1_host_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_dr1_host_uuid};
# Get names. # Get names.
my $node1_host_name = $anvil->data->{hosts}{host_uuid}{$node1_host_uuid}{host_name}; my $node1_host_name = $anvil->data->{hosts}{host_uuid}{$node1_host_uuid}{host_name};
my $node1_short_host_name = $anvil->data->{hosts}{host_uuid}{$node1_host_uuid}{short_host_name}; my $node1_short_host_name = $anvil->data->{hosts}{host_uuid}{$node1_host_uuid}{short_host_name};
my $node2_host_name = $anvil->data->{hosts}{host_uuid}{$node2_host_uuid}{host_name}; my $node2_host_name = $anvil->data->{hosts}{host_uuid}{$node2_host_uuid}{host_name};
my $node2_short_host_name = $anvil->data->{hosts}{host_uuid}{$node2_host_uuid}{short_host_name}; my $node2_short_host_name = $anvil->data->{hosts}{host_uuid}{$node2_host_uuid}{short_host_name};
my $dr1_host_name = "";
my $dr1_short_host_name = "";
if (($dr1_host_uuid) && (exists $anvil->data->{hosts}{host_uuid}{$dr1_host_uuid}))
{
$dr1_host_name = $anvil->data->{hosts}{host_uuid}{$dr1_host_uuid}{host_name};
$dr1_short_host_name = $anvil->data->{hosts}{host_uuid}{$dr1_host_uuid}{short_host_name};
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:node1_host_name' => $node1_host_name, 's1:node1_host_name' => $node1_host_name,
's2:node1_short_host_name' => $node1_short_host_name, 's2:node1_short_host_name' => $node1_short_host_name,
's3:node2_host_name' => $node2_host_name, 's3:node2_host_name' => $node2_host_name,
's4:node2_short_host_name' => $node2_short_host_name, 's4:node2_short_host_name' => $node2_short_host_name,
's5:dr1_host_name' => $dr1_host_name,
's6:dr1_short_host_name' => $dr1_short_host_name,
}}); }});
# Storage info. # Storage info.
@ -806,9 +777,7 @@ sub collect_server_data
if (($drbd_node eq $node1_host_name) or if (($drbd_node eq $node1_host_name) or
($drbd_node eq $node1_short_host_name) or ($drbd_node eq $node1_short_host_name) or
($drbd_node eq $node2_host_name) or ($drbd_node eq $node2_host_name) or
($drbd_node eq $node2_short_host_name) or ($drbd_node eq $node2_short_host_name))
(($dr1_host_name) && ($drbd_node eq $dr1_host_name)) or
(($dr1_short_host_name) && ($drbd_node eq $dr1_short_host_name)))
{ {
$anvil->data->{server_data}{$server_name}{server_uuid}{$server_uuid}{disk}{$resource}{$volume}{node}{$drbd_node}{drbd_path} = $anvil->data->{drbd}{drbd_node}{$drbd_node}{config}{resource}{$resource}{volume}{$volume}{drbd_path}; $anvil->data->{server_data}{$server_name}{server_uuid}{$server_uuid}{disk}{$resource}{$volume}{node}{$drbd_node}{drbd_path} = $anvil->data->{drbd}{drbd_node}{$drbd_node}{config}{resource}{$resource}{volume}{$volume}{drbd_path};
$anvil->data->{server_data}{$server_name}{server_uuid}{$server_uuid}{disk}{$resource}{$volume}{node}{$drbd_node}{drbd_path_by_res} = $anvil->data->{drbd}{drbd_node}{$drbd_node}{config}{resource}{$resource}{volume}{$volume}{drbd_path_by_res}; $anvil->data->{server_data}{$server_name}{server_uuid}{$server_uuid}{disk}{$resource}{$volume}{node}{$drbd_node}{drbd_path_by_res} = $anvil->data->{drbd}{drbd_node}{$drbd_node}{config}{resource}{$resource}{volume}{$volume}{drbd_path_by_res};
@ -835,11 +804,6 @@ sub collect_server_data
$node_host_uuid = $node2_host_uuid; $node_host_uuid = $node2_host_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { node_host_uuid => $node_host_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { node_host_uuid => $node_host_uuid }});
} }
elsif (($drbd_node eq $dr1_host_name) or ($drbd_node eq $dr1_short_host_name))
{
$node_host_uuid = $dr1_host_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { node_host_uuid => $node_host_uuid }});
}
# How big is this LV? # How big is this LV?
my $backing_lv = $anvil->data->{server_data}{$server_name}{server_uuid}{$server_uuid}{disk}{$resource}{$volume}{node}{$drbd_node}{backing_lv}; my $backing_lv = $anvil->data->{server_data}{$server_name}{server_uuid}{$server_uuid}{disk}{$resource}{$volume}{node}{$drbd_node}{backing_lv};

Loading…
Cancel
Save