From patchwork Thu Jan 17 07:30:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 1995261 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork1.kernel.org (Postfix) with ESMTP id E08403FC85 for ; Thu, 17 Jan 2013 07:33:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0H7UjnH013048; Thu, 17 Jan 2013 02:30:47 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0H7Uir3018754 for ; Thu, 17 Jan 2013 02:30:44 -0500 Received: from mx2.redhat.com (ext-mx01.extmail.prod.ext.rdu2.redhat.com [10.11.55.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0H7UdK1030630 for ; Thu, 17 Jan 2013 02:30:44 -0500 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0H7UaVW006577 for ; Thu, 17 Jan 2013 02:30:36 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id D1A17A3CEE; Thu, 17 Jan 2013 08:30:30 +0100 (CET) Message-ID: <50F7A896.9040100@suse.de> Date: Thu, 17 Jan 2013 08:30:30 +0100 From: Hannes Reinecke User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 MIME-Version: 1.0 To: dm-devel@redhat.com References: <20130108053459.GU19059@ether.msp.redhat.com> <50EEFB87.1060707@gmail.com> <1358283765.3854.1.camel@lapoo.opensvc.com> <50F5D4B1.5070508@gmail.com> <1358371462.8351.18.camel@lapoo.opensvc.com> In-Reply-To: <1358371462.8351.18.camel@lapoo.opensvc.com> X-RedHat-Spam-Score: -6.301 (BAYES_00, DCC_REPUT_00_12, FRT_OFFER2, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.11.55.1 X-loop: dm-devel@redhat.com Cc: Kay Sievers Subject: Re: [dm-devel] [PATCH] multipath: change default configuration parameters X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com On 01/16/2013 10:24 PM, Christophe Varoqui wrote: > On mar., 2013-01-15 at 23:14 +0100, Xose Vazquez Perez wrote: > ... >> scsi_id is going to be replaced in systemd(recently udev was >> included in systemd). >> >> See sg_inq(--export option) from sg3_utils. > > We will need to patch sg_inq to report a denser id than the documented > SCSI_IDENT__= > Why? It took me ages to implement that one properly. And it's only strings, which can be expanded at will. Plus I have a set of udev rules mangling those into the usual ID_XXX variables. I don't see why we need to change that ... > Time to launch a debate over the pertinence to maintain the '3' prefix > scsi_id insisted on prepending to the wwids ... Lennart will take the > blame without flinching I'm sure ;) > It's not '3'. The '3' is the VPD designator ID as defined in the spec. And it's attached there so that you can differentiate between several IDs, which might be identical otherwise. The original idea behind the prefix was that each ID has a different level of 'uniqueness'. Basically, there are 5 possible designator IDs for the LUN: 0: Vendor specific 1: T10 Vendor ID based 2: EUI-64 based 3: NAA 8: SCSI Name string of which 0, 1, and 8 are basically arbitrary. We only have a guaranteed unique ID when the designator is of type 2 or 3. So prefixing the designator number allows you to figure out whether it's a good idea for using that ID. Mind you, that was when all was encoded in scsi_id. Now that's all open-coded with udev rules you have different variables for each ID, so it's easy to figure out. But sorry, we can't change that. Upgrade will be _HELL_ if you do that. Btw, a patch to the udev rules is attached. It's not yet included in the upstream sources as Kay and I are still discussing whether we should split the original rule set. Cheers, Hannes diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 1c4c2b2..a8377c6 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -38,17 +38,35 @@ KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program # ATA devices using the "scsi" subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode" # scsi devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" -KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" +KERNEL=="sd*[!0-9]|sr*", IMPORT{program}="/usr/bin/sg_inq --export $tempnode", ENV{ID_BUS}="scsi" +KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="/usr/bin/sg_inq --export $tempnode", ENV{ID_BUS}="cciss" +# Select which identifier to use per default +# 1: NAA IEEE Registered Extended identifier +ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA}=="6*", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA}" +# 2: NAA IEEE Registered identifier +ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA}=="5*", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA}" +# 3: Unspecified NAA identfier +ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA}" +# 4: EUI-64 identifer +ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_EUI64}=="?*", ENV{ID_SERIAL}="2$env{SCSI_IDENT_LUN_EUI64}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_EUI64}" +# 5: SCSI name identifier +ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAME}=="?*", ENV{ID_SERIAL}="8$env{SCSI_IDENT_LUN_NAME}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAME}" +# 6: T10 Vendor identifer +ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_T10}=="?*", ENV{ID_SERIAL}="1$env{SCSI_IDENT_LUN_T10}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_T10}" +# 7: Vendor-specific identifier +ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{ID_SERIAL}="0$env{SCSI_IDENT_LUN_VENDOR}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_VENDOR}" KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI_SERIAL}!="?*", IMPORT{program}="/usr/bin/sg_inq --export -p 0x80 $tempnode", ENV{ID_SCSI_SERIAL}="$env{SCSI_IDENT_SERIAL}" +KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SCSI_SERIAL}!="?*", IMPORT{program}="/usr/bin/sg_inq --export -p 0x80 $tempnode", ENV{ID_SCSI_SERIAL}="$env{SCSI_IDENT_SERIAL}" + # firewire KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" # scsi compat links for ATA devices -KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d$tempnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" +KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", ENV{SCSI_IDENT_SERIAL}=="?*", ENV{ID_SCSI_COMPAT}="$env{SCSI_IDENT_SERIAL}", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n" KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}"