Fixed bugs related to adding drives and extending drives to servers.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent e895e1f264
commit 2f429d2bc7
  1. 12
      man/anvil-manage-server-storage.8
  2. 6
      share/words.xml
  3. 48
      tools/anvil-manage-server-storage

@ -26,7 +26,9 @@ Set the log level to 1, 2 or 3 respectively. Be aware that level 3 generates a s
\fB\-\-add\fR <size or percent>
This is used to add a new disk to a server. Specifically, it adds a second volume to the replicated storage under the server, which appears as a second disk inside the server. Writes to this and existing disks are ordered during replication, including during short or long throw DR.
.TP
The size can be in percent, ie: '50%' or '100%', a number in bytes, or a human-readable size. Human readable sizes must NOT have a space between the number and letter suffix. Also, base2 vs base10 notation! Ie: '1GiB' = 1,073,741,824 bytes', '1GB' == '1,000,000,000 bytes'. A single letter used to denote size will be interpreted as base2. ie: '1G == 1GiB'.
The size can be in percent, ie: '50%' or '100%', a number in bytes, or a human-readable size. Human readable sizes must NOT have a space between the number and letter suffix.
.TP
Also, base2 vs base10 notation! Ie: '1GiB' = 1,073,741,824 bytes', '1GB' = '1,000,000,000 bytes'. A single letter used to denote size will be interpreted as base2. ie: '1G' is the same as '1GiB'.
.TP
\fB\-\-anvil\fR <name|uuid>
This is the Anvil! node name or UUID to be used. If not specified, the Anvil! the command or job runs on will be used.
@ -34,7 +36,7 @@ This is the Anvil! node name or UUID to be used. If not specified, the Anvil! th
\fB\-\-confirm\fR
Using this prevents the prompts to confirm given actions. When using \fB\-\-job\-uuid\fR, this is ignored as all commands are considered confirmed.
.TP
\fB\-\-disk\fR <device
\fB\-\-disk\fR <device, ie: sda, vdb>
This is the disk being worked on. For optical disks, it's the drive that an optical disc (ISO) is being inserted into or ejected from. For disks, it's the disk being added, grown or deleted.
.TP
When not specified, if only one disk exists, it will be chosen automatically.
@ -48,7 +50,9 @@ This is the jobs -> job_uuid to execute. Generally this is only used by other pr
\fB\-\-grow\fR <size or percent>
This is used to grow an existing disk by the specified amount. The drive to grow is specified using \fB\-\-disk\fR.
.TP
The size can be in percent, ie: '50%' or '100%', a number in bytes, or a human-readable size. Human readable sizes must NOT have a space between the number and letter suffix. Also, base2 vs base10 notation! Ie: '1GiB' = 1,073,741,824 bytes', '1GB' == '1,000,000,000 bytes'. A single letter used to denote size will be interpreted as base2. ie: '1G == 1GiB'.
The size can be in percent, ie: '50%' or '100%', a number in bytes, or a human-readable size. Human readable sizes must NOT have a space between the number and letter suffix.
.TP
Also, base2 vs base10 notation! Ie: '1GiB' = 1,073,741,824 bytes', '1GB' = '1,000,000,000 bytes'. A single letter used to denote size will be interpreted as base2. ie: '1G' is the same as '1GiB'.
.TP
\fB\-\-insert\fR </path/to/file.iso>
This inserts the optical disc (ISO) into the drive specified by \fB\-\-optical\fR.
@ -59,7 +63,7 @@ This is the device, ie: 'sda', to insert the optical disc (ISO file) into or to
\fB\-\-server\fR <name or uuid>
This is the server being worked on. If this switch is used alone, then the current state of the storage of the server is displayed, as well as the details of the Storage Groups the server is or can use.
.TP
\fB\-\-storage\-group\fR <name of uuid>
\fB\-\-storage\-group\fR <name or uuid>
If there are two or more Storage Groups exist, and you're adding a disk, this allows you to specify which storage group to use for the new disk.
.IP
.SH AUTHOR

