Skip to content

Commit

Permalink
Merge "Check if dir exists before calling listdir" into stable/havana
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Nov 13, 2013
2 parents 5f7d263 + fb8db56 commit ad05556
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cinder/brick/initiator/host_driver.py
Expand Up @@ -22,8 +22,10 @@ class HostDriver(object):

def get_all_block_devices(self):
"""Get the list of all block devices seen in /dev/disk/by-path/."""
files = []
dir = "/dev/disk/by-path/"
files = os.listdir(dir)
if os.path.isdir(dir):
files = os.listdir(dir)
devices = []
for file in files:
devices.append(dir + file)
Expand Down

0 comments on commit ad05556

Please sign in to comment.