]> sourceware.org Git - lvm2.git/commitdiff
lvmdbusd: Remove use of tmp variables
authorTony Asleson <tasleson@redhat.com>
Tue, 1 Oct 2019 20:18:46 +0000 (15:18 -0500)
committerTony Asleson <tasleson@redhat.com>
Wed, 30 Oct 2019 15:38:40 +0000 (10:38 -0500)
We can use tuple expansion from the command handler functions
directly.

daemons/lvmdbusd/lv.py
daemons/lvmdbusd/pv.py
daemons/lvmdbusd/vg.py

index f65e7da12d05abb21dececb075c52f73ea62f137..147e51cb6627024f6c5bbb149168762f5c19be8b 100644 (file)
@@ -450,8 +450,7 @@ class Lv(LvCommon):
                # Make sure we have a dbus object representing it
                LvCommon.validate_dbus_object(lv_uuid, lv_name)
                # Remove the LV, if successful then remove from the model
-               rc, out, err = cmdhandler.lv_remove(lv_name, remove_options)
-               LvCommon.handle_execute(rc, out, err)
+               LvCommon.handle_execute(*cmdhandler.lv_remove(lv_name, remove_options))
                return '/'
 
        @dbus.service.method(
@@ -471,9 +470,8 @@ class Lv(LvCommon):
                # Make sure we have a dbus object representing it
                LvCommon.validate_dbus_object(lv_uuid, lv_name)
                # Rename the logical volume
-               rc, out, err = cmdhandler.lv_rename(lv_name, new_name,
-                                                                                       rename_options)
-               LvCommon.handle_execute(rc, out, err)
+               LvCommon.handle_execute(*cmdhandler.lv_rename(lv_name, new_name,
+                                                                                               rename_options))
                return '/'
 
        @dbus.service.method(
@@ -522,13 +520,11 @@ class Lv(LvCommon):
                                remainder = space % 512
                                optional_size = space + 512 - remainder
 
-               rc, out, err = cmdhandler.vg_lv_snapshot(
-                       lv_name, snapshot_options, name, optional_size)
-               LvCommon.handle_execute(rc, out, err)
+               LvCommon.handle_execute(*cmdhandler.vg_lv_snapshot(
+                       lv_name, snapshot_options,name, optional_size))
                full_name = "%s/%s" % (dbo.vg_name_lookup(), name)
                return cfg.om.get_object_path_by_lvm_id(full_name)
 
-
        @dbus.service.method(
                dbus_interface=LV_INTERFACE,
                in_signature='stia{sv}',
@@ -564,9 +560,8 @@ class Lv(LvCommon):
                                pv_dests.append((pv_dbus_obj.lvm_id, pr[1], pr[2]))
 
                size_change = new_size_bytes - dbo.SizeBytes
-               rc, out, err = cmdhandler.lv_resize(dbo.lvm_id, size_change,
-                                                                                       pv_dests, resize_options)
-               LvCommon.handle_execute(rc, out, err)
+               LvCommon.handle_execute(*cmdhandler.lv_resize(
+                       dbo.lvm_id, size_change,pv_dests, resize_options))
                return "/"
 
        @dbus.service.method(
@@ -601,9 +596,8 @@ class Lv(LvCommon):
                                                                options):
                # Make sure we have a dbus object representing it
                LvCommon.validate_dbus_object(uuid, lv_name)
-               rc, out, err = cmdhandler.activate_deactivate(
-                       'lvchange', lv_name, activate, control_flags, options)
-               LvCommon.handle_execute(rc, out, err)
+               LvCommon.handle_execute(*cmdhandler.activate_deactivate(
+                       'lvchange', lv_name, activate, control_flags, options))
                return '/'
 
        @dbus.service.method(
@@ -637,9 +631,8 @@ class Lv(LvCommon):
        def _add_rm_tags(uuid, lv_name, tags_add, tags_del, tag_options):
                # Make sure we have a dbus object representing it
                LvCommon.validate_dbus_object(uuid, lv_name)
-               rc, out, err = cmdhandler.lv_tag(
-                       lv_name, tags_add, tags_del, tag_options)
-               LvCommon.handle_execute(rc, out, err)
+               LvCommon.handle_execute(*cmdhandler.lv_tag(
+                       lv_name, tags_add, tags_del, tag_options))
                return '/'
 
        @dbus.service.method(
@@ -699,10 +692,8 @@ class LvThinPool(Lv):
        def _lv_create(lv_uuid, lv_name, name, size_bytes, create_options):
                # Make sure we have a dbus object representing it
                dbo = LvCommon.validate_dbus_object(lv_uuid, lv_name)
-
-               rc, out, err = cmdhandler.lv_lv_create(
-                       lv_name, create_options, name, size_bytes)
-               LvCommon.handle_execute(rc, out, err)
+               LvCommon.handle_execute(*cmdhandler.lv_lv_create(
+                       lv_name, create_options, name, size_bytes))
                full_name = "%s/%s" % (dbo.vg_name_lookup(), name)
                return cfg.om.get_object_path_by_lvm_id(full_name)
 
index 9c0f1b23751d60845b9b49cc2ae89d0ad07e9ed7..8a25cbf5d5a2651984c220d84f850611b3196a06 100644 (file)
@@ -138,8 +138,7 @@ class Pv(AutomatedProperties):
                # Remove the PV, if successful then remove from the model
                # Make sure we have a dbus object representing it
                Pv.validate_dbus_object(pv_uuid, pv_name)
-               rc, out, err = cmdhandler.pv_remove(pv_name, remove_options)
-               Pv.handle_execute(rc, out, err)
+               Pv.handle_execute(*cmdhandler.pv_remove(pv_name, remove_options))
                return '/'
 
        @staticmethod
@@ -172,10 +171,8 @@ class Pv(AutomatedProperties):
        def _resize(pv_uuid, pv_name, new_size_bytes, resize_options):
                # Make sure we have a dbus object representing it
                Pv.validate_dbus_object(pv_uuid, pv_name)
-
-               rc, out, err = cmdhandler.pv_resize(pv_name, new_size_bytes,
-                                                                                               resize_options)
-               Pv.handle_execute(rc, out, err)
+               Pv.handle_execute(*cmdhandler.pv_resize(pv_name, new_size_bytes,
+                                                                                               resize_options))
                return '/'
 
        @dbus.service.method(
@@ -194,9 +191,8 @@ class Pv(AutomatedProperties):
        def _allocation_enabled(pv_uuid, pv_name, yes_no, allocation_options):
                # Make sure we have a dbus object representing it
                Pv.validate_dbus_object(pv_uuid, pv_name)
-               rc, out, err = cmdhandler.pv_allocatable(
-                       pv_name, yes_no, allocation_options)
-               Pv.handle_execute(rc, out, err)
+               Pv.handle_execute(*cmdhandler.pv_allocatable(pv_name, yes_no,
+                                                                                                               allocation_options))
                return '/'
 
        @dbus.service.method(
index cfcc53b2213d10a30c69c077e0bbb78c237b2e03..d022ff1c806336025001fa236961ce02527911dc 100644 (file)
@@ -171,9 +171,8 @@ class Vg(AutomatedProperties):
        def _rename(uuid, vg_name, new_name, rename_options):
                # Make sure we have a dbus object representing it
                Vg.validate_dbus_object(uuid, vg_name)
-               rc, out, err = cmdhandler.vg_rename(
-                       uuid, new_name, rename_options)
-               Vg.handle_execute(rc, out, err)
+               Vg.handle_execute(*cmdhandler.vg_rename(
+                       uuid, new_name, rename_options))
                return '/'
 
        @dbus.service.method(
@@ -192,8 +191,7 @@ class Vg(AutomatedProperties):
                # Make sure we have a dbus object representing it
                Vg.validate_dbus_object(uuid, vg_name)
                # Remove the VG, if successful then remove from the model
-               rc, out, err = cmdhandler.vg_remove(vg_name, remove_options)
-               Vg.handle_execute(rc, out, err)
+               Vg.handle_execute(*cmdhandler.vg_remove(vg_name, remove_options))
                return '/'
 
        @dbus.service.method(
@@ -209,8 +207,7 @@ class Vg(AutomatedProperties):
        @staticmethod
        def _change(uuid, vg_name, change_options):
                Vg.validate_dbus_object(uuid, vg_name)
-               rc, out, err = cmdhandler.vg_change(change_options, vg_name)
-               Vg.handle_execute(rc, out, err)
+               Vg.handle_execute(*cmdhandler.vg_change(change_options, vg_name))
                return '/'
 
        # TODO: This should be broken into a number of different methods
@@ -246,9 +243,8 @@ class Vg(AutomatedProperties):
                                                VG_INTERFACE,
                                                'PV Object path not found = %s!' % pv_op)
 
-               rc, out, err = cmdhandler.vg_reduce(vg_name, missing, pv_devices,
-                                                                                       reduce_options)
-               Vg.handle_execute(rc, out, err)
+               Vg.handle_execute(*cmdhandler.vg_reduce(
+                       vg_name, missing, pv_devices, reduce_options))
                return '/'
 
        @dbus.service.method(
@@ -278,9 +274,8 @@ class Vg(AutomatedProperties):
                                        VG_INTERFACE, 'PV Object path not found = %s!' % i)
 
                if len(extend_devices):
-                       rc, out, err = cmdhandler.vg_extend(vg_name, extend_devices,
-                                                                                               extend_options)
-                       Vg.handle_execute(rc, out, err)
+                       Vg.handle_execute(*cmdhandler.vg_extend(
+                               vg_name, extend_devices, extend_options))
                else:
                        raise dbus.exceptions.DBusException(
                                VG_INTERFACE, 'No pv_object_paths provided!')
@@ -334,10 +329,8 @@ class Vg(AutomatedProperties):
 
                                pv_dests.append((pv_dbus_obj.lvm_id, pr[1], pr[2]))
 
-               rc, out, err = cmdhandler.vg_lv_create(
-                       vg_name, create_options, name, size_bytes, pv_dests)
-
-               Vg.handle_execute(rc, out, err)
+               Vg.handle_execute(*cmdhandler.vg_lv_create(
+                       vg_name, create_options, name, size_bytes, pv_dests))
                return Vg.fetch_new_lv(vg_name, name)
 
        @dbus.service.method(
@@ -375,11 +368,8 @@ class Vg(AutomatedProperties):
                        thin_pool, create_options):
                # Make sure we have a dbus object representing it
                Vg.validate_dbus_object(uuid, vg_name)
-
-               rc, out, err = cmdhandler.vg_lv_create_linear(
-                       vg_name, create_options, name, size_bytes, thin_pool)
-
-               Vg.handle_execute(rc, out, err)
+               Vg.handle_execute(*cmdhandler.vg_lv_create_linear(
+                       vg_name, create_options, name, size_bytes, thin_pool))
                return Vg.fetch_new_lv(vg_name, name)
 
        @dbus.service.method(
@@ -401,10 +391,9 @@ class Vg(AutomatedProperties):
                        stripe_size_kb, thin_pool, create_options):
                # Make sure we have a dbus object representing it
                Vg.validate_dbus_object(uuid, vg_name)
-               rc, out, err = cmdhandler.vg_lv_create_striped(
+               Vg.handle_execute(*cmdhandler.vg_lv_create_striped(
                        vg_name, create_options, name, size_bytes,
-                       num_stripes, stripe_size_kb, thin_pool)
-               Vg.handle_execute(rc, out, err)
+                       num_stripes, stripe_size_kb, thin_pool))
                return Vg.fetch_new_lv(vg_name, name)
 
        @dbus.service.method(
@@ -429,9 +418,8 @@ class Vg(AutomatedProperties):
                        num_copies, create_options):
                # Make sure we have a dbus object representing it
                Vg.validate_dbus_object(uuid, vg_name)
-               rc, out, err = cmdhandler.vg_lv_create_mirror(
-                       vg_name, create_options, name, size_bytes, num_copies)
-               Vg.handle_execute(rc, out, err)
+               Vg.handle_execute(*cmdhandler.vg_lv_create_mirror(
+                       vg_name, create_options, name, size_bytes, num_copies))
                return Vg.fetch_new_lv(vg_name, name)
 
        @dbus.service.method(
@@ -454,10 +442,9 @@ class Vg(AutomatedProperties):
                                                num_stripes, stripe_size_kb, create_options):
                # Make sure we have a dbus object representing it
                Vg.validate_dbus_object(uuid, vg_name)
-               rc, out, err = cmdhandler.vg_lv_create_raid(
+               Vg.handle_execute(*cmdhandler.vg_lv_create_raid(
                        vg_name, create_options, name, raid_type, size_bytes,
-                       num_stripes, stripe_size_kb)
-               Vg.handle_execute(rc, out, err)
+                       num_stripes, stripe_size_kb))
                return Vg.fetch_new_lv(vg_name, name)
 
        @dbus.service.method(
@@ -555,9 +542,8 @@ class Vg(AutomatedProperties):
                                raise dbus.exceptions.DBusException(
                                        VG_INTERFACE, 'PV object path = %s not found' % p)
 
-               rc, out, err = cmdhandler.pv_tag(
-                       pv_devices, tags_add, tags_del, tag_options)
-               Vg.handle_execute(rc, out, err)
+               Vg.handle_execute(*cmdhandler.pv_tag(
+                       pv_devices, tags_add, tags_del, tag_options))
                return '/'
 
        @dbus.service.method(
@@ -598,9 +584,8 @@ class Vg(AutomatedProperties):
                # Make sure we have a dbus object representing it
                Vg.validate_dbus_object(uuid, vg_name)
 
-               rc, out, err = cmdhandler.vg_tag(
-                       vg_name, tags_add, tags_del, tag_options)
-               Vg.handle_execute(rc, out, err)
+               Vg.handle_execute(*cmdhandler.vg_tag(
+                       vg_name, tags_add, tags_del, tag_options))
                return '/'
 
        @dbus.service.method(
@@ -639,8 +624,7 @@ class Vg(AutomatedProperties):
        def _vg_change_set(uuid, vg_name, method, value, options):
                # Make sure we have a dbus object representing it
                Vg.validate_dbus_object(uuid, vg_name)
-               rc, out, err = method(vg_name, value, options)
-               Vg.handle_execute(rc, out, err)
+               Vg.handle_execute(*method(vg_name, value, options))
                return '/'
 
        @dbus.service.method(
@@ -700,9 +684,8 @@ class Vg(AutomatedProperties):
                                                                options):
                # Make sure we have a dbus object representing it
                Vg.validate_dbus_object(uuid, vg_name)
-               rc, out, err = cmdhandler.activate_deactivate(
-                       'vgchange', vg_name, activate, control_flags, options)
-               Vg.handle_execute(rc, out, err)
+               Vg.handle_execute(*cmdhandler.activate_deactivate(
+                       'vgchange', vg_name, activate, control_flags, options))
                return '/'
 
        @dbus.service.method(
This page took 0.051557 seconds and 5 git commands to generate.