Add boolean and high level procedure comments

feature/softwareraid
Mike Holloway 6 months ago
parent ab79237240
commit 97ddb5dd01
  1. 28
      Anvil/Tools/Storage.pm

@ -174,6 +174,7 @@ sub auto_grow_pv
# Get the raw backing disk.
my $device_path = "";
my $pv_partition = 0;
my $software_raid = 0;
if ($pv_name =~ /(\/dev\/nvme\d+n\d+)p(\d+)$/)
{
$device_path = $1;
@ -192,6 +193,16 @@ sub auto_grow_pv
pv_partition => $pv_partition,
}});
}
elsif ($pv_name =~ /\/dev\/md(\d+)$/)
{
$device_path = $1;
$software_raid = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
device_path => $device_path,
software_raid => $software_raid,
pv_partition => $pv_partition,
}});
}
else
{
# No device found for the PV.
@ -241,9 +252,10 @@ sub auto_grow_pv
{
# Not enough free space
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "log_0823", variables => {
free_space => $anvil->Convert->bytes_to_human_readable({'bytes' => $size}),
device_path => $device_path,
pv_partition => $pv_partition,
free_space => $anvil->Convert->bytes_to_human_readable({'bytes' => $size}),
device_path => $device_path,
pv_partition => $pv_partition,
software_raid => $software_raid,
}});
next;
}
@ -251,13 +263,17 @@ sub auto_grow_pv
{
# Enough free space, grow!
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "log_0822", variables => {
free_space => $anvil->Convert->bytes_to_human_readable({'bytes' => $size}),
device_path => $device_path,
pv_partition => $pv_partition,
free_space => $anvil->Convert->bytes_to_human_readable({'bytes' => $size}),
device_path => $device_path,
pv_partition => $pv_partition,
software_raid => $software_raid,
}});
### Backup the partition table.
#sfdisk --dump /dev/sda > partition_table_backup_sda
#### Detect software raid devices and handle accordingly
#
my $device_name = ($device_path =~ /^\/dev\/(.*)$/)[0];
my $partition_backup = "/tmp/".$device_name.".partition_table_backup";
my $shell_call = $anvil->data->{path}{exe}{sfdisk}." --dump ".$device_path." > ".$partition_backup;

Loading…
Cancel
Save