Updated anvil-manage-dr to change --list to --show for consistency

* Updated anvil-manage-dr to handle DR hosts without a VG in a given SG
* Fixed up minor display issues in anvil-manage-storage-groups

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent 9590bf3260
commit 1e376fc06b
  1. 12
      man/anvil-manage-dr.8
  2. 1
      share/words.xml
  3. 37
      tools/anvil-manage-dr
  4. 12
      tools/anvil-manage-storage-groups

@ -39,20 +39,17 @@ This is the path to the license file, needed when setting up "long-throw" DR for
\fB\-\-link\fR
This takes an --anvil and a --dr-host to enable using the DR host as a target for the Anvil! node.
.TP
\fB\-\-list\fR
This will show the list of available Anvil! nodes, DR hosts and servers.
.TP
\fB\-\-protect\fR
The sets up the server to be imaged on DR, if it isn't already protected.
.TP
Notes: If the server is not running, the DRBD resource volume(s) will be brought up. Both nodes need to be online and in the cluster.
.TP
\fB\-\-protocol\fR <sync,async,long-throw>, default 'async'
This allows the protocol used to replicate data to the DR host to be configured. By default, 'async' is used.
\fB\-\-protocol\fR <sync,short-throw,long-throw>, default 'short-throw'
This allows the protocol used to replicate data to the DR host to be configured. By default, 'short-throw' is used.
.br
Modes:
.br
async (default)
short-throw (default)
This tells the storage layer to consider the write to be completed once the data is on the active node's network transmit buffer. In this way, the DR host is allowed to fall behind a small amount, but the active nodes will not slow down because of higher network transit times to the DR location.
.br
@ -85,6 +82,9 @@ long-throw
\fB\-\-remove\fB
This removes the DR image from the DR host for the server, freeing up space on DR but removing the protection afforded by DR.
.TP
\fB\-\-show\fR
This will show the list of available Anvil! nodes, DR hosts and servers.
.TP
\fB\-\-server\fB <server name or uuid> (required)
This is the name or UUID of the server being worked on.
.TP

