mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
lvmdbusd: Handle SIGINT quietly
Change how we exit on SIGINT so that we don't output needless debug.
This commit is contained in:
parent
0296e56073
commit
e6e874922e
@ -170,7 +170,7 @@ def call_lvm(command, debug=False, line_cb=None,
|
||||
return process.returncode, stdout_text, stderr_text
|
||||
else:
|
||||
if cfg.run.value == 0:
|
||||
raise Exception("Daemon is exiting!")
|
||||
raise SystemExit
|
||||
# We can bail out before the lvm command finished when we get a signal
|
||||
# which is requesting we exit
|
||||
return -errno.EINTR, "", "operation interrupted"
|
||||
|
@ -154,6 +154,8 @@ class StateUpdate(object):
|
||||
obj.deferred = False
|
||||
|
||||
if len(queued_requests) == 0 and wait:
|
||||
# Note: If we don't have anything for 2 seconds we will
|
||||
# get a queue.Empty exception raised here
|
||||
queued_requests.append(obj.queue.get(True, 2))
|
||||
|
||||
# Ok we have one or the deferred queue has some,
|
||||
@ -192,6 +194,8 @@ class StateUpdate(object):
|
||||
|
||||
except queue.Empty:
|
||||
pass
|
||||
except SystemExit:
|
||||
break
|
||||
except Exception as e:
|
||||
exception_count += 1
|
||||
if exception_count >= 5:
|
||||
|
@ -109,6 +109,13 @@ class LVMShellProxy(object):
|
||||
log_debug(str(ioe))
|
||||
pass
|
||||
|
||||
if keep_reading and run.value == 0:
|
||||
# We didn't complete as we are shutting down
|
||||
# Try to clean up lvm shell process
|
||||
log_debug("exiting lvm shell as we are shutting down")
|
||||
self.exit_shell()
|
||||
raise SystemExit
|
||||
|
||||
return stdout, report_json, stderr
|
||||
|
||||
def _write_cmd(self, cmd):
|
||||
@ -226,16 +233,10 @@ class LVMShellProxy(object):
|
||||
error_msg = 'No error reason provided! (missing "log" section)'
|
||||
|
||||
if debug or rc != 0:
|
||||
log_error(('CMD: %s' % cmd))
|
||||
log_error(("EC = %d" % rc))
|
||||
log_error(("CMD= %s" % cmd))
|
||||
log_error(("EC= %d" % rc))
|
||||
log_error(("ERROR_MSG=\n %s\n" % error_msg))
|
||||
|
||||
if run.value == 0:
|
||||
# Try to clean up lvm shelll process
|
||||
log_debug("exiting lvm shell as we are shutting down")
|
||||
self.exit_shell()
|
||||
raise Exception("Daemon is exiting!")
|
||||
|
||||
return rc, report_json, error_msg
|
||||
|
||||
def exit_shell(self):
|
||||
|
@ -50,6 +50,8 @@ def process_request():
|
||||
log_debug("Method complete: %s" % str(req.method))
|
||||
except queue.Empty:
|
||||
pass
|
||||
except SystemExit:
|
||||
break
|
||||
except Exception:
|
||||
st = traceback.format_exc()
|
||||
utils.log_error("process_request exception: \n%s" % st)
|
||||
|
@ -71,6 +71,9 @@ class RequestEntry(object):
|
||||
try:
|
||||
result = self.method(*self.arguments)
|
||||
self.register_result(result)
|
||||
except SystemExit as se:
|
||||
self.register_error(-1, str(se), se)
|
||||
raise se
|
||||
except Exception as e:
|
||||
# Use the request entry to return the result as the client may
|
||||
# have gotten a job by the time we hit an error
|
||||
|
Loading…
Reference in New Issue
Block a user