]> sourceware.org Git - lvm2.git/commitdiff
lvmdbusd: Disable notify_dbus for service command use
authorTony Asleson <tasleson@redhat.com>
Wed, 8 Mar 2017 21:35:53 +0000 (15:35 -0600)
committerTony Asleson <tasleson@redhat.com>
Thu, 9 Mar 2017 22:39:47 +0000 (16:39 -0600)
Utilizing the --config option  we will utilize global/notify_dbus=0 so
that the service itself doesn't generate change events which it then needs to
process.

daemons/lvmdbusd/cmdhandler.py
daemons/lvmdbusd/lvm_shell_proxy.py
daemons/lvmdbusd/utils.py

index 31b7c5c55207bda8cdd2b77770911f7dd02186b4..cbf6036f2a0f9e1584da627694927b3b16c1eb30 100644 (file)
@@ -16,7 +16,7 @@ import traceback
 import os
 
 from lvmdbusd import cfg
-from lvmdbusd.utils import pv_dest_ranges, log_debug, log_error
+from lvmdbusd.utils import pv_dest_ranges, log_debug, log_error, add_no_notify
 from lvmdbusd.lvm_shell_proxy import LVMShellProxy
 
 try:
@@ -93,6 +93,7 @@ def call_lvm(command, debug=False):
        # Prepend the full lvm executable so that we can run different versions
        # in different locations on the same box
        command.insert(0, cfg.LVM_CMD)
+       command = add_no_notify(command)
 
        process = Popen(command, stdout=PIPE, stderr=PIPE, close_fds=True,
                                        env=os.environ)
index f3862a169391277af6433238b9404a8737def455..a26dd704b2f420135aaf739c7705b14acaa58a76 100755 (executable)
@@ -29,7 +29,7 @@ except ImportError:
 
 
 from lvmdbusd.cfg import LVM_CMD
-from lvmdbusd.utils import log_debug, log_error
+from lvmdbusd.utils import log_debug, log_error, add_no_notify
 
 SHELL_PROMPT = "lvm> "
 
@@ -206,6 +206,8 @@ class LVMShellProxy(object):
                                self.lvm_shell.returncode,
                                "Underlying lvm shell process is not present!")
 
+               argv = add_no_notify(argv)
+
                # create the command string
                cmd = " ".join(_quote_arg(arg) for arg in argv)
                cmd += "\n"
index b95f80a3f0400e6198883f75699b8e404479f26b..bf2552cc005acc4ca3b12665c75df94d21396026 100644 (file)
@@ -499,6 +499,28 @@ def validate_tag(interface, tag):
                        % (tag, _ALLOWABLE_TAG_CH))
 
 
+def add_no_notify(cmdline):
+       """
+       Given a command line to execute we will see if `--config` is present, if it
+       is we will add the global/notify_dbus=0 to it, otherwise we will append it
+       to the end
+       :param cmdline:
+       :return: cmdline with notify_dbus config option present
+       """
+
+       if 'help' in cmdline:
+               return cmdline
+
+       if '--config' in cmdline:
+               for i in range(0, len(cmdline)):
+                       if cmdline[i] == '--config':
+                               cmdline[i] += "global/notify_dbus=0"
+                               break
+       else:
+               cmdline.extend(['--config', 'global/notify_dbus=0'])
+       return cmdline
+
+
 # The methods below which start with mt_* are used to execute the desired code
 # on the the main thread of execution to alleviate any issues the dbus-python
 # library with regards to multi-threaded access.  Essentially, we are trying to
This page took 0.03721 seconds and 5 git commands to generate.