Change in vdsm[master]: tests: FakeLVM add support for activateLVs

alitke at redhat.com alitke at redhat.com
Thu Oct 29 17:52:12 UTC 2015


Adam Litke has uploaded a new change for review.

Change subject: tests: FakeLVM add support for activateLVs
......................................................................

tests: FakeLVM add support for activateLVs

Change-Id: Ic1e2aa609263a945a55d3bac271b600c7f32ab0f
Signed-off-by: Adam Litke <alitke at redhat.com>
---
M tests/storagefakelib.py
M tests/storagefakelibTests.py
2 files changed, 33 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/47862/1

diff --git a/tests/storagefakelib.py b/tests/storagefakelib.py
index 3755ec3..1548ab9 100644
--- a/tests/storagefakelib.py
+++ b/tests/storagefakelib.py
@@ -111,7 +111,9 @@
         self.vgmd[vgName]['lv_count'] = str(lv_count)
 
     def activateLVs(self, vgName, lvNames):
-        pass
+        for lv in lvNames:
+            self.lvmd[vgName][lv]['active'] = True
+            self.lvmd[vgName][lv]['attr']['state'] = 'a'
 
     def addtag(self, vg, lv, tag):
         self.lvmd[vg][lv]['tags'] += (tag,)
diff --git a/tests/storagefakelibTests.py b/tests/storagefakelibTests.py
index 6da7190..55ed760 100644
--- a/tests/storagefakelibTests.py
+++ b/tests/storagefakelibTests.py
@@ -248,3 +248,33 @@
                          initialTag=blockVolume.TAG_VOL_UNINIT)
             lv = lvm.getLV(self.VG_NAME, self.LV_NAME)
             self.assertEqual((blockVolume.TAG_VOL_UNINIT,), lv.tags)
+
+    def test_activatelv(self):
+        """
+        Create an inactive LV and then activate it.
+
+        lvm.createLV('1ffead52-7363-4968-a8c7-3bc34504d452',
+                     '54e3378a-b2f6-46ff-b2da-a9c82522a55e',
+                     '1024', activate=False)
+        lvm.activateLVs('1ffead52-7363-4968-a8c7-3bc34504d452',
+                        ['54e3378a-b2f6-46ff-b2da-a9c82522a55e'])
+
+        print lvm.getLV('1ffead52-7363-4968-a8c7-3bc34504d452',
+                        '54e3378a-b2f6-46ff-b2da-a9c82522a55e')
+        LV(uuid='P8Y7p8-V13j-rWDp-FvGk-5AX1-zXhp-ZU4K2G',
+           name='54e3378a-b2f6-46ff-b2da-a9c82522a55e',
+           vg_name='1ffead52-7363-4968-a8c7-3bc34504d452',
+           attr=LV_ATTR(voltype='-', permission='w', allocations='i',
+                        fixedminor='-', state='a', devopen='-', target='-',
+                        zero='-'),
+           size='1073741824', seg_start_pe='0',
+           devices='/dev/mapper/360014054d75cb132d474c0eae9825766(0)', tags=(),
+           writeable=True, opened=False, active=True)
+        """
+        with self.base_config() as lvm:
+            lvm.createLV(self.VG_NAME, self.LV_NAME, str(self.LV_SIZE_MB),
+                         activate=False)
+            lvm.activateLVs(self.VG_NAME, [self.LV_NAME])
+            lv = lvm.getLV(self.VG_NAME, self.LV_NAME)
+            self.assertTrue(lv.active)
+            self.assertEqual('a', lv.attr.state)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1e2aa609263a945a55d3bac271b600c7f32ab0f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>


More information about the vdsm-patches mailing list