]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: fix signed integer is greater than maximum when call major 19299/head
authorSong Shun <song.shun3@zte.com.cn>
Tue, 28 Nov 2017 03:28:43 +0000 (11:28 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 3 Dec 2017 02:34:59 +0000 (10:34 +0800)
  fix signed integer is greater than maximum when call os.major
  using python 2.7.5 in Centos 7

Signed-off-by: Song Shun <song.shun3@zte.com.cn>
(cherry picked from commit f77934b19939796d7ab52daf4dac44846a2ad162)

src/ceph-disk/ceph_disk/main.py

index 6516750d22688325d4270542db4d13ebf6846273..8e95d1cff67957a9d42465b58a260cc3bec71927 100644 (file)
@@ -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):