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:
# 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)
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> "
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"
% (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