def initLock(self, lease): self.log.info( "Initializing sanlock for domain %s path=%s alignment=%s " "block_size=%s io_timeout=%s", self._sdUUID, self._idsPath, self._alignment, self._block_size, self._io_timeout) resource_name = lease.name.encode("utf-8") try: sanlock.write_lockspace( self._lockspace_name, self._idsPath, iotimeout=self._io_timeout, align=self._alignment, sector=self._block_size) sanlock.write_resource( self._lockspace_name, resource_name, [(lease.path, lease.offset)], align=self._alignment, sector=self._block_size) except sanlock.SanlockException: self.log.exception( "Cannot initialize lock for domain %s", self._sdUUID) raise se.ClusterLockInitError()
def initLock(self): lockUtil = constants.EXT_SAFELEASE initCommand = [lockUtil, "release", "-f", self._leasesPath, "0"] rc, out, err = misc.execCmd(initCommand, cwd=self.lockUtilPath) if rc != 0: self.log.warn("could not initialise spm lease (%s): %s", rc, out) raise se.ClusterLockInitError()
def initLock(self, lease): if lease != self._lease: raise MultipleLeasesNotSupported("init", lease) lockUtil = constants.EXT_SAFELEASE initCommand = [lockUtil, "release", "-f", lease.path, "0"] rc, out, err = misc.execCmd(initCommand, cwd=self.lockUtilPath) if rc != 0: self.log.warn("could not initialise spm lease (%s): %s", rc, out) raise se.ClusterLockInitError()
def initSANLock(sdUUID, idsPath, lease): initSANLockLog.debug("Initializing SANLock for domain %s", sdUUID) try: sanlock.init_lockspace(sdUUID, idsPath) sanlock.init_resource(sdUUID, lease.name, [(lease.path, lease.offset)]) except sanlock.SanlockException: initSANLockLog.error("Cannot initialize SANLock for domain %s", sdUUID, exc_info=True) raise se.ClusterLockInitError()
def initSANLock(sdUUID, idsPath, leasesPath): initSANLockLog.debug("Initializing SANLock for domain %s", sdUUID) try: sanlock.init_lockspace(sdUUID, idsPath) sanlock.init_resource(sdUUID, SDM_LEASE_NAME, [(leasesPath, SDM_LEASE_OFFSET)]) except sanlock.SanlockException: initSANLockLog.error("Cannot initialize SANLock for domain %s", sdUUID, exc_info=True) raise se.ClusterLockInitError()
def initSANLock( sdUUID, idsPath, lease, alignment=sc.ALIGNMENT_1M, block_size=sc.BLOCK_SIZE_512): initSANLockLog.debug("Initializing SANLock for domain %s", sdUUID) try: sanlock.write_lockspace( sdUUID, idsPath, align=alignment, sector=block_size) sanlock.write_resource( sdUUID, lease.name, [(lease.path, lease.offset)], align=alignment, sector=block_size) except sanlock.SanlockException: initSANLockLog.error("Cannot initialize SANLock for domain %s", sdUUID, exc_info=True) raise se.ClusterLockInitError()