(resend as I previously forgot to include the mailing list ...)
Post by Stoiko IvanovHonoring hdsize for ZFS setups introduced the possibility to use differently
sized disks for a mirror-setup, by restricting hdsize to the smallest disk.
---
proxinstall | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
diff --git a/proxinstall b/proxinstall
index 159c727..5f83d3f 100755
--- a/proxinstall
+++ b/proxinstall
@@ -2791,10 +2791,15 @@ my $get_raid_devlist = sub {
};
sub zfs_mirror_size_check {
- die "mirrored disks must have same size\n"
- if abs($expected - $actual) > $expected / 10;
+ if (defined($restricted_size_gb)) {
+ die "bootdisks must have at least hdsize: $restricted_size_gb GB\n"
+ if ($actual < ($restricted_size_gb * 1024 * 1024 * 2)); #$actual is in 512b
I'd rather not have this in a post if, but a "normal" one. also the comment could
be something like # $actual is in multiple of 512 bytes
and are you sure the calculation is correct? It could be nicer to get both sizes to
the same "standard" unit, i.e., KiB in this case not 512b, e.g.:
if ($actual * 2 < ($restricted_size_gb * 1024 * 1024)) {
Post by Stoiko Ivanov+ } else {
+ die "mirrored disks must have same size\n"
+ if abs($expected - $actual) > $expected / 10;
+ }
}
sub get_zfs_raid_setup {
@@ -2817,10 +2822,7 @@ sub get_zfs_raid_setup {
} elsif ($filesys eq 'zfs (RAID1)') {
die "zfs (RAID1) needs at least 2 device\n" if $diskcount < 2;
$cmd .= ' mirror ';
}
@@ -2828,9 +2830,12 @@ sub get_zfs_raid_setup {
die "zfs (RAID10) needs at least 4 device\n" if $diskcount < 4;
die "zfs (RAID10) needs an even number of devices\n" if $diskcount & 1;
you can use perl array slices for this, increases expressiveness, IMO:
my ($hd1, $hd2) = $devlist->[0,1];
obviously not tested and your call
Post by Stoiko Ivanov- for (my $i = 0; $i < $diskcount; $i+=2) {
+ # first 2 (boot) disks get checked separately
+ for (my $i = 2; $i < $diskcount; $i+=2) {
you redefine $hd1 and $hd2 here, maybe just reuse above ones? I'd like to avoid
such things, if not necessary, they tend to complicate things and introduce harder
to understand behaviour.
Post by Stoiko Ivanov@@ -2841,11 +2846,8 @@ sub get_zfs_raid_setup {
my $level = $1;
my $mindisks = 2 + $level;
$cmd .= " raidz$level";
maybe also a comment here that all idsks are boot disks and thus all get checked below?
looks OK, besides above, albeit I still need to think a bit about all possible
combinations ^^
Post by Stoiko Ivanov}
@@ -2853,6 +2855,15 @@ sub get_zfs_raid_setup {
die "unknown zfs mode '$filesys'\n";
}
+ #bootdisks honor hdsize setting if present
+ my $restricted_size_gb = $config_options->{hdsize};
+
+ }
+
return ($devlist, $bootdevlist, $cmd);
}
Honoring hdsize for ZFS setups introduced the possibility to use differently
sized disks for a mirror-setup, by restricting hdsize to the smallest disk.
---
proxinstall | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
diff --git a/proxinstall b/proxinstall
index 159c727..5f83d3f 100755
--- a/proxinstall
+++ b/proxinstall
@@ -2791,10 +2791,15 @@ my $get_raid_devlist = sub {
};
sub zfs_mirror_size_check {
- die "mirrored disks must have same size\n"
- if abs($expected - $actual) > $expected / 10;
+ if (defined($restricted_size_gb)) {
+ die "bootdisks must have at least hdsize: $restricted_size_gb GB\n"
+ if ($actual < ($restricted_size_gb * 1024 * 1024 * 2)); #$actual is in 512b
I'd rather not have this in a post if, but a "normal" one. also the comment could
be something like # $actual is in multiple of 512 bytes
and are you sure the calculation is correct? It could be nicer to get both sizes to
the same "standard" unit, i.e., KiB in this case not 512b, e.g.:
if ($actual * 2 < ($restricted_size_gb * 1024 * 1024)) {
Post by Stoiko Ivanov+ } else {
+ die "mirrored disks must have same size\n"
+ if abs($expected - $actual) > $expected / 10;
+ }
}
sub get_zfs_raid_setup {
@@ -2817,10 +2822,7 @@ sub get_zfs_raid_setup {
} elsif ($filesys eq 'zfs (RAID1)') {
die "zfs (RAID1) needs at least 2 device\n" if $diskcount < 2;
$cmd .= ' mirror ';
}
@@ -2828,9 +2830,12 @@ sub get_zfs_raid_setup {
die "zfs (RAID10) needs at least 4 device\n" if $diskcount < 4;
die "zfs (RAID10) needs an even number of devices\n" if $diskcount & 1;
you can use perl array slices for this, increases expressiveness, IMO:
my ($hd1, $hd2) = $devlist->[0,1];
obviously not tested and your call
Post by Stoiko Ivanov- for (my $i = 0; $i < $diskcount; $i+=2) {
+ # first 2 (boot) disks get checked separately
+ for (my $i = 2; $i < $diskcount; $i+=2) {
you redefine $hd1 and $hd2 here, maybe just reuse above ones? I'd like to avoid
such things, if not necessary, they tend to complicate things and introduce harder
to understand behaviour.
Post by Stoiko Ivanov@@ -2841,11 +2846,8 @@ sub get_zfs_raid_setup {
my $level = $1;
my $mindisks = 2 + $level;
$cmd .= " raidz$level";
maybe also a comment here that all idsks are boot disks and thus all get checked below?
looks OK, besides above, albeit I still need to think a bit about all possible
combinations ^^
Post by Stoiko Ivanov}
@@ -2853,6 +2855,15 @@ sub get_zfs_raid_setup {
die "unknown zfs mode '$filesys'\n";
}
+ #bootdisks honor hdsize setting if present
+ my $restricted_size_gb = $config_options->{hdsize};
+
+ }
+
return ($devlist, $bootdevlist, $cmd);
}