nailgun-agent doesn't find disk if there a diretory in /dev/disk/by-id

Bug #1642391 reported by dr Skape
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Committed
Medium
Vladimir Kozhukalov
Mitaka
Fix Released
Medium
Vladimir Kozhukalov
Newton
Fix Committed
Medium
Vladimir Kozhukalov
Ocata
Fix Committed
Medium
Vladimir Kozhukalov

Bug Description

When there is a directory in the path /dev/disk/by-id, nailgun-agent timesout and doesn't send the correct data about the drive.

Error message
E, [2016-11-16T20:01:56.507726 #32413] ERROR -- : Error 'Invalid argument @ rb_readlink - /dev/disk/by-id/scsi-SDELL_PERC_6' in gathering disks metadata: ["/usr/bin/nailgun-agent:875:in `readlink'", "/usr/bin/nailgun-agent:875:in `block in _disk_id_by_name'", "/usr/bin/nailgun-agent:875:in `select'", "/usr/bin/nailgun-agent:875:in `_disk_id_by_name'", "/usr/bin/nailgun-agent:1004:in `block in physical_data_storage_devices'", "/usr/bin/nailgun-agent:968:in `each'", "/usr/bin/nailgun-agent:968:in `physical_data_storage_devices'", "/usr/bin/nailgun-agent:727:in `block (2 levels) in _detailed'", "/usr/bin/nailgun-agent:721:in `each'", "/usr/bin/nailgun-agent:721:in `block in _detailed'", "/usr/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'", "/usr/lib/ruby/2.3.0/timeout.rb:33:in `block in catch'", "/usr/lib/ruby/2.3.0/timeout.rb:33:in `catch'", "/usr/lib/ruby/2.3.0/timeout.rb:33:in `catch'", "/usr/lib/ruby/2.3.0/timeout.rb:106:in `timeout'", "/usr/bin/nailgun-agent:710:in `_detailed'", "/usr/bin/nailgun-agent:1191:in `_data'", "/usr/bin/nailgun-agent:207:in `put'", "/usr/bin/nailgun-agent:1398:in `<main>'"]

Tags: area-python
Revision history for this message
dr Skape (dr.skape) wrote :

http://paste.openstack.org/show/589510/

patch proposal by <AlexAvadanii> from fuel irc chanel

668 668
669 669 def _disk_id_by_name(name)
670 670 dn = "/dev/disk/by-id"
671 basepath = Dir["#{dn}/**?"].select{|f| /\/#{name}$/.match(File.readlink(f))}
671 basepath = Dir["#{dn}/**?"].select{|f| File.symlink?(f) and /\/#{name}$/.match(File.readlink(f))}
672 672 basepath.map{|p| p.split("/")[2..-1].join("/")}
673 673 end
674 674
675 675 def _disk_path_by_name(name)
676 676 dn = "/dev/disk/by-path"
677 basepath = Dir["#{dn}/**?"].find{|f| /\/#{name}$/.match(File.readlink(f))}
677 basepath = Dir["#{dn}/**?"].find{|f| File.symlink?(f) and /\/#{name}$/.match(File.readlink(f))}
678 678 basepath.split("/")[2..-1].join("/") if basepath
679 679 end

Changed in fuel:
assignee: nobody → Fuel Sustaining (fuel-sustaining-team)
milestone: none → 9.2
tags: added: area-python
Revision history for this message
dr Skape (dr.skape) wrote :

I've tried in the versions 9, 10 and 11.

Revision history for this message
Zoltan Langi (zlangi) wrote :

Hello there, basically I'm hitting the same problem like dr Skape, I've also got a directory in the path:

2016-11-17T14:19:09Z notice nailgun-agent: E, [2016-11-17T14:19:09.633898 #9763] ERROR -- : Error 'Invalid argument @ rb_readlink - /dev/disk/by-id/scsi-SSAMSUNG_MZ6ER400HAGL' in gathering disks metadata: ["/usr/bin/nailgun-agent:875:in `readlink'", "/usr/bin/nailgun-agent:875:in `block in _disk_id_by_name'", "/usr/bin/nailgun-agent:875:in `select'", "/usr/bin/nailgun-agent:875:in `_disk_id_by_name'", "/usr/bin/nailgun-agent:1004:in `block in physical_data_storage_devices'", "/usr/bin/nailgun-agent:968:in `each'", "/usr/bin/nailgun-agent:968:in `physical_data_storage_devices'", "/usr/bin/nailgun-agent:727:in `block (2 levels) in _detailed'", "/usr/bin/nailgun-agent:721:in `each'", "/usr/bin/nailgun-agent:721:in `block in _detailed'", "/usr/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'", "/usr/lib/ruby/2.3.0/timeout.rb:33:in `block in catch'", "/usr/lib/ruby/2.3.0/timeout.rb:33:in `catch'", "/usr/lib/ruby/2.3.0/timeout.rb:33:in `catch'", "/usr/lib/ruby/2.3.0/timeout.rb:106:in `timeout'", "/usr/bin/nailgun-agent:7

Changed in fuel:
importance: Undecided → Medium
assignee: Fuel Sustaining (fuel-sustaining-team) → Vladimir Kozhukalov (kozhukalov)
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-nailgun-agent (master)

Fix proposed to branch: master
Review: https://review.openstack.org/400634

Changed in fuel:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-nailgun-agent (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/400641

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-nailgun-agent (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/400642

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-nailgun-agent (master)

Reviewed: https://review.openstack.org/400634
Committed: https://git.openstack.org/cgit/openstack/fuel-nailgun-agent/commit/?id=402eb1f423a3833685fb439df5616bfdfcdee453
Submitter: Jenkins
Branch: master

commit 402eb1f423a3833685fb439df5616bfdfcdee453
Author: Vladimir Kozhukalov <email address hidden>
Date: Tue Nov 22 12:28:27 2016 +0300

    Check if /dev/disk/*/ item is a symlink

    Sometimes udev places devices symlinks into a directory
    /dev/disk/by-id/foo/device_symlink and we must be able
    to go through this directories recursively and find all
    symlinks.

    Change-Id: I0749ab94e05fdf6fd12dc89c2c788a61a128b77d
    Closes-Bug: #1642391

Changed in fuel:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-nailgun-agent (stable/mitaka)

Reviewed: https://review.openstack.org/400641
Committed: https://git.openstack.org/cgit/openstack/fuel-nailgun-agent/commit/?id=56ef29cd220379215ee996e78d665013f14f59f7
Submitter: Jenkins
Branch: stable/mitaka

commit 56ef29cd220379215ee996e78d665013f14f59f7
Author: Vladimir Kozhukalov <email address hidden>
Date: Tue Nov 22 12:28:27 2016 +0300

    Check if /dev/disk/*/ item is a symlink

    Change-Id: I0749ab94e05fdf6fd12dc89c2c788a61a128b77d
    Closes-Bug: #1642391

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-nailgun-agent (stable/newton)

Reviewed: https://review.openstack.org/400642
Committed: https://git.openstack.org/cgit/openstack/fuel-nailgun-agent/commit/?id=c2ac19a35d5d628c7e128c9b93eef99637c327e7
Submitter: Jenkins
Branch: stable/newton

commit c2ac19a35d5d628c7e128c9b93eef99637c327e7
Author: Vladimir Kozhukalov <email address hidden>
Date: Tue Nov 22 12:28:27 2016 +0300

    Check if /dev/disk/*/ item is a symlink

    Sometimes udev places devices symlinks into a directory
    /dev/disk/by-id/foo/device_symlink and we must be able
    to go through this directories recursively and find all
    symlinks.

    Change-Id: I0749ab94e05fdf6fd12dc89c2c788a61a128b77d
    Closes-Bug: #1642391

tags: added: on-verification
Revision history for this message
Alexey. Kalashnikov (akalashnikov) wrote :

verified on 9.2 snapshot #553

tags: removed: on-verification
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/fuel-nailgun-agent 11.0.0.0rc1

This issue was fixed in the openstack/fuel-nailgun-agent 11.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.