From: Song Shun Date: Tue, 28 Nov 2017 03:28:43 +0000 (+0800) Subject: ceph-disk: fix signed integer is greater than maximum when call major X-Git-Tag: v12.2.3~249^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F19299%2Fhead;p=ceph.git ceph-disk: fix signed integer is greater than maximum when call major fix signed integer is greater than maximum when call os.major using python 2.7.5 in Centos 7 Signed-off-by: Song Shun (cherry picked from commit f77934b19939796d7ab52daf4dac44846a2ad162) --- diff --git a/src/ceph-disk/ceph_disk/main.py b/src/ceph-disk/ceph_disk/main.py index 6516750d22688..8e95d1cff6795 100644 --- a/src/ceph-disk/ceph_disk/main.py +++ b/src/ceph-disk/ceph_disk/main.py @@ -162,6 +162,13 @@ PTYPE = { }, } +try: + # see https://bugs.python.org/issue23098 + os.major(0x80002b00) +except OverflowError: + os.major = lambda devid: ((devid >> 8) & 0xfff) | ((devid >> 32) & ~0xfff) + os.minor = lambda devid: (devid & 0xff) | ((devid >> 12) & ~0xff) + class Ptype(object):