+def CheckSfdiskVer():
+ cmd = 'sfdisk --version'
+ lines = popen(cmd).readlines()
+ for l in lines:
+ if l.find("sfdisk from util-linux") != -1:
+ ver = l.split()[-1].strip()
+ break
+ try:
+ vs = ver.split('.')
+ if len(vs) > 2:
+ ver = '.'.join(vs[:2])
+
+ ver = float(ver)
+ except:
+ print "[CheckSfdiskVer] check parted version Failed!"
+ return 0
+ return ver
+
+def enableUdevEvent(enable = True):
+ if enable:
+ option = '--start-exec-queue'
+ else:
+ option = '--stop-exec-queue'
+ cmd = "udevadm control %s" % option
+ print "CMD : ", cmd
+ system(cmd)
+