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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/utils/storage.py b/lib/utils/storage.py index c8aa2b9..0b7e388 100644 --- a/lib/utils/storage.py +++ b/lib/utils/storage.py @@ -290,3 +290,13 @@ def ReleaseBdevPartitionMapping(loop_dev_path): if result.failed: raise errors.CommandError("Failed to detach %s: %s" % (loop_dev_path, result.output)) + + +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
