def format_external_leases(cls, lockspace, path, alignment=sc.ALIGNMENT_1M, block_size=sc.BLOCK_SIZE_512): """ Format the special xleases volume. Called when creating a new storage domain, or when upgrading storage domain to version 4. WARNING: destructive operation, must not be called on active external leases volume. TODO: should move to storage domain subclasses of each subclass can use its own backend. Must be called only on the SPM. """ with cls.manifestClass.external_leases_backend(lockspace, path) as backend: xlease.format_index(lockspace, backend, alignment=alignment, block_size=block_size)
def make_volume(*records): with make_leases() as path: lockspace = os.path.basename(os.path.dirname(path)) file = xlease.DirectFile(path) with utils.closing(file): xlease.format_index(lockspace, file) if records: write_records(records, file) vol = xlease.LeasesVolume(file) with utils.closing(vol): yield vol
def format_external_leases(cls, lockspace, path): """ Format the special xleases volume. Called when creating a new storage domain, or when upgrading storage domain to version 4. WARNING: destructive operation, must not be called on active external leases volume. TODO: should move to storage domain subclasses of each subclass can use its own backend. Must be called only on the SPM. """ backend = xlease.DirectFile(path) with utils.closing(backend): xlease.format_index(lockspace, backend)
def format_external_leases(cls, lockspace, path): """ Format the special xleases volume. Called when creating a new storage domain, or when upgrading storage domain to version 4. WARNING: destructive operation, must not be called on active external leases volume. TODO: should move to storage domain subclasses of each subclass can use its own backend. Must be called only on the SPM. """ with cls.manifestClass.external_leases_backend( lockspace, path) as backend: xlease.format_index(lockspace, backend)
def format_xleases(*args): """ format-xleases sd_id path WARNING: This is a destructive operation - you must put the storage domain into maintenance before running this tool. Format the xleases volume index, dropping all leases from the index. This does not delete sanlock resources on the volume. If you want to restore existing sanlock resources, use rebuild-index. If you want to delete also sanlock resources on this volume you can wipe the entire volume using dd before formatting it. Notes: - With iSCSI based storage you may need to connect to the traget using iscsiadm. - With file based storage, you may need to mount the storage domain. - With block based stoage, you need to activate the xleases logical volume before the operation, and deactivate after the operation. If formatting fails, the volume will not be usable (it will be marked as "updating"), but the operation can be tried again. Creating xleases volume on file storage: PATH=/rhev/data-center/mnt/server:_path/sd-id/dom_md/xleases truncate -s 1G $PATH vdsm-tool format-xleases sd-id $PATH Creating the xleases volume on block storage: lvcreate --name xleases --size 1g sd-id vdsm-tool format-xleases sd-id /dev/sd-id/xleases lvchange -an sd-id/xleases """ args = parse_args(args) backend = xlease.DirectFile(args.path) with utils.closing(backend): xlease.format_index(args.sd_id, backend)
def format_index(self): lockspace = os.path.basename(os.path.dirname(self.path)) xlease.format_index( lockspace, self.backend, block_size=self.block_size)
def format_index(self): xlease.format_index(self.lockspace, self.backend, alignment=self.alignment, block_size=self.block_size)
def format_index(self): lockspace = os.path.basename(os.path.dirname(self.backend.name)) xlease.format_index(lockspace, self.backend)