could not bring up zfs iscsi storage based vms

immo

Renowned Member
Nov 20, 2014
92
0
71
thats the error I got if I start the vm which is based on a zfs storage

kvm: -drive file=iscsi://10.0.16.90/iqn.1986-03.com.sun:02:b23b291b-79f5-c3b3-9583-9ccb49a7fc30/,if=none,id=drive-scsi0,aio=native,cache=none,detect-zeroes=on: could not open disk image iscsi://10.0.16.90/iqn.1986-03.com.sun:02:b23b291b-79f5-c3b3-9583-9ccb49a7fc30/: Failed to parse URL : iscsi://10.0.16.90/iqn.1986-03.com.sun:02:b23b291b-79f5-c3b3-9583-9ccb49a7fc30/
TASK ERROR: start failed: command '/usr/bin/kvm -id 102 -chardev 'socket,id=qmp,path=/var/run/qemu-server/102.qmp,server,nowait' -mon 'chardev=qmp,mode=control' -vnc unix:/var/run/qemu-server/102.vnc,x509,password -pidfile /var/run/qemu-server/102.pid -daemonize -smbios 'type=1,uuid=5f48b406-3efe-4208-beb0-5d1c614c35da' -name Test1234 -smp 'sockets=1,cores=1' -nodefaults -boot 'menu=on' -vga std -no-hpet -cpu 'kvm64,hv_spinlocks=0xffff,hv_relaxed,+lahf_lm,+x2apic,+sep' -k en-us -m 512 -cpuunits 1000 -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:9a35ae13ccb0' -device 'lsi,id=scsihw0,bus=pci.0,addr=0x5' -drive 'file=iscsi://10.0.16.90/iqn.1986-03.com.sun:02:b23b291b-79f5-c3b3-9583-9ccb49a7fc30/,if=none,id=drive-scsi0,aio=native,cache=none,detect-zeroes=on' -device 'scsi-generic,bus=scsihw0.0,scsi-id=0,drive=drive-scsi0,id=scsi0' -rtc 'driftfix=slew,base=localtime' -global 'kvm-pit.lost_tick_policy=discard'' failed: exit code 1



Im wondering that the file is not extended with the real device which was created from proxmox as

ZFS-Storage:vm-102-disk-1
 
Last edited:
Re: could not bring up yfs iscsi storage based vms

This line 'iscsi://10.0.16.90/iqn.1986-03.com.sun:02:b23b291b-79f5-c3b3-9583-9ccb49a7fc30/' is missing the LUN number. Does the view exist for the specified zvol?
 
Re: could not bring up yfs iscsi storage based vms

Code:
root@gibarian:~# stmfadm list-lu -v 600144FED9B0FA8052DC659AFB9A3C2B
LU Name: 600144FED9B0FA8052DC659AFB9A3C2B
    Operational Status     : Online
    Provider Name          : sbd
    Alias                  : /dev/zvol/rdsk/tank/vm-102-disk-1
    View Entry Count       : 1
    Data File              : /dev/zvol/rdsk/tank/vm-102-disk-1
    Meta File              : not set
    Size                   : 34359738368
    Block Size             : 512
    Management URL         : not set
    Vendor ID              : SUN
    Product ID             : COMSTAR
    Serial Num             : not set
    Write Protect          : Disabled
    Write Cache Mode Select: Enabled
    Writeback Cache        : Enabled
    Access State           : Active
Code:
root@gibarian:~# stmfadm list-view -l 600144FED9B0FA8052DC659AFB9A3C2B -v
View Entry: 0
    Host group   : All
    Target Group : All
    LUN          : Auto
        Lun      : 0    for iqn.1993-08.org.debian:01:23773843293f
Code:
TARGET NAME                                                  STATE    SESSIONS
iqn.1986-03.com.sun:02:b23b291b-79f5-c3b3-9583-9ccb49a7fc30  online   0
        alias:                  -
        auth:                   none (defaults)
        targetchapuser:         -
        targetchapsecret:       unset
        tpg-tags:               default
 
Re: could not bring up yfs iscsi storage based vms

Why do I see two different target names?
iqn.1993-08.org.debian:01:23773843293f and iqn.1986-03.com.sun:02:b23b291b-79f5-c3b3-9583-9ccb49a7fc30

What OS do you use on the storage?
This command will fail on any Solaris:
stmfadm list-view -l 600144FED9B0FA8052DC659AFB9A3C2B -v
 
Re: could not bring up yfs iscsi storage based vms

Initiator Proxmox iqn.1993-08.org.debian:01:23773843293f The driver that initiates SCSI requests to the iSCSI target.
Target Solaris 11.2 Sparc iqn.1986-03.com.sun:02:b23b291b-79f5-c3b3-9583-9ccb49a7fc30 The iSCSI storage component.
stmfadm https://docs.oracle.com/cd/E36784_01...834/gkgmv.html

Both the iSCSI target daemon and the shareiscsiproperty are not available in Oracle Solaris 11. The following commands are used to manage iSCSI targets and LUNs

  • The itadm command manages SCSI targets.
  • The srptadm command manages SCSI RDMA Protocol (SRP) target ports.
  • The stmfadm command manages SCSI LUNs. Rather than setting a special iSCSI property on the ZFS volume, create the volume and use stmfadm to create the LUN.

