fix #5071: zfs over iscsi: add 'zfs-base-path' configuration option

Use '/dev/zvol' as a base path for new storages for providers 'iet'
and 'LIO', because that is what modern distributions use.

This is a breaking change regarding the addition of new storages on
older distributions, but it's enough to specify the base path '/dev'
explicitly for setups that require it.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Link: https://lore.proxmox.com/20250605111109.52712-1-f.ebner@proxmox.com
This commit is contained in:
Fiona Ebner
2025-06-05 13:11:08 +02:00
committed by Thomas Lamprecht
parent 7ecab87144
commit d181d0b1ee
5 changed files with 46 additions and 11 deletions

View File

@ -32,7 +32,8 @@ my $get_lun_cmd_map = sub {
};
sub get_base {
return '/dev/zvol/rdsk';
my ($scfg) = @_;
return $scfg->{'zfs-base-path'} || '/dev/zvol/rdsk';
}
sub run_lun_command {

View File

@ -138,7 +138,7 @@ my $parser = sub {
my $line = 0;
my $base = get_base;
my $base = get_base($scfg);
my $config = $get_config->($scfg);
my @cfgfile = split "\n", $config;
@ -482,7 +482,8 @@ sub run_lun_command {
}
sub get_base {
return '/dev';
my ($scfg) = @_;
return $scfg->{'zfs-base-path'} || '/dev';
}
1;

View File

@ -306,7 +306,7 @@ my $parser = sub {
$CONFIG =~ s/\n$//;
die "$scfg->{target}: Target not found" unless $SETTINGS->{targets};
my $max = $SETTINGS->{targets};
my $base = get_base;
my $base = get_base($scfg);
for (my $i = 1; $i <= $max; $i++) {
my $target = $SETTINGS->{nodebase} . ':' . $SETTINGS->{"LogicalUnit$i"}->{TargetName};
@ -612,7 +612,8 @@ sub run_lun_command {
}
sub get_base {
return '/dev/zvol';
my ($scfg) = @_;
return $scfg->{'zfs-base-path'} || '/dev/zvol';
}
1;

View File

@ -231,7 +231,7 @@ my $extract_volname = sub {
my ($scfg, $lunpath) = @_;
my $volname = undef;
my $base = get_base;
my $base = get_base($scfg);
if ($lunpath =~ /^$base\/$scfg->{pool}\/([\w\-]+)$/) {
$volname = $1;
my $prefix = $get_backstore_prefix->($scfg);
@ -422,7 +422,8 @@ sub run_lun_command {
}
sub get_base {
return '/dev';
my ($scfg) = @_;
return $scfg->{'zfs-base-path'} || '/dev';
}
1;