Commit 01cf0021 authored by Klaus Aehlig's avatar Klaus Aehlig

Provide an alternative for os.minor working around its bug

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: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent d3d6e4ba
......@@ -180,3 +180,13 @@ 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)
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