示例#1
0
    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()
示例#2
0
文件: clusterlock.py 项目: jxyzn/vdsm
def initSANLock(sdUUID, idsPath, lease):
    initSANLockLog.debug("Initializing SANLock for domain %s", sdUUID)

    try:
        sanlock.write_lockspace(sdUUID, idsPath)
        sanlock.write_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()
示例#3
0
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()