* Fixed a bug in Database->get_storage_group_data() that was deleting DR host storage group members.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 2 years ago
parent 8ff40ec42c
commit 41fb8baeda
  1. 7
      Anvil/Tools/Database.pm
  2. 44
      Anvil/Tools/Get.pm

@ -6012,12 +6012,14 @@ WHERE
my $internal_vg_uuid = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{host_uuid}{$this_host_uuid}{vg_internal_uuid}; my $internal_vg_uuid = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{host_uuid}{$this_host_uuid}{vg_internal_uuid};
my $vg_size = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{host_uuid}{$this_host_uuid}{vg_size}; my $vg_size = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{host_uuid}{$this_host_uuid}{vg_size};
my $vg_name = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{host_uuid}{$this_host_uuid}{vg_name}; my $vg_name = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{host_uuid}{$this_host_uuid}{vg_name};
my $host_type = $anvil->data->{hosts}{host_uuid}{$this_host_uuid}{host_type};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
this_host_uuid => $this_host_uuid, this_host_uuid => $this_host_uuid,
storage_group_member_uuid => $storage_group_member_uuid, storage_group_member_uuid => $storage_group_member_uuid,
internal_vg_uuid => $internal_vg_uuid, internal_vg_uuid => $internal_vg_uuid,
vg_size => $anvil->Convert->add_commas({number => $vg_size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $vg_size}).")", vg_size => $anvil->Convert->add_commas({number => $vg_size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $vg_size}).")",
vg_name => $vg_name, vg_name => $vg_name,
host_type => $host_type,
}}); }});
if ($vg_size > $size_to_match) if ($vg_size > $size_to_match)
@ -6038,9 +6040,10 @@ WHERE
$node2_seen = 1; $node2_seen = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { node2_seen => $node2_seen }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { node2_seen => $node2_seen }});
} }
else elsif ($host_type eq "node")
{ {
# This host doesn't belong in this group anymore. Delete it. # This host is a node that isn't in the Anvil!, so it doesn't belong
# in this group anymore. Delete it.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "warning_0130", variables => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "warning_0130", variables => {
storage_group_name => $group_name, storage_group_name => $group_name,
host_name => $anvil->Get->host_name_from_uuid({host_uuid => $this_host_uuid}), host_name => $anvil->Get->host_name_from_uuid({host_uuid => $this_host_uuid}),

@ -511,45 +511,20 @@ sub available_resources
delete $anvil->data->{anvil_resources}{$anvil_uuid}; delete $anvil->data->{anvil_resources}{$anvil_uuid};
} }
# Get the node UUIDs for this anvil. # Load hosts and network bridges. This loads Anvil! data as well
my $query = " $anvil->Database->get_hosts({debug => $debug});
SELECT $anvil->Database->get_bridges({debug => $debug});
anvil_name,
anvil_node1_host_uuid,
anvil_node2_host_uuid
FROM
anvils
WHERE
anvil_uuid = ".$anvil->Database->quote($anvil_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results,
count => $count,
}});
if (not $count)
{
# Not found.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0169", variables => { anvil_uuid => $anvil_uuid }});
return("!!error!!");
}
# Get the details. # Get the details.
my $anvil_name = $results->[0]->[0]; my $anvil_name = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_name};
my $node1_host_uuid = $results->[0]->[1]; my $node1_host_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node1_host_uuid};
my $node2_host_uuid = $results->[0]->[2]; my $node2_host_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node2_host_uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
anvil_name => $anvil_name, anvil_name => $anvil_name,
node1_host_uuid => $node1_host_uuid, node1_host_uuid => $node1_host_uuid,
node2_host_uuid => $node2_host_uuid, node2_host_uuid => $node2_host_uuid,
}}); }});
# Load hosts and network bridges
$anvil->Database->get_hosts({debug => $debug});
$anvil->Database->get_bridges({debug => $debug});
# This both loads storage group data and assembles ungrouped VGs into storage groups, when possible. # This both loads storage group data and assembles ungrouped VGs into storage groups, when possible.
$anvil->Cluster->assemble_storage_groups({ $anvil->Cluster->assemble_storage_groups({
debug => $debug, debug => $debug,
@ -560,7 +535,6 @@ WHERE
$anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{cores} = 0; $anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{cores} = 0;
$anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads} = 0; $anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads} = 0;
$anvil->data->{anvil_resources}{$anvil_uuid}{ram}{hardware} = 0; $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{hardware} = 0;
foreach my $host_uuid ($node1_host_uuid, $node2_host_uuid) foreach my $host_uuid ($node1_host_uuid, $node2_host_uuid)
{ {
my $this_is = "node1"; my $this_is = "node1";
@ -682,7 +656,7 @@ WHERE
$anvil->data->{anvil_resources}{$anvil_uuid}{ram}{allocated} = 0; $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{allocated} = 0;
$anvil->data->{anvil_resources}{$anvil_uuid}{ram}{hardware} = $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{available}; $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{hardware} = $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{available};
$query = " my $query = "
SELECT SELECT
server_name, server_name,
server_ram_in_use server_ram_in_use
@ -693,8 +667,8 @@ WHERE
ORDER BY ORDER BY
server_name ASC;"; server_name ASC;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__}); my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
$count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
count => $count, count => $count,

Loading…
Cancel
Save