Commit 222f2dd5 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add a support function to objects.Disk

This patch adds a function returning the device path if it is computable
from the disk object (and we don't need to instantiate a bdev object on
the target node in order to compute this). Only LVs support this.

Reviewed-by: imsnah
parent e2e521d0
......@@ -326,6 +326,18 @@ class Disk(ConfigObject):
"""Test if this device needs to be opened on a secondary node."""
return self.dev_type in (constants.LD_LV,)
def StaticDevPath(self):
"""Return the device path if this device type has a static one.
Some devices (LVM for example) live always at the same /dev/ path,
irrespective of their status. For such devices, we return this
path, for others we return None.
"""
if self.dev_type == constants.LD_LV:
return "/dev/%s/%s" % (self.logical_id[0], self.logical_id[1])
return None
def GetNodes(self, node):
"""This function returns the nodes this device lives on.
......
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