Timothy Asir has uploaded a new change for review.

Change subject: Add convertLV function in storage.lvm module
......................................................................

Add convertLV function in storage.lvm module

This is an useful feature to convert a logical volume
from linear to mirror or snapshot. Currently gluster bricks
needs this feature.

Change-Id: I80fe74ed9e61f58f20bd60be46109cce9b06a69c
Signed-off-by: Timothy Asir Jeyasingh <[email protected]>
---
M vdsm/storage/lvm.py
1 file changed, 21 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/38557/1

diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 8ec166e..cb8574a 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -819,6 +819,27 @@
         raise se.StorageException("%d %s %s\n%s/%s" % (rc, out, err, vg, lvs))
 
 
+def convertLV(attrs):
+    """
+    Convert a logical volume from linear to mirror or snapshot 
+
+    attrs: an iterable of (attr, value) pairs),
+            e.g. (('--available', 'y'), ('--permission', 'rw')
+    """
+
+    cmd = ["lvconvert"]
+    if isinstance(attrs[0], str):
+        # ("--attribute", "value")
+        cmd.extend(attr)
+    else:
+        # (("--aa", "v1"), ("--ab", "v2"))
+        for attr in attrs:
+            cmd.extend(attr)
+    rc, out, err = _lvminfo.cmd(tuple(cmd))
+    if rc != 0 and len(out) < 1:
+        raise se.StorageException("%d %s %s" % (rc, out, err))
+
+
 def _setLVAvailability(vg, lvs, available):
     try:
         changelv(vg, lvs, ("--available", available))


-- 
To view, visit https://gerrit.ovirt.org/38557
To unsubscribe, visit https://gerrit.ovirt.org/settings

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

Reply via email to