def get_lock(self, name): """Return a Tooz backend lock. :param str name: The lock name that is used to identify it across all nodes. """ if self.coordinator is not None: return self.coordinator.get_lock(self.prefix + name) else: raise exception.LockCreationFailed(_('Coordinator uninitialized.'))
def get_lock(self, name: str): """Return a Tooz backend lock. :param str name: The lock name that is used to identify it across all nodes. """ # NOTE(bluex): Tooz expects lock name as a byte string. lock_name = (self.prefix + name).encode('ascii') if self.coordinator is not None: return self.coordinator.get_lock(lock_name) else: raise exception.LockCreationFailed(_('Coordinator uninitialized.'))