mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone

Blame SOURCES/lvm2-2_03_03-lvmdbusd-Handle-exported-VG-s.patch

146ac4
 daemons/lvmdbusd/cmdhandler.py         | 3 ++-
146ac4
 daemons/lvmdbusd/lvm_shell_proxy.py.in | 5 ++++-
146ac4
 2 files changed, 6 insertions(+), 2 deletions(-)
146ac4
146ac4
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
146ac4
index a9177c5..fde7f5e 100644
146ac4
--- a/daemons/lvmdbusd/cmdhandler.py
146ac4
+++ b/daemons/lvmdbusd/cmdhandler.py
146ac4
@@ -497,7 +497,8 @@ def lvm_full_report_json():
146ac4
 	])
146ac4
 
146ac4
 	rc, out, err = call(cmd)
146ac4
-	if rc == 0:
146ac4
+	# When we have an exported vg the exit code of lvs or fullreport will be 5
146ac4
+	if rc == 0 or rc == 5:
146ac4
 		# With the current implementation, if we are using the shell then we
146ac4
 		# are using JSON and JSON is returned back to us as it was parsed to
146ac4
 		# figure out if we completed OK or not
146ac4
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py.in b/daemons/lvmdbusd/lvm_shell_proxy.py.in
146ac4
index 203de6f..b76b336 100644
146ac4
--- a/daemons/lvmdbusd/lvm_shell_proxy.py.in
146ac4
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py.in
146ac4
@@ -220,7 +220,10 @@ class LVMShellProxy(object):
146ac4
 
146ac4
 		# Parse the report to see what happened
146ac4
 		if 'log' in report_json:
146ac4
-			if report_json['log'][-1:][0]['log_ret_code'] == '1':
146ac4
+			ret_code = int(report_json['log'][-1:][0]['log_ret_code'])
146ac4
+			# If we have an exported vg we get a log_ret_code == 5 when
146ac4
+			# we do a 'fullreport'
146ac4
+			if (ret_code == 1) or (ret_code == 5 and argv[0] == 'fullreport'):
146ac4
 				rc = 0
146ac4
 			else:
146ac4
 				error_msg = self.get_error_msg()