Sandro Bonazzola has uploaded a new change for review. Change subject: sanlock: creates metadata file ......................................................................
sanlock: creates metadata file Creates the metadata file is shared by all hosts participating in the engine high availability cluster. Each host is assigned a 4KiB chunk according to its host id, with a corresponding offset of host_id*4KiB. The initial 4KiB of the file are reserved for shared state such as a global engine ha maintenance bit. Change-Id: I8862209fe2fd783aaeab04d2c655afd9e1a10396 Bug-Url: https://bugzilla.redhat.com/1008501 Signed-off-by: Sandro Bonazzola <sbona...@redhat.com> --- M src/ovirt_hosted_engine_setup/constants.py M src/plugins/ovirt-hosted-engine-setup/sanlock/lockspace.py M src/plugins/ovirt-hosted-engine-setup/storage/storage.py 3 files changed, 19 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup refs/changes/92/19292/1 diff --git a/src/ovirt_hosted_engine_setup/constants.py b/src/ovirt_hosted_engine_setup/constants.py index f31f5e2..c67315a 100644 --- a/src/ovirt_hosted_engine_setup/constants.py +++ b/src/ovirt_hosted_engine_setup/constants.py @@ -177,6 +177,8 @@ HA_AGENT_SERVICE = 'ovirt-ha-agent' HA_BROCKER_SERVICE = 'ovirt-ha-broker' HOSTED_ENGINE_VM_NAME = 'HostedEngine' + METADATA_CHUNK_SIZE = 4096 + MAX_HOST_ID = 250 @util.export diff --git a/src/plugins/ovirt-hosted-engine-setup/sanlock/lockspace.py b/src/plugins/ovirt-hosted-engine-setup/sanlock/lockspace.py index 3b5808f..72c6c52 100644 --- a/src/plugins/ovirt-hosted-engine-setup/sanlock/lockspace.py +++ b/src/plugins/ovirt-hosted-engine-setup/sanlock/lockspace.py @@ -136,6 +136,10 @@ metadatadir, lockspace + '.lockspace' ) + metadata_file = os.path.join( + metadatadir, + lockspace + '.metadata' + ) host_id = self.environment[ohostedcons.StorageEnv.HOST_ID] self.logger.debug( ( @@ -168,6 +172,18 @@ lockspace=lockspace, path=lease_file, ) + if os.path.exists(metadata_file): + self.logger.info(_('sanlock metadata already initialized')) + else: + self.logger.info(_('Initializing sanlock metadata')) + with VirtUserContext( + environment=self.environment, + umask=stat.S_IXUSR | stat.S_IXGRP | stat.S_IRWXO, + ): + with open(metadata_file, 'wb') as f: + chunk = b'\x00' * ohostedcons.Const.METADATA_CHUNK_SIZE + for _i in range(ohostedcons.Const.MAX_HOST_ID + 1): + f.write(chunk) # vim: expandtab tabstop=4 shiftwidth=4 diff --git a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py index 1e7bf86..2bf64ab 100644 --- a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py +++ b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py @@ -420,7 +420,7 @@ prevLVER = -1 recoveryMode = -1 scsiFencing = 'false' - maxHostID = 250 + maxHostID = ohostedcons.Const.MAX_HOST_ID version = 3 status, status_uuid = self.serv.spmStart(args=[ spUUID, -- To view, visit http://gerrit.ovirt.org/19292 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8862209fe2fd783aaeab04d2c655afd9e1a10396 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-hosted-engine-setup Gerrit-Branch: master Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches