1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvmdbusd: Add test for DataLv & MetaDataLv

Added tests which expose an issue found with these properties.
This commit is contained in:
Tony Asleson 2016-06-10 13:36:53 -05:00
parent cdf06044e1
commit a1febff857

View File

@ -158,6 +158,58 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(rc == '/')
self.assertEqual(self._refresh(), 0)
def _create_raid5_thin_pool(self, vg = None):
if not vg:
pv_paths = []
for pp in self.objs[PV_INT]:
pv_paths.append(pp.object_path)
vg = self._vg_create(pv_paths).Vg
lv_meta_path = vg.LvCreateRaid(
"meta_r5", "raid5", mib(4), 0, 0, -1, {})[0]
lv_data_path = vg.LvCreateRaid(
"data_r5", "raid5", mib(16), 0, 0, -1, {})[0]
thin_pool_path = vg.CreateThinPool(
lv_meta_path, lv_data_path, -1, {})[0]
# Get thin pool client proxy
thin_pool = ClientProxy(self.bus, thin_pool_path)
return vg, thin_pool
def test_meta_lv_data_lv_props(self):
# Ensure that metadata lv and data lv for thin pools and cache pools
# point to a valid LV
(vg, thin_pool) = self._create_raid5_thin_pool()
# Check properties on thin pool
self.assertTrue(thin_pool.ThinPool.DataLv != '/')
self.assertTrue(thin_pool.ThinPool.MetaDataLv != '/')
(vg, cache_pool) = self._create_cache_pool(vg)
self.assertTrue(cache_pool.CachePool.DataLv != '/')
self.assertTrue(cache_pool.CachePool.MetaDataLv != '/')
# Cache the thin pool
cached_thin_pool_path = cache_pool.\
CachePool.CacheLv(thin_pool.object_path, -1, {})[0]
# Get object proxy for cached thin pool
cached_thin_pool_object = ClientProxy(self.bus, cached_thin_pool_path)
# Check properties on cache pool
self.assertTrue(cached_thin_pool_object.ThinPool.DataLv != '/')
self.assertTrue(cached_thin_pool_object.ThinPool.MetaDataLv != '/')
self.assertTrue(cached_thin_pool_path != '/')
def _lookup(self, lvm_id):
return self.objs[MANAGER_INT][0].Manager.LookUpByLvmId(lvm_id)
@ -974,8 +1026,10 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(job_path != '/')
self._wait_for_job(job_path)
def _create_cache_pool(self):
vg = self._vg_create().Vg
def _create_cache_pool(self, vg=None):
if not vg:
vg = self._vg_create().Vg
md = self._create_lv(size=(mib(8)), vg=vg)
data = self._create_lv(size=(mib(8)), vg=vg)
@ -985,7 +1039,7 @@ class TestDbusService(unittest.TestCase):
cp = ClientProxy(self.bus, cache_pool_path)
return (vg, cp)
return vg, cp
def test_cache_pool_create(self):