def newVolumeLease(cls, metaId, sdUUID, volUUID): cls.log.debug("Initializing volume lease volUUID=%s sdUUID=%s, " "metaId=%s", volUUID, sdUUID, metaId) volPath, = metaId leasePath = cls.leaseVolumePath(volPath) oop.getProcessPool(sdUUID).truncateFile(leasePath, LEASE_FILEOFFSET) cls.file_setrw(leasePath, rw=True) sanlock.init_resource(sdUUID, volUUID, [(leasePath, LEASE_FILEOFFSET)])
def newVolumeLease(cls, metaId, sdUUID, volUUID): cls.log.debug( "Initializing volume lease volUUID=%s sdUUID=%s, " "metaId=%s", volUUID, sdUUID, metaId) volPath = metaId[0] leasePath = cls.leaseVolumePath(volPath) oop.getProcessPool(sdUUID).truncateFile(leasePath, LEASE_FILEOFFSET) cls.file_setrw(leasePath, rw=True) sanlock.init_resource(sdUUID, volUUID, [(leasePath, LEASE_FILEOFFSET)])
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, 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 newVolumeLease(cls, metaId, sdUUID, volUUID): cls.log.debug("Initializing volume lease volUUID=%s sdUUID=%s, " "metaId=%s", volUUID, sdUUID, metaId) manifest = blockSD.BlockStorageDomainManifest(sdUUID) metaSdUUID, mdSlot = metaId leasePath = manifest.getLeasesFilePath() leaseOffset = ((mdSlot + RESERVED_LEASES) * manifest.logBlkSize * sd.LEASE_BLOCKS) sanlock.init_resource(sdUUID, volUUID, [(leasePath, leaseOffset)])
def newVolumeLease(cls, metaId, sdUUID, volUUID): cls.log.debug( "Initializing volume lease volUUID=%s sdUUID=%s, " "metaId=%s", volUUID, sdUUID, metaId) manifest = sdCache.produce_manifest(sdUUID) metaSdUUID, mdSlot = metaId leasePath = manifest.getLeasesFilePath() leaseOffset = ((mdSlot + RESERVED_LEASES) * manifest.logBlkSize * sd.LEASE_BLOCKS) sanlock.init_resource(sdUUID, volUUID, [(leasePath, leaseOffset)])
def _repair(broken_leases): print("Repairing volume leases ...") total = 0 repaired = 0 for sd_uuid in broken_leases: for img_uuid in broken_leases[sd_uuid]: for vol_uuid in broken_leases[sd_uuid][img_uuid]: total += 1 vol_lease = broken_leases[sd_uuid][img_uuid][vol_uuid] try: sanlock.init_resource( sd_uuid, vol_uuid, [(vol_lease['path'], vol_lease['offset'])]) repaired += 1 except sanlock.SanlockException as e: print("Failed to repair lease of volume {}/{}. Error {}". format(vol_lease['image'], vol_lease['volume'], e)) print("Repaired ({}/{}) volume leases.".format(repaired, total))
def _repair(broken_leases): print("Repairing volume leases ...") total = 0 repaired = 0 for sd_uuid in broken_leases: for img_uuid in broken_leases[sd_uuid]: for vol_uuid in broken_leases[sd_uuid][img_uuid]: total += 1 vol_lease = broken_leases[sd_uuid][img_uuid][vol_uuid] try: sanlock.init_resource( sd_uuid, vol_uuid, [(vol_lease['path'], vol_lease['offset'])]) repaired += 1 except sanlock.SanlockException as e: print("Failed to repair lease of volume {}/{}. Error {}" .format(vol_lease['image'], vol_lease['volume'], e)) print("Repaired ({}/{}) volume leases.".format(repaired, total))