1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

lvmdbusd: Ensure lvm shell still exists

This commit is contained in:
Tony Asleson 2016-10-07 13:45:30 -05:00
parent 088b3d036a
commit 2e941beb44

View File

@ -75,6 +75,8 @@ class LVMShellProxy(object):
report += tmp.decode("utf-8") report += tmp.decode("utf-8")
if len(tmp) != 16384: if len(tmp) != 16384:
break break
else:
break
elif r == self.lvm_shell.stderr.fileno(): elif r == self.lvm_shell.stderr.fileno():
while True: while True:
@ -84,6 +86,10 @@ class LVMShellProxy(object):
else: else:
break break
# Check to see if the lvm process died on us
if self.lvm_shell.poll():
raise Exception(self.lvm_shell.returncode, "%s" % stderr)
except IOError as ioe: except IOError as ioe:
log_debug(str(ioe)) log_debug(str(ioe))
pass pass
@ -171,6 +177,11 @@ class LVMShellProxy(object):
error_msg = "" error_msg = ""
json_result = "" json_result = ""
if self.lvm_shell.poll():
raise Exception(
self.lvm_shell.returncode,
"Underlying lvm shell process is not present!")
# create the command string # create the command string
cmd = " ".join(_quote_arg(arg) for arg in argv) cmd = " ".join(_quote_arg(arg) for arg in argv)
cmd += "\n" cmd += "\n"
@ -222,7 +233,7 @@ if __name__ == "__main__":
end = time.time() end = time.time()
print(("RC: %d" % ret)) print(("RC: %d" % ret))
# print(("OUT:\n%s" % out)) print(("OUT:\n%s" % out))
print(("ERR:\n%s" % err)) print(("ERR:\n%s" % err))
print("Command = %f seconds" % (end - start)) print("Command = %f seconds" % (end - start))