Comment 1 for bug 1642391

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