* [PATCH pve-stoage 3/4] iscsiPlugin: add wwid
[not found] <f53ca227-2275-443f-84f8-48b2785269b2.2bc2ceb6-a3a3-4c49-9566-519c7d2ab20e.6280bc33-152c-4cc8-b1f7-ae5c6d73e0f3@emailsignatures365.codetwo.com>
@ 2026-04-23 15:14 ` Felix Drießler
0 siblings, 0 replies; 4+ messages in thread
From: Felix Drießler @ 2026-04-23 15:14 UTC (permalink / raw)
To: pve-devel
From: Felix Driessler <fdriessler@inett.de>
Signed-off-by: Felix Driessler <fdriessler@inett.de>
---
src/PVE/Storage/ISCSIPlugin.pm | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin.pm
index 30f4178..bb5576b 100644
--- a/src/PVE/Storage/ISCSIPlugin.pm
+++ b/src/PVE/Storage/ISCSIPlugin.pm
@@ -305,13 +305,21 @@ sub iscsi_device_list {
my $volid = "$channel.$id.$lun.$blockdev";
+ my $wwid = '';
+ my $dev = "/dev/$bdev";
+ $dev =~ m|^(/dev/[A-Za-z0-9_\-./]+)$|
+ or die "Invalid device path";
+ $dev = $1;
+ run_command(['/lib/udev/scsi_id', '-g', '-u', '-d', $dev], outfunc => sub { $wwid .= "$_[0]" });
+
$res->{$target}->{$volid} = {
'format' => 'raw',
'size' => int($size * 512),
'vmid' => 0, # not assigned to any vm
'channel' => int($channel),
'id' => int($id),
'lun' => int($lun),
+ 'wwid' => $wwid,
};
#print "TEST: $target $session $host,$bus,$tg,$lun $blockdev\n";
--
2.52.0
Felix Driessler
Junior Systems Engineer // #GernPerDU
Linux - Open Source - IT Solutions
T: +49-681-410993-0
E: fdriessler@inett.de
https://www.inett.de
inett GmbH | Altenkesseler Strasse 17 / B8 | 66115 Saarbrücken | Germany
Vertrieb: vertrieb@inett.de // +49-681-410993-33
Support: support@inett.de // +49-681-410993-42
Geschäftsführung: Marco Gabriel | Amtsgericht Saarbrücken HRB 16588
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH pve-stoage 3/4] iscsiPlugin: add wwid
2026-04-23 13:06 ` Daniel Kral
@ 2026-04-23 15:21 ` Felix Driessler - inett GmbH
0 siblings, 0 replies; 4+ messages in thread
From: Felix Driessler - inett GmbH @ 2026-04-23 15:21 UTC (permalink / raw)
To: Daniel Kral, pve-devel
> Aligning the indentation of the other existing properties should be done
> in a separate patch before this.
> Though our `make tidy` target will revert this back to the previous
> formatting.
> nit: add a , at the end of the new property
I've sent patch #3 again with these 2 fixed.
I missed reverting the automatic style changes from my IDE it seems.
> Only a suggestion and haven't tested this extensively yet: Since this
> code block already enumerates the iSCSI devices through the relevant
> sysfs, we can also fetch the wwid with:
I originally made use of this exact method but then swapped to using this CLI tool,
as, at least in my test environment, the WWID would be shown as 3600*, rather than naa.600*.
I would have opted for a regex replace, but wasn't sure if naa., t10. and eui.
are the only prefixes, or if there are more.
If the prefix, rather than its ID is prefered then I'd change the CLI call back to be what you suggested.
> Thanks for the patch!
>
> Some notes inline
>
> On Fri Mar 27, 2026 at 11:14 AM CET, Felix Driessler wrote:
>> Signed-off-by: Felix Driessler <fdriessler@inett.de>
>> ---
>> src/PVE/Storage/ISCSIPlugin.pm | 20 ++++++++++++++------
>> 1 file changed, 14 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin.pm
>> index 30f4178..bb5576b 100644
>> --- a/src/PVE/Storage/ISCSIPlugin.pm
>> +++ b/src/PVE/Storage/ISCSIPlugin.pm
>> @@ -305,13 +305,21 @@ sub iscsi_device_list {
>>
>> my $volid = "$channel.$id.$lun.$blockdev";
>>
>> + my $wwid = '';
>> + my $dev = "/dev/$bdev";
>> + $dev =~ m|^(/dev/[A-Za-z0-9_\-./]+)$|
>> + or die "Invalid device path";
>> + $dev = $1;
>> + run_command(['/lib/udev/scsi_id', '-g', '-u', '-d', $dev], outfunc => sub { $wwid .= "$_[0]" });
> Only a suggestion and haven't tested this extensively yet: Since this
> code block already enumerates the iSCSI devices through the relevant
> sysfs, we can also fetch the wwid with:
>
> my $wwid = file_read_firstline("/sys/bus/scsi/devices/$tmp/wwid");
>
> Though this does have a different output depending on the WWN type [0]
> and this should probably also check whether the device actually has a
> WWID (just a check whether the file 'wwid' exists).
>
> [0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/scsi_lib.c?h=v7.0#n3348
>
>> +
>> $res->{$target}->{$volid} = {
>> - 'format' => 'raw',
>> - 'size' => int($size * 512),
>> - 'vmid' => 0, # not assigned to any vm
>> - 'channel' => int($channel),
>> - 'id' => int($id),
>> - 'lun' => int($lun),
>> + 'format' => 'raw',
>> + 'size' => int($size * 512),
>> + 'vmid' => 0, # not assigned to any vm
>> + 'channel' => int($channel),
>> + 'id' => int($id),
>> + 'lun' => int($lun),
> Aligning the indentation of the other existing properties should be done
> in a separate patch before this.
>
> Though our `make tidy` target will revert this back to the previous
> formatting.
>
>> + 'wwid' => $wwid
> nit: add a , at the end of the new property
>
>> };
>>
>> #print "TEST: $target $session $host,$bus,$tg,$lun $blockdev\n";
Felix Driessler
Junior Systems Engineer // #GernPerDU
Linux - Open Source - IT Solutions
T: +49-681-410993-0
E: fdriessler@inett.de
https://www.inett.de
inett GmbH | Altenkesseler Strasse 17 / B8 | 66115 Saarbrücken | Germany
Vertrieb: vertrieb@inett.de // +49-681-410993-33
Support: support@inett.de // +49-681-410993-42
Geschäftsführung: Marco Gabriel | Amtsgericht Saarbrücken HRB 16588
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH pve-stoage 3/4] iscsiPlugin: add wwid
2026-03-27 10:14 ` [PATCH pve-stoage 3/4] iscsiPlugin: add wwid Felix Driessler
@ 2026-04-23 13:06 ` Daniel Kral
2026-04-23 15:21 ` Felix Driessler - inett GmbH
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kral @ 2026-04-23 13:06 UTC (permalink / raw)
To: Felix Driessler, pve-devel
Thanks for the patch!
Some notes inline
On Fri Mar 27, 2026 at 11:14 AM CET, Felix Driessler wrote:
> Signed-off-by: Felix Driessler <fdriessler@inett.de>
> ---
> src/PVE/Storage/ISCSIPlugin.pm | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin.pm
> index 30f4178..bb5576b 100644
> --- a/src/PVE/Storage/ISCSIPlugin.pm
> +++ b/src/PVE/Storage/ISCSIPlugin.pm
> @@ -305,13 +305,21 @@ sub iscsi_device_list {
>
> my $volid = "$channel.$id.$lun.$blockdev";
>
> + my $wwid = '';
> + my $dev = "/dev/$bdev";
> + $dev =~ m|^(/dev/[A-Za-z0-9_\-./]+)$|
> + or die "Invalid device path";
> + $dev = $1;
> + run_command(['/lib/udev/scsi_id', '-g', '-u', '-d', $dev], outfunc => sub { $wwid .= "$_[0]" });
Only a suggestion and haven't tested this extensively yet: Since this
code block already enumerates the iSCSI devices through the relevant
sysfs, we can also fetch the wwid with:
my $wwid = file_read_firstline("/sys/bus/scsi/devices/$tmp/wwid");
Though this does have a different output depending on the WWN type [0]
and this should probably also check whether the device actually has a
WWID (just a check whether the file 'wwid' exists).
[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/scsi_lib.c?h=v7.0#n3348
> +
> $res->{$target}->{$volid} = {
> - 'format' => 'raw',
> - 'size' => int($size * 512),
> - 'vmid' => 0, # not assigned to any vm
> - 'channel' => int($channel),
> - 'id' => int($id),
> - 'lun' => int($lun),
> + 'format' => 'raw',
> + 'size' => int($size * 512),
> + 'vmid' => 0, # not assigned to any vm
> + 'channel' => int($channel),
> + 'id' => int($id),
> + 'lun' => int($lun),
Aligning the indentation of the other existing properties should be done
in a separate patch before this.
Though our `make tidy` target will revert this back to the previous
formatting.
> + 'wwid' => $wwid
nit: add a , at the end of the new property
> };
>
> #print "TEST: $target $session $host,$bus,$tg,$lun $blockdev\n";
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH pve-stoage 3/4] iscsiPlugin: add wwid
[not found] ` <f53ca227-2275-443f-84f8-48b2785269b2.2bc2ceb6-a3a3-4c49-9566-519c7d2ab20e.24fbb610-73bc-4d0e-8ec7-c0b5fbde4ff8@emailsignatures365.codetwo.com>
@ 2026-03-27 10:14 ` Felix Driessler
2026-04-23 13:06 ` Daniel Kral
0 siblings, 1 reply; 4+ messages in thread
From: Felix Driessler @ 2026-03-27 10:14 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Felix Driessler <fdriessler@inett.de>
---
src/PVE/Storage/ISCSIPlugin.pm | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin.pm
index 30f4178..bb5576b 100644
--- a/src/PVE/Storage/ISCSIPlugin.pm
+++ b/src/PVE/Storage/ISCSIPlugin.pm
@@ -305,13 +305,21 @@ sub iscsi_device_list {
my $volid = "$channel.$id.$lun.$blockdev";
+ my $wwid = '';
+ my $dev = "/dev/$bdev";
+ $dev =~ m|^(/dev/[A-Za-z0-9_\-./]+)$|
+ or die "Invalid device path";
+ $dev = $1;
+ run_command(['/lib/udev/scsi_id', '-g', '-u', '-d', $dev], outfunc => sub { $wwid .= "$_[0]" });
+
$res->{$target}->{$volid} = {
- 'format' => 'raw',
- 'size' => int($size * 512),
- 'vmid' => 0, # not assigned to any vm
- 'channel' => int($channel),
- 'id' => int($id),
- 'lun' => int($lun),
+ 'format' => 'raw',
+ 'size' => int($size * 512),
+ 'vmid' => 0, # not assigned to any vm
+ 'channel' => int($channel),
+ 'id' => int($id),
+ 'lun' => int($lun),
+ 'wwid' => $wwid
};
#print "TEST: $target $session $host,$bus,$tg,$lun $blockdev\n";
--
2.52.0
Felix Driessler
Junior Systems Engineer // #GernPerDU
Linux - Open Source - IT Solutions
T: +49-681-410993-0
E: fdriessler@inett.de
https://www.inett.de
inett GmbH | Altenkesseler Strasse 17 / B8 | 66115 Saarbrücken | Germany
Vertrieb: vertrieb@inett.de // +49-681-410993-33
Support: support@inett.de // +49-681-410993-42
Geschäftsführung: Marco Gabriel | Amtsgericht Saarbrücken HRB 16588
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-23 15:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <f53ca227-2275-443f-84f8-48b2785269b2.2bc2ceb6-a3a3-4c49-9566-519c7d2ab20e.6280bc33-152c-4cc8-b1f7-ae5c6d73e0f3@emailsignatures365.codetwo.com>
2026-04-23 15:14 ` [PATCH pve-stoage 3/4] iscsiPlugin: add wwid Felix Drießler
2026-03-27 10:14 [PATCH pve-manager/pve-storage 0/4] extend iscsi configuration Felix Driessler
[not found] ` <f53ca227-2275-443f-84f8-48b2785269b2.2bc2ceb6-a3a3-4c49-9566-519c7d2ab20e.24fbb610-73bc-4d0e-8ec7-c0b5fbde4ff8@emailsignatures365.codetwo.com>
2026-03-27 10:14 ` [PATCH pve-stoage 3/4] iscsiPlugin: add wwid Felix Driessler
2026-04-23 13:06 ` Daniel Kral
2026-04-23 15:21 ` Felix Driessler - inett GmbH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox