* Deleted some old unused code from Cluster->assemble_storage_groups().

Signed-off-by: digimer <mkelly@alteeve.ca>
This commit is contained in:
digimer 2023-07-25 19:30:53 -04:00
parent ed480cf1cb
commit a0ff080741

View File

@ -632,125 +632,6 @@ ORDER BY
# Now loop through any attached DRs and add the VGs that are closest in sizes to the VGs we have in # Now loop through any attached DRs and add the VGs that are closest in sizes to the VGs we have in
# this Anvil! node. # this Anvil! node.
$anvil->Database->get_dr_links({debug => 2}); $anvil->Database->get_dr_links({debug => 2});
# This was going to automatically add VGs from DR hosts to an Anvil's Storage Group, but given now
# that things can be linked in random ways, this doesn't seem to make sense anymore. So the code is
# (not complete but) preserved here in case we change out mind later.
=cut
foreach my $dr_link_host_name (sort {$a cmp $b} keys %{$anvil->data->{dr_links}{by_anvil_uuid}{$anvil_uuid}{dr_link_host_name}})
{
my $dr_link_uuid = $anvil->data->{dr_links}{by_anvil_uuid}{$anvil_uuid}{dr_link_host_name}{$dr_link_host_name}{dr_link_uuid};
my $dr_link_host_uuid = $anvil->Database->get_host_uuid_from_string({debug => $debug, string => $dr_link_host_name});
my $dr_link_short_host_name = $anvil->data->{hosts}{host_uuid}{$dr_link_host_uuid}{short_host_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:dr_link_host_name' => $dr_link_host_name,
's2:dr_link_host_uuid' => $dr_link_host_uuid,
's3:dr_link_short_host_name' => $dr_link_short_host_name,
's4:dr_link_uuid' => $dr_link_uuid,
}});
# What VGs do these DR hosts have, and are they in any storage groups yet?
my $query = "
SELECT
scan_lvm_vg_uuid,
scan_lvm_vg_name,
scan_lvm_vg_size,
scan_lvm_vg_internal_uuid
FROM
scan_lvm_vgs
WHERE
scan_lvm_vg_host_uuid = ".$anvil->Database->quote($dr_link_uuid)."
AND
scan_lvm_vg_name != 'DELETED'
ORDER BY
scan_lvm_vg_size ASC
;";
$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,
}});
foreach my $row (@{$results})
{
my $scan_lvm_vg_uuid = $row->[0];
my $scan_lvm_vg_name = $row->[1];
my $scan_lvm_vg_size = $row->[2];
my $scan_lvm_vg_internal_uuid = $row->[3];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:scan_lvm_vg_uuid' => $scan_lvm_vg_uuid,
's2:scan_lvm_vg_name' => $scan_lvm_vg_name,
's3:scan_lvm_vg_size' => $scan_lvm_vg_size." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_size}).")",
's4:scan_lvm_vg_internal_uuid' => $scan_lvm_vg_internal_uuid,
}});
# Is this VG already in a storage group for this anvil! node?
my $vg_found = 0;
foreach my $storage_group_uuid (keys %{$anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}})
{
my $storage_group_name = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{group_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:storage_group_uuid' => $storage_group_uuid,
's2:storage_group_name' => $storage_group_name,
}});
foreach my $this_host_uuid (sort {$a cmp $b} keys %{$anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{short_host_name}})
{
next if $this_host_uuid eq $dr_link_host_uuid;
my $storage_group_member_note = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{host_uuid}{$this_host_uuid}{storage_group_member_note};
my $storage_group_member_vg_uuid = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{host_uuid}{$this_host_uuid}{vg_internal_uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:this_host_uuid' => $this_host_uuid,
's2:storage_group_member_vg_uuid' => $storage_group_member_vg_uuid,
's3:storage_group_member_note' => $storage_group_member_note,
}});
next if $storage_group_member_note eq "DELETED";
if ($storage_group_member_vg_uuid eq $scan_lvm_vg_internal_uuid)
{
$vg_found = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { vg_found => $vg_found }});
}
}
}
if (not $vg_found)
{
# Find the smallest
my $query = "
SELECT
scan_lvm_vg_uuid,
scan_lvm_vg_name,
scan_lvm_vg_size,
scan_lvm_vg_internal_uuid
FROM
scan_lvm_vgs
WHERE
scan_lvm_vg_host_uuid = ".$anvil->Database->quote($dr_link_uuid)."
AND
scan_lvm_vg_name != 'DELETED'
ORDER BY
scan_lvm_vg_size ASC
;";
$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,
}});
foreach my $row (@{$results})
{
my $scan_lvm_vg_uuid = $row->[0];
my $scan_lvm_vg_name = $row->[1];
my $scan_lvm_vg_size = $row->[2];
my $scan_lvm_vg_internal_uuid = $row->[3];
}
}
}
}
=cut
return(0); return(0);
} }