Commit e51db2a6 authored by Iustin Pop's avatar Iustin Pop

Add caller-validation on Disk.StaticDevPath

Since in objects we don't have access to utils.py, we add a warning that
the result value from objects.Disk.StaticDevPath might not be a valid
path, and change its only caller to validate the path.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 30786fc9
......@@ -1461,6 +1461,8 @@ def BlockdevRemovechildren(parent_cdev, new_cdevs):
else:
devs.append(bd.dev_path)
else:
if not utils.IsNormAbsPath(rpath):
_Fail("Strange path returned from StaticDevPath: '%s'", rpath)
devs.append(rpath)
parent_bdev.RemoveChildren(devs)
......
......@@ -411,6 +411,9 @@ class Disk(ConfigObject):
irrespective of their status. For such devices, we return this
path, for others we return None.
@warning: The path returned is not a normalized pathname; callers
should check that it is a valid path.
"""
if self.dev_type == constants.LD_LV:
return "/dev/%s/%s" % (self.logical_id[0], self.logical_id[1])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment