main - lvmdbusd: Register for SIGTERM
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9c2ed7422105c59446c...
Commit: 9c2ed7422105c59446c4d8a894c87feb37c5de7a
Parent: d88998f5163f84aa7305edfeb9ec51dc5b0c6733
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Sep 20 14:28:57 2022 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Tue Sep 20 16:37:01 2022 -0500
lvmdbusd: Register for SIGTERM
Ensure we log that we are exiting on this signal too.
---
daemons/lvmdbusd/main.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/daemons/lvmdbusd/main.py b/daemons/lvmdbusd/main.py
index ac309aa69..e4531526c 100644
--- a/daemons/lvmdbusd/main.py
+++ b/daemons/lvmdbusd/main.py
@@ -80,6 +80,7 @@ def install_signal_handlers():
signal_add(GLib.PRIORITY_HIGH, signal.SIGINT, utils.handler, signal.SIGINT)
signal_add(GLib.PRIORITY_HIGH, signal.SIGUSR1, utils.handler, signal.SIGUSR1)
signal_add(GLib.PRIORITY_HIGH, signal.SIGUSR2, utils.handler, signal.SIGUSR2)
+ signal_add(GLib.PRIORITY_HIGH, signal.SIGTERM, utils.handler, signal.SIGTERM)
else:
log_error("GLib.unix_signal_[add|add_full] are NOT available!")
1 year, 7 months
main - lvmdbusd: Correct get_object_path_by_uuid_lvm_id
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d88998f5163f84aa730...
Commit: d88998f5163f84aa7305edfeb9ec51dc5b0c6733
Parent: a0fc61177e1fc39a312c623c4fa3639f8b96f7b2
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Sep 20 11:40:15 2022 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Tue Sep 20 16:36:53 2022 -0500
lvmdbusd: Correct get_object_path_by_uuid_lvm_id
When checking to see if the PV is missing we incorrectly checked that the
path_create was equal to PV creation. However, there are cases where we
are doing a lookup where the path_create == None. In this case, we would
fail to set lvm_id == None which caused a problem as we had more than 1
PV that was missing. When this occurred, the second lookup matched the
first missing PV that was added to the object manager. This resulted in
the following:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/lvmdbusd/utils.py", line 667, in _run
self.rc = self.f(*self.args)
File "/usr/lib/python3.9/site-packages/lvmdbusd/fetch.py", line 25, in _main_thread_load
(changes, remove) = load_pvs(
File "/usr/lib/python3.9/site-packages/lvmdbusd/pv.py", line 46, in load_pvs
return common(
File "/usr/lib/python3.9/site-packages/lvmdbusd/loader.py", line 55, in common
del existing_paths[dbus_object.dbus_object_path()]
Because we expect to find the object in existing_paths if we found it in
the lookup.
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2085078
---
daemons/lvmdbusd/lvmdb.py.in | 5 ++++-
daemons/lvmdbusd/objectmanager.py | 7 +++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/daemons/lvmdbusd/lvmdb.py.in b/daemons/lvmdbusd/lvmdb.py.in
index 8d0cc59e1..41fedb80f 100644
--- a/daemons/lvmdbusd/lvmdb.py.in
+++ b/daemons/lvmdbusd/lvmdb.py.in
@@ -360,10 +360,13 @@ class DataStore(object):
return rc
def pv_missing(self, pv_uuid):
+ # The uuid might not be a PV, default to false
if pv_uuid in self.pvs:
if self.pvs[pv_uuid]['pv_missing'] == '':
return False
- return True
+ else:
+ return True
+ return False
def fetch_vgs(self, vg_name):
if not vg_name:
diff --git a/daemons/lvmdbusd/objectmanager.py b/daemons/lvmdbusd/objectmanager.py
index b84e16904..f9586ec9a 100644
--- a/daemons/lvmdbusd/objectmanager.py
+++ b/daemons/lvmdbusd/objectmanager.py
@@ -300,10 +300,9 @@ class ObjectManager(AutomatedProperties):
# If a PV is missing its device path is '[unknown]' or some
# other text derivation of unknown. When we find that a PV is
- # missing we will clear out the lvm_id as it's likely not unique
- # and thus not useful and potentially harmful for lookups.
- if path_create == pv_obj_path_generate and \
- cfg.db.pv_missing(uuid):
+ # missing we will clear out the lvm_id as it's not unique
+ # and thus not useful and harmful for lookups.
+ if cfg.db.pv_missing(uuid):
lvm_id = None
# Lets check for the uuid first
1 year, 7 months
master - make: Fix build in chroot
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a0fc61177e1fc39a312...
Commit: a0fc61177e1fc39a312c623c4fa3639f8b96f7b2
Parent: 178564317a7c47d025ce268abe1bba01d1b4a519
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Tue Sep 20 15:56:13 2022 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Sep 20 15:56:13 2022 +0200
make: Fix build in chroot
When building in a buildroot, must create libexec directory explicitly.
---
scripts/Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 9fcff37b0..47b24a2b0 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -57,6 +57,7 @@ install_device-mapper: $(DM_SCRIPTS:.sh=_install)
install_ocf: $(OCF_SCRIPTS:.ocf=_install)
install_libexec:
+ $(Q) $(INSTALL_DIR) $(libexecdir)
$(Q) $(INSTALL_SCRIPT) lvresize_fs_helper.sh $(libexecdir)/lvresize_fs_helper
install: install_lvm2 install_ocf install_device-mapper install_libexec
1 year, 7 months
master - spec: Workaround for failing build
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=178564317a7c47d025c...
Commit: 178564317a7c47d025ce268abe1bba01d1b4a519
Parent: 868665766491d9d42b8acedaf07cafc7118d165c
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Tue Sep 20 15:12:44 2022 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Sep 20 15:12:44 2022 +0200
spec: Workaround for failing build
Commit 18722dfdf4d3e6f172d0b2af8bbdc4a154ea1dc0 introduced a dependency
on file from tools/ into lib/.
TODO: revert this once the issue is resolved.
---
spec/build.inc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/spec/build.inc b/spec/build.inc
index e57ecf958..e5f76db10 100644
--- a/spec/build.inc
+++ b/spec/build.inc
@@ -33,7 +33,8 @@
%build
-%configure %{configure_flags}
+# FIXME: Remove --enable-dependency-tracking once problem with generated file from tools/ is used in lib/
+%configure %{configure_flags} --enable-dependency-tracking
make %{?_smp_mflags}
%{?extra_build_commands}
1 year, 7 months
main - lvmdbusd: Remove --reportformat
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=868665766491d9d42b8...
Commit: 868665766491d9d42b8acedaf07cafc7118d165c
Parent: 3d3c517b0b4206adec9673b52ad931a64805af13
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed Sep 14 13:11:47 2022 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Fri Sep 16 10:49:37 2022 -0500
lvmdbusd: Remove --reportformat
Latest upstream build of lvm results in the following error when
trying to use lvmshell.
"Argument --reportformat cannot be used in interactive mode.,
Error during parsing of command line."
---
daemons/lvmdbusd/cmdhandler.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 0e344d3ca..0c7bd8528 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -608,8 +608,7 @@ def lvm_full_report_json():
'--configreport', 'vg', '-o', ','.join(vg_columns),
'--configreport', 'lv', '-o', ','.join(lv_columns),
'--configreport', 'seg', '-o', ','.join(lv_seg_columns),
- '--configreport', 'pvseg', '-o', ','.join(pv_seg_columns),
- '--reportformat', 'json'
+ '--configreport', 'pvseg', '-o', ','.join(pv_seg_columns)
])
# We are running the fullreport command, we will ask lvm to output the debug
1 year, 7 months
main - lvmdbustest: Add wrapper for injecting errors
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3d3c517b0b4206adec9...
Commit: 3d3c517b0b4206adec9673b52ad931a64805af13
Parent: 11c033c222bde7122b974464dbfb8d3c8734b19b
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Sep 9 16:05:11 2022 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Fri Sep 16 10:49:37 2022 -0500
lvmdbustest: Add wrapper for injecting errors
Useful for forcing lvmdbusd down error paths.
---
test/dbus/lvm_error_inject.py | 323 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 323 insertions(+)
diff --git a/test/dbus/lvm_error_inject.py b/test/dbus/lvm_error_inject.py
new file mode 100755
index 000000000..454b80171
--- /dev/null
+++ b/test/dbus/lvm_error_inject.py
@@ -0,0 +1,323 @@
+#!/usr/bin/python3
+
+# Simulate errors by doing the following for both lvm and lvm shell:
+# Randomly return
+# - Bad exit code
+# - Exit code 5 (exported VG)
+# - Truncated JSON
+# - Missing key in JSON
+#
+# This is done by sitting between lvm dbusd and lvm. If running via systemd, add the following to the service file
+# Environment="LVM_BINARY=/path/to/this file/lvm2/test/dbus/lvm_error_inject.py"
+# systemctl daemon-reload
+# systemctl restart lvm2-lvmdbusd
+import copy
+import json
+import os
+import pty
+import random
+import select
+import string
+import subprocess
+import sys
+import tempfile
+import traceback
+from collections import deque
+from fcntl import fcntl, F_GETFL, F_SETFL
+from subprocess import Popen
+
+
+CS = string.ascii_letters + "\n\t " + string.digits
+
+
+def rs(length, character_set=CS):
+ return ''.join(random.choice(character_set) for _ in range(length))
+
+
+RS = rs(512)
+
+d_out = open("/tmp/mitm_lvm.txt", "w+")
+
+
+def debug(msg):
+ m = str(msg)
+ d_out.write(m)
+ if m[-1] != "\n":
+ d_out.write("\n")
+ d_out.flush()
+
+
+# Make stream non-blocking
+def make_non_block(stream):
+ flags = fcntl(stream, F_GETFL)
+ fcntl(stream, F_SETFL, flags | os.O_NONBLOCK)
+
+
+def read_decoded(stream):
+ tmp = stream.read()
+ if tmp:
+ return tmp.decode("utf-8")
+ return ''
+
+
+def write_some(q, stream, remaining=False, binary=False):
+ if len(q) > 0:
+ if remaining:
+ to_send = len(q)
+ else:
+ to_send = random.randint(1, len(q))
+
+ for _ in range(0, to_send):
+ c = q.popleft()
+ if binary:
+ stream.write(bytes(c, "utf-8"))
+ else:
+ stream.write(c)
+ stream.flush()
+
+
+def del_random_key(src_dict):
+ keys = list(src_dict.keys())
+ pick = random.randint(0, len(keys) - 1)
+ del src_dict[keys[pick]]
+
+
+def inject_key_error(output_json):
+ debug("Deleting a key")
+ for r in output_json['report']:
+ if 'lv' in r:
+ for i in r['lv']:
+ del_random_key(i)
+ break
+ if 'vg' in r:
+ for i in r["vg"]:
+ del_random_key(i)
+ break
+ elif 'pv' in r:
+ for i in r["pv"]:
+ del_random_key(i)
+ break
+
+
+def inject_exit_error(output_json, val):
+ if 'log' in output_json and len(output_json['log']) > 0:
+ debug("Returning bad exit code")
+ # Change the exit code to failure
+ output_json['log'][-1:][0]['log_ret_code'] = "%d" % val
+ else:
+ # We are in fork & exec mode, just exit.
+ if val == 0:
+ sys.exit(1)
+ sys.exit(val)
+
+
+def inject_error(output_str, output_json=None):
+ try:
+ if random.randint(0, 9) == 1:
+ error_case = random.randint(0, 3)
+ if error_case == 0:
+ debug("Truncating JSON")
+ # Create bad JSON by truncating it
+ str_rep = output_str[:-len(output_str) // 2]
+ rc = str_rep
+ else:
+ if output_json is None:
+ output_json = json.loads(output_str)
+ if error_case == 1:
+ inject_key_error(output_json)
+ elif error_case == 2:
+ debug("Returning bad exit code")
+ inject_exit_error(output_json, 0)
+ else:
+ debug("Returning exit code 5")
+ inject_exit_error(output_json, 5)
+
+ rc = json.dumps(output_json) + "\n"
+ else:
+ rc = output_str
+ except Exception as e:
+ debug("Exception %s occurred: JSON = \n%s\n" % (str(e), output_str))
+ sys.exit(100)
+
+ return rc
+
+
+def run_one(cmd):
+ debug("run_one(%s)" % str(cmd))
+ result = subprocess.run(cmd, capture_output=True, text=True)
+
+ if "fullreport" in cmd:
+ sys.stdout.write(inject_error(result.stdout))
+ else:
+ sys.stdout.write(result.stdout)
+ sys.stdout.flush()
+ sys.stderr.write(result.stderr)
+ sys.stderr.flush()
+ return result.returncode
+
+
+class LvmShellHandler:
+
+ def __init__(self, cmd):
+ debug(os.environ)
+
+ self.d_stdout = deque()
+ self.d_stderr = deque()
+ self.d_report = deque()
+
+ tmp_dir = tempfile.mkdtemp(prefix="pipeinmiddle_")
+ self.tmp_file = "%s/middle_man_report" % tmp_dir
+
+ # Let's create a fifo for the report output
+ os.mkfifo(self.tmp_file, 0o600)
+
+ self.child_report_fd = os.open(self.tmp_file, os.O_NONBLOCK)
+ self.child_report_stream = os.fdopen(self.child_report_fd, 'rb', 0)
+ passed_report_fd = os.open(self.tmp_file, os.O_WRONLY)
+
+ debug("passed_report_fd = %d" % passed_report_fd)
+
+ # The report FD from who executed us.
+ self.daemon_report_fd = int(os.environ["LVM_REPORT_FD"])
+ self.daemon_report_stream = os.fdopen(self.daemon_report_fd, "wb", 0)
+
+ env = copy.deepcopy(os.environ)
+ env["LVM_REPORT_FD"] = "%s" % str(passed_report_fd)
+
+ self.parent_stdin_fd, child_stdin_fd = pty.openpty()
+ self.parent_stdout_fd, child_stdout_fd = pty.openpty()
+ self.parent_stderr_fd, child_stderr_fd = pty.openpty()
+ self.parent_stdin = os.fdopen(self.parent_stdin_fd, "w")
+ self.parent_stdout = os.fdopen(self.parent_stdout_fd, "r")
+ self.parent_stderr = os.fdopen(self.parent_stderr_fd, "r")
+
+ debug("exec'ing %s" % cmd)
+ self.process = Popen(cmd,
+ stdin=child_stdin_fd,
+ stdout=child_stdout_fd,
+ stderr=child_stderr_fd,
+ close_fds=True,
+ env=env,
+ pass_fds=[passed_report_fd, ],
+ shell=False)
+
+ os.close(passed_report_fd)
+ os.close(child_stdin_fd)
+ os.close(child_stdout_fd)
+ os.close(child_stderr_fd)
+
+ make_non_block(self.parent_stdout_fd)
+ make_non_block(self.parent_stderr_fd)
+ make_non_block(sys.stdin)
+
+ self.report_text_in_progress = ""
+ self.last_request = ""
+
+ os.unlink(self.tmp_file)
+ os.rmdir(tmp_dir)
+
+ def _complete_response(self):
+ try:
+ _complete_json = json.loads(self.report_text_in_progress)
+ return _complete_json
+ except ValueError:
+ return None
+
+ def _write_all(self):
+ write_some(self.d_stderr, sys.stderr, remaining=True)
+ write_some(self.d_report, self.daemon_report_stream, remaining=True, binary=True)
+ write_some(self.d_stdout, sys.stdout, remaining=True)
+
+ def _handle_report(self):
+ # Read from child report stream, write to parent report stream
+ report_text = read_decoded(self.child_report_stream)
+ self.report_text_in_progress += report_text
+ report_json = self._complete_response()
+
+ # Always wait until we have a full response before we do anything with the output
+ if report_json is not None:
+ # Only add data to d_report after we have the entire JSON and have injected
+ # an error into it if we so wish, usually only for 'fullreport'
+ if "fullreport" in self.last_request:
+ self.d_report.extend(inject_error(self.report_text_in_progress, report_json))
+ else:
+ debug("Not the cmd we are looking for ...")
+ self.d_report.extend(self.report_text_in_progress)
+
+ self.report_text_in_progress = ""
+
+ def _handle_command(self):
+ stdin_text = sys.stdin.readline()
+ self.last_request = stdin_text
+
+ debug("stdin: %s..." % stdin_text[:min(10, len(stdin_text) - 1)])
+ self.parent_stdin.writelines(stdin_text)
+ self.parent_stdin.flush()
+
+ @staticmethod
+ def _empty_stream_to_queue(stream, queue):
+ read_text = stream.readlines()
+ for line in read_text:
+ queue.extend(line)
+
+ def run(self):
+ select_tmo = 0.2
+ while True:
+ try:
+ rd_fd = [sys.stdin.fileno(), self.parent_stdout_fd, self.parent_stderr_fd, self.child_report_fd]
+ ready = select.select(rd_fd, [], [], select_tmo)
+
+ if len(ready[0]) == 0:
+ write_some(self.d_stderr, sys.stderr)
+ write_some(self.d_report, self.daemon_report_stream, binary=True)
+
+ for r in ready[0]:
+ if r == self.parent_stdout_fd:
+ LvmShellHandler._empty_stream_to_queue(self.parent_stdout, self.d_stdout)
+ elif r == self.parent_stderr_fd:
+ LvmShellHandler._empty_stream_to_queue(self.parent_stderr, self.d_stderr)
+ elif r == self.child_report_fd:
+ self._handle_report()
+ elif r == sys.stdin.fileno():
+ # Read from parent stdin write to child stdin, this is a command getting issued.
+ self._handle_command()
+ else:
+ debug("FD %d not handled!" % r)
+ sys.exit(10)
+
+ # We have handled all the FDs that were ready, write some output
+ if len(self.d_stdout) > 0:
+ self._write_all()
+ else:
+ write_some(self.d_stderr, sys.stderr)
+ write_some(self.d_report, self.daemon_report_stream, binary=True)
+
+ # Check to see if child process has terminated, None when running
+ if self.process.poll() is not None:
+ self._write_all()
+ debug("child process %s exited %d" % (cmd, self.process.returncode))
+ break
+ except IOError as ioe:
+ debug("run_cmd:" + str(ioe))
+ pass
+
+ debug("exiting %d " % self.process.returncode)
+ return self.process.returncode
+
+
+if __name__ == "__main__":
+ try:
+ args = sys.argv[1:]
+
+ exe = os.getenv("LVM_MAN_IN_MIDDLE", "/usr/sbin/lvm")
+ cmdline = [exe, ]
+ if args:
+ cmdline.extend(args)
+ ec = run_one(cmdline)
+ else:
+ sh = LvmShellHandler(cmdline)
+ ec = sh.run()
+ sys.exit(ec)
+ except Exception:
+ traceback.print_exc(file=d_out)
+ sys.exit(1)
1 year, 7 months
main - lvmdbusd: Include lvm debug output for lvmshell
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=11c033c222bde7122b9...
Commit: 11c033c222bde7122b974464dbfb8d3c8734b19b
Parent: a4b7f988d88afa81fd8f1934482444f97a08d9dd
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Sep 9 10:03:35 2022 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Fri Sep 16 10:49:37 2022 -0500
lvmdbusd: Include lvm debug output for lvmshell
Move the option to add the debug file into lvm_full_report_json so that
we collect the debug data when we fork & exec lvm and when we use lvm
shell.
---
daemons/lvmdbusd/cmdhandler.py | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 1a7943f01..0e344d3ca 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -121,12 +121,6 @@ def call_lvm(command, debug=False, line_cb=None,
command.insert(0, cfg.LVM_CMD)
command = add_no_notify(command)
- # If we are running the fullreport command, we will ask lvm to output the debug
- # data, so we can have the required information for lvm to debug the fullreport failures.
- if "fullreport" in command:
- fn = cfg.lvmdebug.setup()
- add_config_option(command, "--config", "log {level=7 file=%s syslog=0}" % fn)
-
process = Popen(command, stdout=PIPE, stderr=PIPE, close_fds=True,
env=os.environ)
@@ -618,6 +612,11 @@ def lvm_full_report_json():
'--reportformat', 'json'
])
+ # We are running the fullreport command, we will ask lvm to output the debug
+ # data, so we can have the required information for lvm to debug the fullreport failures.
+ fn = cfg.lvmdebug.setup()
+ add_config_option(cmd, "--config", "log {level=7 file=%s syslog=0}" % fn)
+
rc, out, err = call(cmd)
# When we have an exported vg the exit code of lvs or fullreport will be 5
if rc == 0 or rc == 5:
1 year, 7 months
main - lvmdbusd: Call readlines instead of readline
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a4b7f988d88afa81fd8...
Commit: a4b7f988d88afa81fd8f1934482444f97a08d9dd
Parent: 8e1e40c499a0e46a0a15b9a6b470adb8fbbbbf4f
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Sep 8 15:42:26 2022 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Fri Sep 16 10:49:37 2022 -0500
lvmdbusd: Call readlines instead of readline
Better to drain everything we have now that our IO is line orientated
when using a ptty.
---
daemons/lvmdbusd/lvm_shell_proxy.py.in | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py.in b/daemons/lvmdbusd/lvm_shell_proxy.py.in
index ed2c7bc9e..0ba0ffe5c 100755
--- a/daemons/lvmdbusd/lvm_shell_proxy.py.in
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py.in
@@ -69,11 +69,13 @@ class LVMShellProxy(object):
for r in ready[0]:
if r == self.parent_stdout_fd:
- stdout += self.parent_stdout.readline()
+ for line in self.parent_stdout.readlines():
+ stdout += line
elif r == self.report_stream.fileno():
report += read_decoded(self.report_stream)
elif r == self.parent_stderr_fd:
- stderr += self.parent_stderr.readline()
+ for line in self.parent_stderr.readlines():
+ stderr += line
# Check to see if the lvm process died on us
if self.lvm_shell.poll() is not None:
1 year, 7 months
main - lvmdbusd: Raise IOError instead of ignoring
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8e1e40c499a0e46a0a1...
Commit: 8e1e40c499a0e46a0a15b9a6b470adb8fbbbbf4f
Parent: 2c5762038a7d2877dca91593ca212e0e36802dc1
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Sep 8 15:41:20 2022 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Fri Sep 16 10:49:37 2022 -0500
lvmdbusd: Raise IOError instead of ignoring
We end up in a bad state if we simply eat IOErrors here. Exit the lvmshell
process and raise the IOError.
---
daemons/lvmdbusd/lvm_shell_proxy.py.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py.in b/daemons/lvmdbusd/lvm_shell_proxy.py.in
index 244fe93f5..ed2c7bc9e 100755
--- a/daemons/lvmdbusd/lvm_shell_proxy.py.in
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py.in
@@ -108,7 +108,8 @@ class LVMShellProxy(object):
except IOError as ioe:
log_debug(str(ioe))
- pass
+ self.exit_shell()
+ raise ioe
if keep_reading and run.value == 0:
# We didn't complete as we are shutting down
1 year, 7 months
main - lvmdbusd: Correct log_error for shell proxy
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2c5762038a7d2877dca...
Commit: 2c5762038a7d2877dca91593ca212e0e36802dc1
Parent: d51fb57f1abf9e24aa8c74df5ffd717e2d45c103
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Sep 8 15:40:03 2022 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Fri Sep 16 10:49:37 2022 -0500
lvmdbusd: Correct log_error for shell proxy
---
daemons/lvmdbusd/lvm_shell_proxy.py.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py.in b/daemons/lvmdbusd/lvm_shell_proxy.py.in
index fb6ce6164..244fe93f5 100755
--- a/daemons/lvmdbusd/lvm_shell_proxy.py.in
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py.in
@@ -297,7 +297,7 @@ if __name__ == "__main__":
except EOFError:
pass
except Exception as e:
- log_error("main process exiting on exception!\n%s", extract_stack_trace(e))
+ log_error("main process exiting on exception!\n%s" % extract_stack_trace(e))
sys.exit(1)
sys.exit(0)
1 year, 7 months