Python's os.minor still contains an old definition, whereas the current one has changed. So we add our own definition working around this bug.
Signed-off-by: Klaus Aehlig <[email protected]> --- lib/utils/storage.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/utils/storage.py b/lib/utils/storage.py index b424fab..e9981bd 100644 --- a/lib/utils/storage.py +++ b/lib/utils/storage.py @@ -180,3 +180,14 @@ def LookupSpaceInfoByStorageType(storage_space_info, storage_type): logging.warning("Storage space information requested for" " ambiguous storage type '%s'.", storage_type) return result + + +def osminor(dev): + """Return the device minor number from a raw device number. + + This is a replacement for os.minor working around the issue that + Python's os.minor still has the old definition. See Ganeti issue + 1058 for more details. + """ + return (dev & 0xff) | ((dev >> 12) & ~0xff) + -- 2.2.0.rc0.207.ga3a616c
