Sandro Bonazzola has uploaded a new change for review.

Change subject: WIP: workaround for shared:exclusive
......................................................................

WIP: workaround for shared:exclusive

Temporary workaround while we're waiting for
VDSM to be able to properly support shared:exclusive.

Change-Id: I4141f7604ad4dc2357a2a080dd72c00bff524037
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M src/plugins/ovirt-hosted-engine-setup/sanlock/lockspace.py
1 file changed, 42 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/18/19518/1

diff --git a/src/plugins/ovirt-hosted-engine-setup/sanlock/lockspace.py 
b/src/plugins/ovirt-hosted-engine-setup/sanlock/lockspace.py
index 72c6c52..78e58b4 100644
--- a/src/plugins/ovirt-hosted-engine-setup/sanlock/lockspace.py
+++ b/src/plugins/ovirt-hosted-engine-setup/sanlock/lockspace.py
@@ -74,7 +74,7 @@
     def __init__(self, context):
         super(Plugin, self).__init__(context=context)
 
-    def _get_metadata_path(self):
+    def _get_domain_path(self):
         """
         Return path of storage domain holding engine vm
         """
@@ -94,10 +94,7 @@
                     root=ohostedcons.FileLocations.SD_MOUNT_PARENT_DIR,
                 )
             )
-        return os.path.join(
-            domains[0],
-            ohostedcons.FileLocations.SD_METADATA_DIR_NAME,
-        )
+        return domains[0]
 
     @plugin.event(
         stage=plugin.Stages.STAGE_INIT
@@ -130,7 +127,10 @@
             ],
             state=True,
         )
-        metadatadir = self._get_metadata_path()
+        metadatadir = os.path.join(
+            self._get_domain_path(),
+            ohostedcons.FileLocations.SD_METADATA_DIR_NAME,
+        )
         lockspace = self.environment[ohostedcons.SanlockEnv.LOCKSPACE_NAME]
         lease_file = os.path.join(
             metadatadir,
@@ -185,5 +185,41 @@
                     for _i in range(ohostedcons.Const.MAX_HOST_ID + 1):
                         f.write(chunk)
 
+    @plugin.event(
+        stage=plugin.Stages.STAGE_SETUP,
+    )
+    def _setup(self):
+        #FIXME: remove once vdsm is able to handle shared:exclusive
+        self.command.detect('sanlock')
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_MISC,
+        condition=lambda self: not self.environment[
+            ohostedcons.CoreEnv.IS_ADDITIONAL_HOST
+        ],
+        after=(
+            ohostedcons.Stages.STORAGE_POOL_DISCONNECTED,
+        ),
+        before=(
+            ohostedcons.Stages.VM_CONFIGURED,
+        ),
+    )
+    def _workaround(self):
+        #FIXME: remove once vdsm is able to handle shared:exclusive
+        self.execute(
+            (
+                self.command.get('sanlock'),
+                'client',
+                'add_lockspace',
+                '-s',
+                '"{sdUUID}:{host_id}:{domain_path}/dom_md/ids:0"'.format(
+                    sdUUID=self.environment[ohostedcons.StorageEnv.SD_UUID],
+                    host_id=self.environment[ohostedcons.StorageEnv.HOST_ID],
+                    domain_path=self._get_domain_path(),
+                ),
+            ),
+            raiseOnError=True
+        )
+
 
 # vim: expandtab tabstop=4 shiftwidth=4


-- 
To view, visit http://gerrit.ovirt.org/19518
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4141f7604ad4dc2357a2a080dd72c00bff524037
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to