Adam Litke has uploaded a new change for review.
Change subject: tests: FakeLVM create inactive LV ......................................................................
tests: FakeLVM create inactive LV
Test that the 'activate' argument of createLV results in the appropriate values in the LV properties.
Change-Id: I304e00116c5dc4c98555eb3951fe8eb33d65da7f Signed-off-by: Adam Litke alitke@redhat.com --- M tests/storagefakelib.py M tests/storagefakelibTests.py 2 files changed, 30 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/60/47860/1
diff --git a/tests/storagefakelib.py b/tests/storagefakelib.py index 52dce33..3c20a7c 100644 --- a/tests/storagefakelib.py +++ b/tests/storagefakelib.py @@ -83,11 +83,12 @@ # works the same as for LVM). Since we don't need this value, use None devices = None
+ state = 'a' if activate else '-' lv_attr = dict(voltype='-', permission='w', allocations='i', fixedminor='-', - state='a', + state=state, devopen='-', target='-', zero='-') @@ -101,7 +102,7 @@ tags=(), writeable=True, opened=False, - active=True) + active=bool(activate))
vg_dict = self.lvmd.setdefault(vgName, {}) vg_dict[lvName] = lv_md diff --git a/tests/storagefakelibTests.py b/tests/storagefakelibTests.py index a80a9a2..7be6c10 100644 --- a/tests/storagefakelibTests.py +++ b/tests/storagefakelibTests.py @@ -195,3 +195,30 @@ with self.base_config() as lvm: lv = self.lv_config(lvm) self.assertIsNone(lv.devices) + + def test_lv_no_activate(self): + """ + Create a logical volume with activate=False. + + lvm.createLV('1ffead52-7363-4968-a8c7-3bc34504d452', + '54e3378a-b2f6-46ff-b2da-a9c82522a55e', + '1024', activate=False) + + print lvm.getLV('1ffead52-7363-4968-a8c7-3bc34504d452', + '54e3378a-b2f6-46ff-b2da-a9c82522a55e') + LV(uuid='dDbzkJ-RSAQ-0CdJ-1pTD-OdqZ-3my2-v3hSUT', + name='54e3378a-b2f6-46ff-b2da-a9c82522a55e', + vg_name='1ffead52-7363-4968-a8c7-3bc34504d452', + attr=LV_ATTR(voltype='-', permission='w', allocations='i', + fixedminor='-', state='-', devopen='-', target='-', + zero='-'), + size='1073741824', seg_start_pe='0', + devices='/dev/mapper/360014054d75cb132d474c0eae9825766(0)', tags=(), + writeable=True, opened=False, active=False) + """ + with self.base_config() as lvm: + lvm.createLV(self.VG_NAME, self.LV_NAME, str(self.LV_SIZE_MB), + activate=False) + lv = lvm.getLV(self.VG_NAME, self.LV_NAME) + self.assertFalse(lv.active) + self.assertEqual('-', lv.attr.state)