On Thu, Mar 30, 2017 at 04:53:51AM -0400, Jiri B wrote:
> On Thu, Mar 30, 2017 at 10:25:18AM +0200, Bruno Flueckiger wrote:
> > > how to query scsi id or wwn for a scsi disk in OpenBSD? I'd like to get 
> > > this
> > > info and extend installer to provide more info about disks (because 
> > > currently
> > > it's imposible to distinguish between scsi disks if they are same size and
> > > originate from same iscsi target and passed to OpenBSD via qemu-kvm).
> > > 
> > > So what's OpenBSD equivalent scsi query for Linux commands?
> > > 
> > > # lsscsi -iws | tail -n1
> > > [6:0:0:10]   disk    0x6006048c8f0ff1a5c7ef85c8d1c95  /dev/sdd   
> > > 36006048c8f0ff1a5c7ef85c8d1c95481  16.1GB
> > > 
> > > # /usr/lib/udev/scsi_id -xg /dev/sdd
> > > ID_SCSI=1
> > > ID_VENDOR=EMC
> > > ID_VENDOR_ENC=EMC\x20\x20\x20\x20\x20
> > > ID_MODEL=Celerra
> > > ID_MODEL_ENC=Celerra\x20\x20\x20\x20\x20\x20\x20\x20\x20
> > > ID_REVISION=0002
> > > ID_TYPE=disk
> > > ID_SERIAL=36006048c8f0ff1a5c7ef85c8d1c95481
> > > ID_SERIAL_SHORT=6006048c8f0ff1a5c7ef85c8d1c95481
> > > ID_WWN=0x6006048c8f0ff1a5
> > > ID_WWN_VENDOR_EXTENSION=0xc7ef85c8d1c95481
> > > ID_WWN_WITH_EXTENSION=0x6006048c8f0ff1a5c7ef85c8d1c95481
> > > ID_SCSI_SERIAL=EMC-Celerra-iSCSI-VLU-fs179_T5_LUN10_CKM00120100230
> > 
> > $ dmesg | grep scsi
> > 
> > sd1 at scsibus2 targ 0 lun 0: <SYNOLOGY, iSCSI Storage, 3.1> SCSI3
> > 0/direct fixed naa.6001405635870b3d9e95d40c9d9221d1
> > sd2 at scsibus2 targ 0 lun 1: <SYNOLOGY, iSCSI Storage, 3.1> SCSI3
> > 0/direct fixed naa.6001405dcc70b1dd909ed44f8db0d6d6
> 
>  disklabel sd1 | grep label
> 
> For sd1 and sd2 please. This is what is printed in installer. See diskinfo()
> in src/distrib/miniroot/install.sub
> 
> If it does print just 'iSCSI Storage 3.1' then this is not very
> useful info in the installer (although one can break and investigate dmesg)
> 
> So maybe disklabel should have better 'label' or we could print more info
> directly in the installer.
> 
> I'm also not sure sysctl hw.disknames output is best one, it does show duid
> which is OpenBSD specific (compare disklabel with and without '-d').
> 
> It seems there's no good solution fitting all cases (softraid, usb disks,
> both are scsi-like devices).
> 
> j.

# disklabel sd1 | grep label
label: iSCSI Storage

# disklabel sd2 | grep label
label: iSCSI Storage

I see your point with the installer. Default labels make the disks
indistinguishable. The following diff prints the raw infos from dmesg
rather than the current list of disks:

Index: distrib/miniroot/install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.988
diff -u -p -r1.988 install.sub
--- distrib/miniroot/install.sub        13 Mar 2017 17:08:31 -0000      1.988
+++ distrib/miniroot/install.sub        30 Mar 2017 10:44:01 -0000
@@ -264,13 +264,7 @@ diskinfo() {
        local _d
 
        for _d; do
-               make_dev $_d
-               echo -n "$_d: "
-               disklabel -dpg $_d 2>/dev/null |
-               sed     -e '/^label: /{s,,,;s/ *$//;s/^$/<no label>/;h;d;}' \
-                       -e '/.*# total bytes: \(.*\)/{s//(\1)/;H;}' \
-                       -e '$!d;x;s/\n/ /'
-               rm -f /dev/{r,}$_d?
+               sed -n "/^$_d/p" /var/run/dmesg.boot
        done
 }

Reply via email to