]> sourceware.org Git - lvm2.git/commitdiff
lvmdbusd: Handle exported VG(s)
authorTony Asleson <tasleson@redhat.com>
Tue, 18 Dec 2018 15:51:50 +0000 (09:51 -0600)
committerTony Asleson <tasleson@redhat.com>
Thu, 20 Dec 2018 16:27:30 +0000 (10:27 -0600)
When a VG is exported, the 'fullreport' returns an exit code of 5, but
otherwise returns the data we are wanting.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
daemons/lvmdbusd/cmdhandler.py
daemons/lvmdbusd/lvm_shell_proxy.py.in

index a9177c5fffd912591436df5e32b794a20604065c..fde7f5e6148f349938d0d576698ac0a73cfb196c 100644 (file)
@@ -497,7 +497,8 @@ def lvm_full_report_json():
        ])
 
        rc, out, err = call(cmd)
-       if rc == 0:
+       # When we have an exported vg the exit code of lvs or fullreport will be 5
+       if rc == 0 or rc == 5:
                # With the current implementation, if we are using the shell then we
                # are using JSON and JSON is returned back to us as it was parsed to
                # figure out if we completed OK or not
index 203de6f0d84ab9837390fbd9a0c1d9d37ba4c75f..b76b336c28d0d9c2e7a31927c3964086b87f5dff 100644 (file)
@@ -220,7 +220,10 @@ class LVMShellProxy(object):
 
                # Parse the report to see what happened
                if 'log' in report_json:
-                       if report_json['log'][-1:][0]['log_ret_code'] == '1':
+                       ret_code = int(report_json['log'][-1:][0]['log_ret_code'])
+                       # If we have an exported vg we get a log_ret_code == 5 when
+                       # we do a 'fullreport'
+                       if (ret_code == 1) or (ret_code == 5 and argv[0] == 'fullreport'):
                                rc = 0
                        else:
                                error_msg = self.get_error_msg()
This page took 0.041853 seconds and 5 git commands to generate.