From: Tony Asleson Date: Tue, 8 Oct 2019 13:03:50 +0000 (-0500) Subject: lvmdbustest.py: Add cache LV rename test X-Git-Tag: v2_03_07~99 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=5b224d58f7cb72852c0bad87d3a0b4fb9250b132;p=lvm2.git lvmdbustest.py: Add cache LV rename test --- diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py index 1e4d40d80..c589fd115 100755 --- a/test/dbus/lvmdbustest.py +++ b/test/dbus/lvmdbustest.py @@ -1455,6 +1455,39 @@ class TestDbusService(unittest.TestCase): vg.Remove(dbus.Int32(g_tmo), EOD)) self.assertTrue(rc == '/') + def test_cache_lv_rename(self): + """ + Make sure that if we rename a cache lv that we correctly handle the + internal state update. + :return: + """ + vg, cache_pool = self._create_cache_pool() + + lv_to_cache = self._create_lv(size=mib(8), vg=vg) + + c_lv_path = self.handle_return( + cache_pool.CachePool.CacheLv( + dbus.ObjectPath(lv_to_cache.object_path), + dbus.Int32(g_tmo), + EOD)) + + # Make sure we only have expected # of cached LV + cur_objs, _ = get_objects() + self.assertEqual(len(cur_objs[CACHE_LV_INT]), 2) + + cached_lv = ClientProxy(self.bus, c_lv_path, + interfaces=(LV_COMMON_INT, LV_INT, + CACHE_LV_INT)) + new_name = 'renamed_' + cached_lv.LvCommon.Name + + self.handle_return(cached_lv.Lv.Rename(dbus.String(new_name), + dbus.Int32(g_tmo), EOD)) + + # Make sure we only have expected # of cached LV + cur_objs, _ = get_objects() + self.assertEqual(len(cur_objs[CACHE_LV_INT]), 2) + self._check_consistency() + def test_vg_change(self): vg_proxy = self._vg_create()