Re: [pve-devel] [PATCH storage 0/1] Fix for ZFS over iSCSI on Solaris 11

2019-05-16 Thread David Hedbor
Thanks for the feedback. I’ll look at modifying the patch to work with
Illumos distribution (I have an OpenIndiana VM I can experiment with), as
well as moving the get_initiator_name() method to pve-common.

I’ll get back with updated changes in a little bit.

On May 16, 2019 at 05:29:43, Michael Rasmussen (m...@datanom.net) wrote:

On Thu, 16 May 2019 14:02:30 +0200
Dominik Csapak  wrote:

>
> first i looked at omnios (current release) and there
> 'stmfadm list-view' has no '-v' argument and fails
>
This is true and I guess it will never have that option.

> as i know that at least the original author uses omnios with this,
> i do not want to break it, or what is your stand on this @mir ?
>
As this is an Oracle Solaris thing and since Oracle deliberately does
not want to share with the community (Oracle Solaris is published under
a proprietary closed source licens) it is impossible to know the
direction. As is know adding the patch will break all other Solaris
offspring's for ever besides Oracle Solaris so the patch will need to
be able to handle both Solaris and Oracle Solaris.

> it would probably ok to try and detect the solaris version (how?)
> and only do this if it supports those options
>
To be able to detect this you would require access to an Oracle Solaris
installation. Maybe using uname could be a way?

> as for get_initiator_name, we could probably put this into pve-common,
> it seems general enough, then we could access it from qemu-server and
> pve-storage
>
>
This sounds like a good idea since initiator name is related to the
consumer and not the provider.


-- 
Hilsen/Regards
Michael Rasmussen

Get my public GnuPG keys:
michael  rasmussen  cc
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD3C9A00E
mir  datanom  net
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE501F51C
mir  miras  org
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE3E80917
--
/usr/games/fortune -es says:
"If you don't want your dog to have bad breath, do what I do: Pour a
little Lavoris in the toilet."
-- Jay Leno

-- 
David Hedbor
___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH storage 0/1] Fix for ZFS over iSCSI on Solaris 11

2019-05-15 Thread David Hedbor
I'm testing out ZFS over iSCSI with a Oracle Solaris 11.3 server
(Sparc based specifically). It almost works - what doesn't work is
when I try to act on the disk in any way (such as start
KVM). Specifically it is unable to find the LUN.

Looking at the source, it seems like Proxmox runs: 

stmfadm list-view -l 

to get the LUN. However on Solaris 11.3 (at least my installation),
this returns the following:

View Entry: 0
Host group   : All
Target Group : All
LUN  : Auto

There's no LUN listed here. You can find ones assigned if you use the -v flag:

$ sudo stmfadm list-view -l 600144f2a8fee54fcb4fb8583c6d11dd -v 
View Entry: 0
Host group   : All
Target Group : All
LUN  : Auto
Lun  : 1for iqn.1993-08.org.debian:01:e06b5e9eb438
Lun  : 1for iqn.1993-08.org.debian:01:7c967782bc4
Lun  : 1for iqn.1993-08.org.debian:01:dc213f1eceab
Lun  : 1for iqn.1993-08.org.debian:01:8ee9e0466ec5

I modified Comstar.pm to handle this, which I assume is a change from
Solaris 10 (OpenSolaris) to Solaris 11. I'm not happy with the copy of
get_initiator_name - it's also used by QemuServer.pm. I'm not familar
enough to know where to best place it. 

David Hedbor (1):
  storage: iscsi: Fix LunCmd for Comstar on Oracle Solaris 11

 PVE/Storage/LunCmd/Comstar.pm | 31 ++-
 1 file changed, 26 insertions(+), 5 deletions(-)

-- 
2.11.0

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH storage 1/1] storage: iscsi: Fix LunCmd for Comstar on Oracle Solaris 11

2019-05-15 Thread David Hedbor
Fix #2213: ZFS over iSCSI doesn't work with Solaris 11.3

Signed-off-by: David Hedbor 
---
 PVE/Storage/LunCmd/Comstar.pm | 31 ++-
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/PVE/Storage/LunCmd/Comstar.pm b/PVE/Storage/LunCmd/Comstar.pm
index 527e4ba..ca5938e 100644
--- a/PVE/Storage/LunCmd/Comstar.pm
+++ b/PVE/Storage/LunCmd/Comstar.pm
@@ -1,4 +1,5 @@
 package PVE::Storage::LunCmd::Comstar;
+use PVE::SafeSyslog;
 
 use strict;
 use warnings;
@@ -31,13 +32,26 @@ my $get_lun_cmd_map = sub {
 return $cmdmap->{$method};
 };
 
+sub get_initiator_name {
+my $initiator;
+
+my $fh = IO::File->new('/etc/iscsi/initiatorname.iscsi') || return undef;
+while (defined(my $line = <$fh>)) {
+   next if $line !~ m/^\s*InitiatorName\s*=\s*([\.\-:\w]+)/;
+   $initiator = $1;
+   last;
+}
+$fh->close();
+
+return $initiator;
+}
+
 sub get_base {
 return '/dev/zvol/rdsk';
 }
 
 sub run_lun_command {
 my ($scfg, $timeout, $method, @params) = @_;
-
 my $msg = '';
 my $luncmd;
 my $target;
@@ -62,7 +76,7 @@ sub run_lun_command {
 } elsif ($method eq 'modify_lu') {
 @params = ('-s', @params);
 } elsif ($method eq 'list_view') {
-@params = ('-l', @params);
+@params = ('-l',  @params, '-v');
 } elsif ($method eq 'list_lu') {
 $guid = $params[0];
 @params = undef;
@@ -90,8 +104,16 @@ sub run_lun_command {
 if ($method eq 'list_view') {
 my @lines = split /\n/, $msg;
 $msg = undef;
-foreach my $line (@lines) {
-if ($line =~ /^\s*LUN\s*:\s*(\d+)$/) {
+   my $initiator = undef;
+   foreach my $line (@lines) {
+   if(defined $initiator) {
+   if ($line =~ /^\s*Lun\s*:\s*(\d+)\s*for\s*\Q${initiator}/) {
+   $msg = $1;
+   last;
+   }
+   } elsif ($line =~ /^\s*LUN\s*:\s*Auto$/) {
+   $initiator = get_initiator_name();
+   } elsif ($line =~ /^\s*LUN\s*:\s*(\d+)$/) {
 $msg = $1;
 last;
 }
@@ -112,4 +134,3 @@ sub run_lun_command {
 
 return $msg;
 }
-
-- 
2.11.0

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel