Skip to content

Commit

Permalink
Patch Commands.pm
Browse files Browse the repository at this point in the history
  • Loading branch information
donovank authored and Thomas Lange committed Jul 12, 2019
1 parent 87ecbb7 commit 2542653
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions lib/setup-storage/Commands.pm
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ sub build_btrfs_commands {
}
}

my %mkfs_done;

foreach my $config (keys %FAI::configs) { # loop through all configs
next unless ($config eq "BTRFS");

Expand Down Expand Up @@ -365,16 +367,23 @@ sub build_btrfs_commands {
$pre_req = "exist_" . $devs[0];
}
# creates the BTRFS volume/RAID
if ($raidlevel eq 'single') {
&FAI::push_command("mkfs.btrfs -d single $createopts ". join(" ",@devs),
"$pre_req",
"btrfs_built_raid_$id");

} else {
&FAI::push_command("mkfs.btrfs -d raid$raidlevel $createopts ". join(" ",@devs),
"$pre_req",
"btrfs_built_raid_$id");
}
if ($raidlevel eq 'single') {
if (exists $mkfs_done{join(" ", @devs)}) {
&FAI::push_command("true",
"$pre_req",
"btrfs_built_raid_$id");
} else {
print "Adding mkfs command for '", join(", ", @devs), "'.\n";
&FAI::push_command("mkfs.btrfs -d single $createopts ".join(" ",@devs),
"$pre_req",
"btrfs_built_raid_$id");
$mkfs_done{join(" ", @devs)} = '1';
}
} else {
&FAI::push_command("mkfs.btrfs -d raid$raidlevel $createopts ".join(" ",@devs),
"$pre_req",
"btrfs_built_raid_$id");
}

# initial mount, required to create the initial subvolume
&FAI::push_command("mount $devs[0] /mnt",
Expand Down

0 comments on commit 2542653

Please sign in to comment.