def vbtomb(vb): mb = vbtos(vb) / (1024 * 1024 / 512) tvb, todd = stovb(mb * (1024 * 1024 / 512)) if tvb != vb or todd != 0: logger.info("vb %s != %s (%s)" % \ (stovb(mb * (1024 * 1024 / 512)), vb, mb)) raise xmlrpclib.Fault(errno.EINVAL, 'EINVAL') return mb
def do(self): assert len(self.components) == 1 c = self.components[0] assert c.iscsi_ref != None name = getDextDevName(self.dext_ssvrid, self.lvolid) path = getDmDevPath(name) if not os.path.exists(path): command = "echo 0 %s linear %s %s | dmsetup create %s" % ( vbtos(self.capacity), c.path, vbtos(self.dext_offset), name, ) execute_retry_not_path_exist(command, path, DMSETUP_RETRY_TIMES) self.path = path os.close(c.iscsi_ref) c.iscsi_ref = None