https://docs.oracle.com/cd/E23824_01/html/E24456/storage-7.html
 
Last edited:
Re: could not bring up yfs iscsi storage based vms

We can bring up the vm if we add the Lun Number direct behind the iscsi target slash (Red Zero)

/usr/bin/kvm -id 102 -chardev 'socket,id=qmp,path=/var/run/qemu-server/102.qmp,server,nowait' -mon 'chardev=qmp,mode=control' -vnc unix:/var/run/qemu-server/102.vnc,x509,password -pidfile /var/run/qemu-server/102.pid -daemonize -smbios 'type=1,uuid=5f48b406-3efe-4208-beb0-5d1c614c35da' -name Test1234 -smp 'sockets=1,cores=1' -nodefaults -boot 'menu=on' -vga std -no-hpet -cpu 'kvm64,hv_spinlocks=0xffff,hv_relaxed,+lahf_lm,+x2 apic,+sep' -k en-us -m 512 -cpuunits 1000 -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:9a35ae13ccb0' -device 'lsi,id=scsihw0,bus=pci.0,addr=0x5' -drive 'file=iscsi://10.0.16.90/iqn.1986-03.com.sun:02:b23b291b-79f5-c3b3-9583-9ccb49a7fc30/0,if=none,id=drive-scsi0,aio=native,cache=none,detect-zeroes=on' -device 'scsi-generic,bus=scsihw0.0,scsi-id=0,drive=drive-scsi0,id=scsi0' -rtc 'driftfix=slew,base=localtime' -global 'kvm-pit.lost_tick_policy=discard'

but this is just a command line test there need somthing in the gui....
The Lun is created from proxmox in background. So the correct ID is only known to proxmox ... or to the zfs storage admin
 
Last edited:
Re: could not bring up yfs iscsi storage based vms

proxmox does not support different targets for view and lun. Your setup by using different targets for view and lun is also far from the norm.
 
Re: could not bring up yfs iscsi storage based vms

main problem is the /usr/share/perl5/PVE/Storage/LunCmd/Comstar.pm

Code:
64 } elsif ($method eq 'list_view') {
65 @params = ('-l', @params);

the output from the command

Code:
root@gibarian:~# /usr/sbin/stmfadm list-view -l 600144FED9B0FA8052DC659AFB9A3C2B
View Entry: 0
    Host group   : All
    Target Group : All
    [COLOR=#ffa500]LUN          : Auto[/COLOR]

The LUN have no number, it will by set Auto

Later in the code:
Code:
90    if ($method eq 'list_view') {
91        my @lines = split /\n/, $msg;
92        $msg = undef;
92        foreach my $line (@lines) {
94            if ($line =~ /^\s*[COLOR=#ffa500]LUN[/COLOR]\s*:\s*(\d+)$/) {
95               $msg = $1;
96                last;
97            }
98        }
.
.
.
113  return $msg;  <-----  Line 92 value undef


The only way in this case is:

Code:
root@gibarian:~# /usr/sbin/stmfadm list-view [B][COLOR=#ff0000]-v[/COLOR][/B] -l 600144FED9B0FA8052DC659AFB9A3C2B
View Entry: 0
    Host group   : All
    Target Group : All
    LUN          : Auto
        Lun      : 0    for iqn.2014-11.com.example:fb516144
        Lun      : 0    for iqn.1993-08.org.debian:01:23773843293f
        Lun      : 0    for iqn.1993-08.org.debian:01:9a35ae13ccb0
        Lun      : 2    for iqn.1998-01.com.vmware:localhost-50323f49

Get the InitiatorName from /etc/iscsi/initiatorname.iscsi (in this example iqn.1993-08.org.debian:01:9a35ae13ccb0)

and make a regex that do this:
Code:
root@gibarian:~# /usr/sbin/stmfadm list-view -v -l 600144FED9B0FA8052DC659AFB9A3C2B | grep iqn.1993-08.org.debian:01:9a35ae13ccb0
        Lun      : [B][COLOR=#ff0000]0[/COLOR][/B]    for iqn.1993-08.org.debian:01:9a35ae13ccb0


And now line 95 "$msg = $1;" must set in this example to 0 for use in

/usr/share/perl5/PVE/Storage/ZFSPlugin.pm
Code:
267  sub zfs_get_lun_number {
268      my ($scfg, $guid) = @_;
269  
270      die "could not find lun_number for guid $guid" if !$guid;
271  
272      return zfs_request($scfg, undef, 'list_view', $guid);
273  }
 
Last edited:
Re: could not bring up yfs iscsi storage based vms

Ok script extendet to get the right Lun back from function ... but this doesnt help.
Were are the iscsi string is created for kvm start ?

13,21d12
< my $InitiatorName;
< 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]+)/;
< $InitiatorName = $1;
< last;
< }
< $fh->close();
<
74c65
< @params = ('-v -l', @params);
---
> @params = ('-l', @params);
108,116d98
< if (not defined($msg)) {
< foreach my $line (@lines) {
< if ($line =~ /^\s+Lun\s+:\s+(\d+)\s+for\s+$InitiatorName.*$/) {
< $msg = $1;
< last;
< }
< }
< }
<
 
Last edited: