]> sourceware.org Git - lvm2.git/commitdiff
lvmdbustest.py: Add cache LV rename test
authorTony Asleson <tasleson@redhat.com>
Tue, 8 Oct 2019 13:03:50 +0000 (08:03 -0500)
committerTony Asleson <tasleson@redhat.com>
Wed, 30 Oct 2019 15:38:40 +0000 (10:38 -0500)
test/dbus/lvmdbustest.py

index 1e4d40d802c32263ca468be8b875cbc3e4a09d10..c589fd115b337edcda60f9d1f7adc7242439c3db 100755 (executable)
@@ -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()
 
This page took 0.040444 seconds and 5 git commands to generate.