|
|
@ -174,6 +174,7 @@ sub auto_grow_pv |
|
|
|
# Get the raw backing disk. |
|
|
|
# Get the raw backing disk. |
|
|
|
my $device_path = ""; |
|
|
|
my $device_path = ""; |
|
|
|
my $pv_partition = 0; |
|
|
|
my $pv_partition = 0; |
|
|
|
|
|
|
|
my $software_raid = 0; |
|
|
|
if ($pv_name =~ /(\/dev\/nvme\d+n\d+)p(\d+)$/) |
|
|
|
if ($pv_name =~ /(\/dev\/nvme\d+n\d+)p(\d+)$/) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$device_path = $1; |
|
|
|
$device_path = $1; |
|
|
@ -192,6 +193,16 @@ sub auto_grow_pv |
|
|
|
pv_partition => $pv_partition, |
|
|
|
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 |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
# No device found for the PV. |
|
|
|
# No device found for the PV. |
|
|
@ -244,6 +255,7 @@ sub auto_grow_pv |
|
|
|
free_space => $anvil->Convert->bytes_to_human_readable({'bytes' => $size}), |
|
|
|
free_space => $anvil->Convert->bytes_to_human_readable({'bytes' => $size}), |
|
|
|
device_path => $device_path, |
|
|
|
device_path => $device_path, |
|
|
|
pv_partition => $pv_partition, |
|
|
|
pv_partition => $pv_partition, |
|
|
|
|
|
|
|
software_raid => $software_raid, |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
next; |
|
|
|
next; |
|
|
|
} |
|
|
|
} |
|
|
@ -254,10 +266,14 @@ sub auto_grow_pv |
|
|
|
free_space => $anvil->Convert->bytes_to_human_readable({'bytes' => $size}), |
|
|
|
free_space => $anvil->Convert->bytes_to_human_readable({'bytes' => $size}), |
|
|
|
device_path => $device_path, |
|
|
|
device_path => $device_path, |
|
|
|
pv_partition => $pv_partition, |
|
|
|
pv_partition => $pv_partition, |
|
|
|
|
|
|
|
software_raid => $software_raid, |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
|
|
|
|
|
|
|
|
### Backup the partition table. |
|
|
|
### Backup the partition table. |
|
|
|
#sfdisk --dump /dev/sda > partition_table_backup_sda |
|
|
|
#sfdisk --dump /dev/sda > partition_table_backup_sda |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### Detect software raid devices and handle accordingly |
|
|
|
|
|
|
|
# |
|
|
|
my $device_name = ($device_path =~ /^\/dev\/(.*)$/)[0]; |
|
|
|
my $device_name = ($device_path =~ /^\/dev\/(.*)$/)[0]; |
|
|
|
my $partition_backup = "/tmp/".$device_name.".partition_table_backup"; |
|
|
|
my $partition_backup = "/tmp/".$device_name.".partition_table_backup"; |
|
|
|
my $shell_call = $anvil->data->{path}{exe}{sfdisk}." --dump ".$device_path." > ".$partition_backup; |
|
|
|
my $shell_call = $anvil->data->{path}{exe}{sfdisk}." --dump ".$device_path." > ".$partition_backup; |
|
|
|