Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

55-scsi-sg3_id.rules: removal of scsi_id, and cleanup #22

Merged
merged 8 commits into from
Feb 7, 2018

Conversation

mwilck
Copy link
Collaborator

@mwilck mwilck commented Dec 8, 2017

I've attempted a rewrite of systemd's 60-persistent-storage.rules, with the following goals:

  1. get rid of scsi_id, replace by sg calls / sysfs everywhere
    (this implies changes in 55-sg3-utils.rules)
  2. cleanly separate hardware detection, content detection (blkid), and
    symlink creation
  3. Improve general readability. For my taste, that means shorter
    lines, thus less conditions individual rules, thus more GOTOs
    separating blocks of code where certain conditins are known to
    hold.

This is the sg3_utils part. I also submitted a pull request for systemd:
systemd/systemd#7594

@mwilck
Copy link
Collaborator Author

mwilck commented Dec 22, 2017

Hannes, it's been two weeks ... could you voice an opinion on this patch set? It would certainly be beneficial for the systemd pull request to have this one accepted first. If you disagree with my changes, could you give me directions what to modify?

Copy link
Owner

@hreinecke hreinecke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the label "compat" used?
Shouldn't it be introduced with a commii actually using it?

Copy link
Owner

@hreinecke hreinecke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-by: Hannes Reinecke hare@suse.com

Copy link
Owner

@hreinecke hreinecke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-by: Hannes Reinecke hare@suse.com

@hreinecke
Copy link
Owner

Sigh. Github doesn't make for a nice patch-by-patch review.
(Or I'm too stupid to use it :-( )
Can you send me the patches individually by mail?
What I've seen so far some things need to be addressed:

  • The 'compat' label should be moved to the patch actually using it
  • The rules rewrite replaces tests like 'env{XXX}!="?*" with "env{XXX}=="0"', which is not equivalent; the former tests if the variable is set, and the latter tests if the variable has the value '0'. I'd rather like to revisit that in detail to ensure nothing goes wrong here.

@mwilck
Copy link
Collaborator Author

mwilck commented Jan 7, 2018

Hannes, this is a github "feature", see why are my commits in the wrong order? and isaacs/github#386.

If you look at the patches in the actual commit order

git log --oneline --reverse origin/master..
73c292d0c4ce 55-scsi-sg3_id.rules: fix SCSI_IDENT_LUN_NAA_EXT case
cf7f9f30b11a 55-scsi-sg3_id.rules: set WWN from SCSI_IDENT_LUN_NAA
89ee63d47ae3 55-scsi-sg3_id.rules: set serial for cciss devices
fb7a48413219 55-scsi-sg3_id.rules: compat rules in single block
b14166db8c13 55-scsi-sg3_id.rules: separate sysfs and sg inquiry code
e609491b559f 55-scsi-sg3_id.rules: type-independent node for inquiry
c57effb6c0b8 55-scsi-sg3_id.rules: support tape devices

"compat" is introduced in fb7a48413219 and used only in the follow-up patches.

@mwilck
Copy link
Collaborator Author

mwilck commented Jan 19, 2018

Hannes, I've sent you the patches by e-mail. Ping for review...

Reviewed-by: Hannes Reinecke <hare@suse.com>
@mwilck
Copy link
Collaborator Author

mwilck commented Jan 24, 2018

Updated the set of commits after Hannes' review. The current set has been tested for tapes too, using https://github.com/markh794/mhvtl.

@mwilck mwilck force-pushed the master branch 3 times, most recently from 69dceaa to b9081d2 Compare January 25, 2018 22:03
Restore compatibility with scsi_id by truncating ID_WWN to 16 chars.
ID_WWN_WITH_EXTENSION is what actually matters for SCSI, but we
should get this right nevertheless.
Separate the "compat" rules for creating ID_* variables from
SCSI_* variables from the block doing actual inquiry.

Also improve code readability by spelling out the sysfs vs. sg
code more clearly. This patch should have no functional impact.
In order to replace scsi_id functionality from udev's
60-persistent-storage.rules, add code for non-SCSI devices that support sg
INQUIRY (only CCISS at this time). CCISS has been deprecated since Linux 4.14,
but these rules are supposed to work with older kernels, too.
In order to replace scsi_id functionality in udev's
60-persistent-storage.rules, add support for some non-block devices.

These rules have been tested using the emulated virtual tape library
mhVTL (https://github.com/markh794/mhvtl). It turns out that preferring
sysfs attributes for inquiry is even more beneficial for those than
for disks.
ata_id or usb_id may have already set these variables.
Don't overwrite them in this case.
As of 2018 kernel 4.15, the kernel doesn't provide VPD pages for "SPC" devices
(SCSI version 0x03, ANSI INCITS 301-1997) in sysfs. It's usually safe to try
though (no counter-example is known), and for scsi_id compatibility, we have
to try. If the kernel ever changes its policy, this rule can perhaps be dropped.
@hreinecke hreinecke merged commit 089ad8a into hreinecke:master Feb 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants