Skip to content

Commit

Permalink
get raid/lvm information and build them only if the disk config uses
Browse files Browse the repository at this point in the history
raid/lvm, Closes: #845428
  • Loading branch information
Thomas Lange committed Dec 26, 2016
1 parent 74d2345 commit 08649bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/setup-storage
Expand Up @@ -164,10 +164,10 @@ defined($FAI::udev_settle) or die "Failed to find determine a proper way to tell
&FAI::get_current_disks;

# see whether there are any existing LVMs
&FAI::in_path("pvdisplay") and &FAI::get_current_lvm;
$FAI::uses_lvm and &FAI::in_path("pvdisplay") and &FAI::get_current_lvm;

# see whether there are any existing RAID devices
&FAI::in_path("mdadm") and &FAI::get_current_raid;
$FAI::uses_raid and &FAI::in_path("mdadm") and &FAI::get_current_raid;

# mark devices as preserve, where not all already done so and check that only
# defined devices are marked preserve
Expand Down Expand Up @@ -214,9 +214,9 @@ $FAI::debug and print Dumper \%FAI::dev_children;
# generate the command script
&FAI::get_parted_version;
&FAI::build_disk_commands;
&FAI::build_raid_commands;
$FAI::uses_raid and &FAI::build_raid_commands;
&FAI::build_btrfs_commands;
&FAI::build_lvm_commands;
$FAI::uses_lvm and &FAI::build_lvm_commands;
&FAI::build_cryptsetup_commands;
&FAI::order_commands;

Expand Down
2 changes: 2 additions & 0 deletions lib/setup-storage/Init.pm
Expand Up @@ -123,13 +123,15 @@ $ENV{flag_initial} and $FAI::reinstall = 0;
#
################################################################################
%FAI::current_lvm_config = ();
$FAI::uses_lvm = 0;

################################################################################
#
# @brief The current RAID configuration
#
################################################################################
%FAI::current_raid_config = ();
$FAI::uses_raid = 0;

################################################################################
#
Expand Down
2 changes: 2 additions & 0 deletions lib/setup-storage/Parser.pm
Expand Up @@ -444,6 +444,7 @@ $FAI::Parser = Parse::RecDescent->new(
{
# check, whether raid tools are available
&FAI::in_path("mdadm") or die "mdadm not found in PATH\n";
$FAI::uses_raid = 1;
$FAI::device = "RAID";
$FAI::configs{$FAI::device}{fstabkey} = "device";
$FAI::configs{$FAI::device}{opts_all} = {};
Expand Down Expand Up @@ -474,6 +475,7 @@ $FAI::Parser = Parse::RecDescent->new(
&FAI::in_path("lvcreate") or die "LVM tools not found in PATH\n";
# initialise $FAI::device to inform the following lines about the LVM
# being configured
$FAI::uses_lvm = 1;
$FAI::device = "VG_";
$FAI::configs{"VG_--ANY--"}{fstabkey} = "device";
$FAI::configs{"VG_--ANY--"}{opts_all} = {};
Expand Down

0 comments on commit 08649bc

Please sign in to comment.