@ -736,6 +736,7 @@ The XML that failed sanity check was:
<key name="error_0465"><![CDATA[The file: [#!variable!file!#] doesn't exist on the target: [#!variable!target!#].]]></key>
<key name="error_0466"><![CDATA[The Anvil! string (name or UUID): [#!variable!string!#] didn't match any known Anvil! in the database.]]></key>
<key name="error_0467"><![CDATA[[ Error ] - The repartition attemp failed! Reloading the partition table now!]]]></key>
<key name="error_0468">We need: [#!variable!space_needed!# (#!variable!space_needed_bytes!# Bytes)] from the storage group: [#!variable!storage_group!#], but the requested DR host does not appear to have a volume group in this storage group. Hint, please use 'anvil-manage-storage-groups' to resolve. Unable to proceed.</key>
<!-- Files templates -->
<!-- NOTE: Translating these files requires an understanding of which lines are translatable -->

@ -42,11 +42,11 @@ $anvil->Get->switches({list => [
"job-uuid",
"license-file",
"link",
"list",
"protect",
"protocol",
"remove",
"server",
"show",
"unlink",
"update",
"Yes"], man => $THIS_FILE});
@ -2485,20 +2485,15 @@ sub process_protect
# Is there enough space on DR?
my $space_on_dr = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{host_uuid}{$dr_host_uuid}{vg_free};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
space_on_dr => $anvil->Convert->add_commas({number => $space_on_dr})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $space_on_dr}).")",
space_needed => $anvil->Convert->add_commas({number => $space_needed})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $space_needed}).")",
}});
if ($space_needed > $space_on_dr)
if ((not defined $space_on_dr) or ($space_on_dr !~ /^\d+$/))
{
# The DR host doesn't have a VG in the SG.
my $variables = {
space_needed => $anvil->Convert->bytes_to_human_readable({'bytes' => $space_needed}),
space_needed_bytes => $anvil->Convert->add_commas({number => $space_needed}),
storage_group => $storage_group_name,
space_on_dr => $anvil->Convert->bytes_to_human_readable({'bytes' => $space_on_dr}),
space_on_dr_bytes => $anvil->Convert->add_commas({number => $space_on_dr}),
};
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "error_0344", variables => $variables});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "error_0468", variables => $variables});
$anvil->Job->update_progress({
progress => 100,
message => "error_0344",
@ -2506,6 +2501,30 @@ sub process_protect
});
$problem = 1;
}
else
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
space_on_dr => $anvil->Convert->add_commas({number => $space_on_dr})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $space_on_dr}).")",
space_needed => $anvil->Convert->add_commas({number => $space_needed})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $space_needed}).")",
}});
if ($space_needed > $space_on_dr)
{
my $variables = {
space_needed => $anvil->Convert->bytes_to_human_readable({'bytes' => $space_needed}),
space_needed_bytes => $anvil->Convert->add_commas({number => $space_needed}),
storage_group => $storage_group_name,
space_on_dr => $anvil->Convert->bytes_to_human_readable({'bytes' => $space_on_dr}),
space_on_dr_bytes => $anvil->Convert->add_commas({number => $space_on_dr}),
};
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "error_0344", variables => $variables});
$anvil->Job->update_progress({
progress => 100,
message => "error_0344",
variables => $variables
});
$problem = 1;
}
}
}
if ($problem)
{

@ -376,6 +376,7 @@ sub manage_group_member
storage_group_member_note => "user-created",
});
print "Added the volume group: [".$lvm_vg_name."] on the host: [".$short_host_name."] to the storage group: [".$storage_group_name."]. The new member UUID is: [".$storage_group_member_uuid."].\n";
$anvil->nice_exit({exit_code => 0});
}
else
{
@ -404,6 +405,7 @@ sub manage_group_member
storage_group_member_note => "DELETED",
});
print "Added the volume group: [".$lvm_vg_name."] on the host: [".$short_host_name."] has been removed from storage group: [".$storage_group_name."].\n";
$anvil->nice_exit({exit_code => 0});
}
return(0);
@ -427,11 +429,11 @@ sub show_data
next;
}
print "Anvil: [".$anvil_name."] - ".$anvil_description."\n";
print "Anvil Node: [".$anvil_name."] - ".$anvil_description."\n";
foreach my $node_host_uuid ($anvil_node1_host_uuid, $anvil_node2_host_uuid)
{
my $node_host_name = $anvil->data->{hosts}{host_uuid}{$node_host_uuid}{short_host_name};
print "- Node: [".$node_host_name."] volume groups;\n";
print "- Subnode: [".$node_host_name."] volume groups;\n";
foreach my $scan_lvm_vg_name (sort {$a cmp $b} keys %{$anvil->data->{vgs}{host_uuid}{$node_host_uuid}{scan_lvm_vg_name}})
{
my $scan_lvm_vg_internal_uuid = $anvil->data->{vgs}{host_uuid}{$node_host_uuid}{scan_lvm_vg_name}{$scan_lvm_vg_name}{scan_lvm_vg_internal_uuid};
@ -439,7 +441,7 @@ sub show_data
my $scan_lvm_vg_free = $anvil->data->{vgs}{host_uuid}{$node_host_uuid}{scan_lvm_vg_internal_uuid}{$scan_lvm_vg_internal_uuid}{scan_lvm_vg_free};
my $say_size_hr = $anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_size});
my $say_free_hr = $anvil->Convert->bytes_to_human_readable({'bytes' => $scan_lvm_vg_free});
print " ^- [".$scan_lvm_vg_name."], size: [".$say_size_hr."], free: [".$say_free_hr."], internal UUID: [".$scan_lvm_vg_internal_uuid."]\n";
print " - [".$scan_lvm_vg_name."], size: [".$say_size_hr."], free: [".$say_free_hr."], internal UUID: [".$scan_lvm_vg_internal_uuid."]\n";
}
}
foreach my $storage_group_name (sort {$a cmp $b} keys %{$anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_name}})
@ -452,7 +454,7 @@ sub show_data
my $storage_group_member_uuid = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{host_uuid}{$member_host_uuid}{storage_group_member_uuid};
my $vg_internal_uuid = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{host_uuid}{$member_host_uuid}{vg_internal_uuid};
my $vg_name = $anvil->data->{vgs}{host_uuid}{$member_host_uuid}{scan_lvm_vg_internal_uuid}{$vg_internal_uuid}{scan_lvm_vg_name};
print " ^- [".$member_short_host_name."]:[".$vg_name."]\n";
print " - [".$member_short_host_name."]:[".$vg_name."]\n";
}
}
@ -482,7 +484,7 @@ sub show_data
my $vg_free = $anvil->data->{vgs}{host_uuid}{$host_uuid}{scan_lvm_vg_internal_uuid}{$vg_internal_uuid}{scan_lvm_vg_free};
my $say_size_hr = $anvil->Convert->bytes_to_human_readable({'bytes' => $vg_size});
my $say_free_hr = $anvil->Convert->bytes_to_human_readable({'bytes' => $vg_free});
print " ^- [".$vg_name."], size: [".$say_size_hr."], free: [".$say_free_hr."], internal UUID: [".$vg_internal_uuid."]\n";
print " - [".$vg_name."], size: [".$say_size_hr."], free: [".$say_free_hr."], internal UUID: [".$vg_internal_uuid."]\n";
}
}
print "\n";

Loading…
Cancel
Save