From: Vratislav Podzimek <vpodzime(a)redhat.com>
No changes in values or API except for how LVs are created.
---
tests/devicefactory_test.py | 4 ++--
tests/devices_test/lvm_test.py | 39 +++++++++------------------------------
tests/devicetree_test.py | 10 +++++-----
3 files changed, 16 insertions(+), 37 deletions(-)
diff --git a/tests/devicefactory_test.py b/tests/devicefactory_test.py
index 0545f2b..9f0516d 100644
--- a/tests/devicefactory_test.py
+++ b/tests/devicefactory_test.py
@@ -11,7 +11,6 @@
from blivet.devices import DiskFile
from blivet.devices import LUKSDevice
from blivet.devices import LVMLogicalVolumeDevice
-from blivet.devices import LVMThinLogicalVolumeDevice
from blivet.devices import MDRaidArrayDevice
from blivet.devices import PartitionDevice
from blivet.errors import RaidError
@@ -422,7 +421,8 @@ def test_get_container(self):
class LVMThinPFactoryTestCase(LVMFactoryTestCase):
- device_class = LVMThinLogicalVolumeDevice
+ # TODO: check that the LV we get is a thin pool
+ device_class = LVMLogicalVolumeDevice
device_type = devicefactory.DEVICE_TYPE_LVM_THINP
encryption_supported = False
diff --git a/tests/devices_test/lvm_test.py b/tests/devices_test/lvm_test.py
index 14cb8f1..be13337 100644
--- a/tests/devices_test/lvm_test.py
+++ b/tests/devices_test/lvm_test.py
@@ -6,10 +6,6 @@
from blivet.devices import StorageDevice
from blivet.devices import LVMLogicalVolumeDevice
-from blivet.devices import LVMSnapShotDevice
-from blivet.devices import LVMThinLogicalVolumeDevice
-from blivet.devices import LVMThinPoolDevice
-from blivet.devices import LVMThinSnapShotDevice
from blivet.devices import LVMVolumeGroupDevice
from blivet.devices.lvm import LVMCacheRequest
from blivet.devices.lvm import LVPVSpec
@@ -18,10 +14,6 @@
DEVICE_CLASSES = [
LVMLogicalVolumeDevice,
- LVMSnapShotDevice,
- LVMThinLogicalVolumeDevice,
- LVMThinPoolDevice,
- LVMThinSnapShotDevice,
LVMVolumeGroupDevice,
StorageDevice
]
@@ -37,20 +29,17 @@ def test_lvmsnap_shot_device_init(self):
lv = LVMLogicalVolumeDevice("testlv", parents=[vg],
fmt=blivet.formats.get_format("xfs"))
- with self.assertRaisesRegex(ValueError, "lvm snapshot devices require an
origin lv"):
- LVMSnapShotDevice("snap1", parents=[vg])
-
with self.assertRaisesRegex(ValueError, "lvm snapshot origin volume must
already exist"):
- LVMSnapShotDevice("snap1", parents=[vg], origin=lv)
+ LVMLogicalVolumeDevice("snap1", parents=[vg], origin=lv)
with self.assertRaisesRegex(ValueError, "lvm snapshot origin must be a
logical volume"):
- LVMSnapShotDevice("snap1", parents=[vg], origin=pv)
+ LVMLogicalVolumeDevice("snap1", parents=[vg], origin=pv)
with self.assertRaisesRegex(ValueError, "only existing vorigin snapshots are
supported"):
- LVMSnapShotDevice("snap1", parents=[vg], vorigin=True)
+ LVMLogicalVolumeDevice("snap1", parents=[vg], vorigin=True)
lv.exists = True
- snap1 = LVMSnapShotDevice("snap1", parents=[vg], origin=lv)
+ snap1 = LVMLogicalVolumeDevice("snap1", parents=[vg], origin=lv)
self.assertEqual(snap1.format.type, lv.format.type)
lv.format = blivet.formats.get_format("DM_snapshot_cow", exists=True)
@@ -68,22 +57,18 @@ def test_lvmthin_snap_shot_device_init(self):
pv = StorageDevice("pv1",
fmt=blivet.formats.get_format("lvmpv"),
size=Size("1 GiB"))
vg = LVMVolumeGroupDevice("testvg", parents=[pv])
- pool = LVMThinPoolDevice("pool1", parents=[vg], size=Size("500
MiB"))
- thinlv = LVMThinLogicalVolumeDevice("thinlv", parents=[pool],
- size=Size("200 MiB"))
-
- with self.assertRaisesRegex(ValueError, "lvm thin snapshots require an
origin"):
- LVMThinSnapShotDevice("snap1", parents=[pool])
+ pool = LVMLogicalVolumeDevice("pool1", parents=[vg],
size=Size("500 MiB"), seg_type="thin-pool")
+ thinlv = LVMLogicalVolumeDevice("thinlv", parents=[pool],
size=Size("200 MiB"), seg_type="thin")
with self.assertRaisesRegex(ValueError, "lvm snapshot origin volume must
already exist"):
- LVMThinSnapShotDevice("snap1", parents=[pool], origin=thinlv)
+ LVMLogicalVolumeDevice("snap1", parents=[pool], origin=thinlv,
seg_type="thin")
with self.assertRaisesRegex(ValueError, "lvm snapshot origin must be a
logical volume"):
- LVMThinSnapShotDevice("snap1", parents=[pool], origin=pv)
+ LVMLogicalVolumeDevice("snap1", parents=[pool], origin=pv,
seg_type="thin")
# now make the constructor succeed so we can test some properties
thinlv.exists = True
- snap1 = LVMThinSnapShotDevice("snap1", parents=[pool], origin=thinlv)
+ snap1 = LVMLogicalVolumeDevice("snap1", parents=[pool], origin=thinlv,
seg_type="thin")
self.assertEqual(snap1.isleaf, True)
self.assertEqual(snap1.direct, True)
self.assertEqual(thinlv.isleaf, True)
@@ -287,12 +272,6 @@ def test_lvm_logical_volume_insuf_seg_type(self):
fmt=blivet.formats.get_format("xfs"),
exists=False, pvs=[pv_spec, pv_spec2])
- # no non-linear thin pools (yet)
- with self.assertRaises(ValueError):
- lv = LVMThinPoolDevice("testlv", parents=[vg], size=Size("512
MiB"),
- fmt=blivet.formats.get_format("xfs"),
- exists=False, seg_type="striped")
-
def test_lvm_logical_volume_metadata_size(self):
pv = StorageDevice("pv1",
fmt=blivet.formats.get_format("lvmpv"),
size=Size("1025 MiB"))
diff --git a/tests/devicetree_test.py b/tests/devicetree_test.py
index e163e63..5cb2c0e 100644
--- a/tests/devicetree_test.py
+++ b/tests/devicetree_test.py
@@ -7,8 +7,8 @@
from blivet import devicefactory
from blivet import util
from blivet.udev import trigger
-from blivet.devices import LVMSnapShotDevice, LVMThinSnapShotDevice
from blivet.devices import StorageDevice
+from blivet.devices.lvm import LVMLogicalVolumeDevice
from blivet.devicetree import DeviceTree
from blivet.formats import get_format
@@ -193,8 +193,8 @@ def _set_up_storage(self):
def setUp(self):
super(BlivetResetTestCase, self).setUp() # pylint: disable=bad-super-call
root = self.blivet.lvs[0]
- snap = LVMSnapShotDevice("rootsnap1", parents=[root.vg], origin=root,
- size=Size("768MiB"))
+ snap = LVMLogicalVolumeDevice("rootsnap1", parents=[root.vg],
origin=root,
+ size=Size("768MiB"))
self.blivet.create_device(snap)
self.blivet.do_it()
@@ -227,8 +227,8 @@ def setUp(self):
super(BlivetResetTestCase, self).setUp() # pylint: disable=bad-super-call
root = self.blivet.thinlvs[0]
- snap = LVMThinSnapShotDevice("rootsnap1", parents=[root.pool],
- origin=root)
+ snap = LVMLogicalVolumeDevice("rootsnap1", parents=[root.pool],
+ origin=root)
self.blivet.create_device(snap)
self.blivet.do_it()
--
To view this commit on github, visit
https://github.com/rhinstaller/blivet/commit/556b8b40c8c23a59ba8f54f3cee8...