@ -716,7 +716,7 @@ The extension of the resource is incomplete, manual intervention is required!!
==========
The creation of the new replicatedd disk is incomplete, manual intervention is required!]]></key>
<key name="error_0461"><![CDATA[ Error!
[ Failed ] - When trying to create the peer: [#!variable!short_host_name!#]'s logical volume: [#!variable!backing_disk!#]
[ Failed ] - When trying to create the peer: [#!variable!host_name!#]'s logical volume: [#!variable!backing_disk!#]
[ Failed ] - using the command: [#!variable!shell_call!#]
[ Failed ] - The return code: [#!variable!return_code!#] was received, expected '0'. Output, if any:
==] STDOUT [========
@ -2542,7 +2542,7 @@ The file: [#!variable!file!#] needs to be updated. The difference is:
<key name="log_0757">- Writing out the updated DRBD config file.</key>
<key name="log_0758"> - Creating the meta-data on the new local volume: [#!variable!next_drbd_volume!#]...</key>
<key name="log_0759"> - Creating the meta-data on the peer: [#!variable!host_name!#:#!variable!drbd_resource!#/#!variable!next_drbd_volume!#], via: [#!variable!use_ip!# (#!variable!use_network!#)]</key>
<key name="log_0760">- Registered a job with job UUID: [#!variable!job_uuid!#] to reload the resource config on the host: [#!variable!short_host_name!#].</key>
<key name="log_0760">- Registered a job with job UUID: [#!variable!job_uuid!#] to reload the resource config on the host: [#!variable!host_name!#].</key>
<key name="log_0761">- Adjusting the local resource: [#!variable!drbd_resource!#] to pick up the new config.
[ NOTE ] - If this hangs, make sure 'anvil-daemon' is running on the peers.</key>
<key name="log_0762">- Waiting for all peers to connect the new volume...</key>
@ -3136,6 +3136,8 @@ Proceed? [y/N]</key>
<key name="message_0345">^- Server: [#!variable!server_name!#], UUID: [#!variable!server_uuid!#]</key>
<key name="message_0346">Available Disc Images (ISOs):</key>
<key name="message_0347">- #!variable!file_name!#, (#!variable!file_size!#, md5sum: #!variable!md5sum!#)</key>
<key name="message_0348">Available Storage Groups;</key>
<key name="message_0349">- #!variable!storage_group_name!#, free space: #!variable!free_space!#, UUID: #!variable!storage_group_uuid!#</key>
<!-- Translate names (protocols, etc) -->
<key name="name_0001">Normal Password</key> <!-- none in mail-server -->

@ -17,6 +17,7 @@
# - anvil-manage-server-storage --server srv01-fs37 --optical sda --eject
# - Disk
# - anvil-manage-server-storage --server srv01-fs37 --disk vdb --grow {+10GiB,150GiB}
# - anvil-manage-server-storage --server srv01-fs37 --disk vdb --grow {+10GiB,150GiB}
#
use strict;
@ -97,7 +98,7 @@ if (($anvil->data->{switches}{optical}) or ($anvil->data->{switches}{eject}))
{
manage_optical($anvil);
}
elsif ($anvil->data->{switches}{disk})
elsif (($anvil->data->{switches}{disk}) or ($anvil->data->{switches}{add}))
{
manage_disk($anvil);
}
@ -176,7 +177,7 @@ sub manage_disk
}});
if (not $anvil->data->{switches}{disk})
{
# If there's only one optical drive, select it automatically
# If there's only one disk drive, select it automatically
my $count = keys %{$anvil->data->{server}{$short_host_name}{$server_name}{$from_source}{device}{disk}{target}};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { count => $count }});
if ($count == 1)
@ -380,7 +381,7 @@ sub manage_disk_add
if (not $anvil->data->{switches}{'storage-group'})
{
print $anvil->Words->string({key => 'warning_0159'})."\n";
short_storage_groups($anvil, $anvil_uuid);
show_storage_groups($anvil);
$anvil->nice_exit({exit_code => 1});
}
@ -574,7 +575,7 @@ sub manage_disk_add
}
# Still alive? Ask the user to confirm.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, priority => "err", key => "error_0428", variables => {
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, key => "message_0333", variables => {
new_device_target => $new_device_target,
hr_size => $hr_size,
disk_device_bus => $disk_device_bus,
@ -691,7 +692,7 @@ sub manage_disk_add
host_name => $short_host_name,
backing_disk => $backing_disk,
use_ip => $use_ip,
network => $use_network,
use_network => $use_network,
}});
my ($output, $error, $return_code) = $anvil->Remote->call({
shell_call => $shell_call,
@ -952,7 +953,7 @@ sub manage_disk_add
drbd_resource => $drbd_resource,
next_drbd_volume => $next_drbd_volume,
use_ip => $use_ip,
network => $use_network,
use_network => $use_network,
}});
my ($output, $error, $return_code) = $anvil->Remote->call({
shell_call => $shell_call,
@ -3082,3 +3083,38 @@ sub show_files
return(0);
}
sub show_storage_groups
{
my ($anvil) = @_;
my $server_name = $anvil->data->{switches}{server_name};
my $server_uuid = $anvil->data->{switches}{server_uuid};
my $anvil_uuid = $anvil->data->{servers}{server_uuid}{$server_uuid}{server_anvil_uuid};
my $anvil_name = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:server_name' => $server_name,
's2:server_uuid' => $server_uuid,
's3:anvil_uuid' => $anvil_uuid,
's4:anvil_name' => $anvil_name,
}});
print $anvil->Words->string({key => 'message_0348'})."\n";
foreach my $storage_group_name (sort {$a cmp $b} keys %{$anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_name}})
{
my $storage_group_uuid = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_name}{$storage_group_name}{storage_group_uuid};
my $free_space = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_uuid}{$storage_group_uuid}{free_space};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:storage_group_name' => $storage_group_name,
's2:storage_group_uuid' => $storage_group_uuid,
's3:free_space' => $free_space." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $free_space}).")",
}});
print $anvil->Words->string({key => 'message_0349', variables => {
storage_group_name => $storage_group_name,
storage_group_uuid => $storage_group_uuid,
free_space => $anvil->Convert->bytes_to_human_readable({'bytes' => $free_space}),
}})."\n";
}
return(0);
}

Loading…
Cancel
Save