Yeela Kaplan has uploaded a new change for review.

Change subject: [WIP] lvm: Add an option to replace locking type 4
......................................................................

[WIP] lvm: Add an option to replace locking type 4

Replace lvm locking type 4 with locking type 1
only in case of lvm cluster safe commands.

Change-Id: I9a67a7fa20145763d8ab5cdbf293a9c3eb070067
Signed-off-by: Yeela Kaplan <[email protected]>
---
M vdsm/storage/lvm.py
1 file changed, 13 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/23645/1

diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 4f3416f..932d69e 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -257,13 +257,15 @@
 
             return self._extraCfg
 
-    def _addExtraCfg(self, cmd, devices=tuple()):
+    def _addExtraCfg(self, cmd, devices=tuple(), safe):
         newcmd = [constants.EXT_LVM, cmd[0]]
         if devices:
             conf = _buildConfig(devices)
         else:
             conf = self._getCachedExtraCfg()
 
+        if not safe:
+            conf = conf.replace("locking_type=4", "locking_type=1")
         newcmd += ["--config", conf]
 
         if len(cmd) > 1:
@@ -290,13 +292,17 @@
         self._vgs = {}
         self._lvs = {}
 
-    def cmd(self, cmd, devices=tuple()):
-        finalCmd = self._addExtraCfg(cmd, devices)
+    def cmd(self, cmd, devices=tuple(), safe=True):
+        """
+        Use safe as False only for lvm cluster safe commands.
+        These are cmds that don't change metadata of an existing VG.
+        """
+        finalCmd = self._addExtraCfg(cmd, devices, safe)
         rc, out, err = misc.execCmd(finalCmd, sudo=True)
         if rc != 0:
             # Filter might be stale
             self.invalidateFilter()
-            newCmd = self._addExtraCfg(cmd)
+            newCmd = self._addExtraCfg(cmd, safe)
             # Before blindly trying again make sure
             # that the commands are not identical, because
             # the devlist is sorted there is no fear
@@ -717,7 +723,7 @@
     cmd.extend(("--metadatasize", metadatasize, "--metadatacopies", "2",
                 "--metadataignore", "y"))
     cmd.extend(devices)
-    rc, out, err = _lvminfo.cmd(cmd, devices)
+    rc, out, err = _lvminfo.cmd(cmd, devices, False)
     return rc, out, err
 
 
@@ -929,7 +935,7 @@
     # Activate the 1st PV metadata areas
     cmd = ["pvchange", "--metadataignore", "n"]
     cmd.append(pvs[0])
-    rc, out, err = _lvminfo.cmd(cmd, tuple(pvs))
+    rc, out, err = _lvminfo.cmd(cmd, tuple(pvs), False)
     if rc != 0:
         raise se.PhysDevInitializationError(pvs[0])
 
@@ -937,7 +943,7 @@
     if initialTag:
         options.extend(("--addtag", initialTag))
     cmd = ["vgcreate"] + options + [vgName] + pvs
-    rc, out, err = _lvminfo.cmd(cmd, tuple(pvs))
+    rc, out, err = _lvminfo.cmd(cmd, tuple(pvs), False)
     if rc == 0:
         _lvminfo._invalidatepvs(pvs)
         _lvminfo._invalidatevgs(vgName)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9a67a7fa20145763d8ab5cdbf293a9c3eb070067
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to