diff options
author | Tony Asleson <tasleson@redhat.com> | 2021-06-10 13:26:15 -0500 |
---|---|---|
committer | Tony Asleson <tasleson@redhat.com> | 2021-06-16 12:19:02 -0500 |
commit | e8f3a63000e692b00070b337e475fd4a38e1f1c9 (patch) | |
tree | a1b0b1a9afb76ba3aeaa91826af67c40db4ee78f | |
parent | 27abb03a0d5fb8342741c306b0ce187f41f8e3c1 (diff) | |
download | lvm2-e8f3a63000e692b00070b337e475fd4a38e1f1c9.tar.gz |
lvmdbusd: Don't setup search key unless needed
self.lvm_id is a property which actually executes some code which doesn't
need to be executed everytime.
-rw-r--r-- | daemons/lvmdbusd/automatedproperties.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/daemons/lvmdbusd/automatedproperties.py b/daemons/lvmdbusd/automatedproperties.py index b5919484d..d9f2c5e9f 100644 --- a/daemons/lvmdbusd/automatedproperties.py +++ b/daemons/lvmdbusd/automatedproperties.py @@ -157,14 +157,15 @@ class AutomatedProperties(dbus.service.Object): if not self._ap_search_method: return 0 - search = self.lvm_id - if search_key: - search = search_key - # Either we have the new object state or we need to go fetch it if object_state: new_state = object_state else: + if search_key: + search = search_key + else: + search = self.lvm_id + new_state = self._ap_search_method([search])[0] assert isinstance(new_state, State) |