Ryan Barry has uploaded a new change for review. Change subject: Log about non-zero exit codes from lvm displays, try partials ......................................................................
Log about non-zero exit codes from lvm displays, try partials For non-destructive operations (like listing volume groups), keep track of non-zero exits and log them, but it's probably ok to continue. Try to use partial volume groups with missing devs (-P) to avoid this in the first place Change-Id: If8ff2930ca97731af512d0dfede441dc7aeea785 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1269338 Signed-off-by: Ryan Barry <[email protected]> --- M src/ovirt/node/utils/system.py M src/ovirtnode/storage.py 2 files changed, 14 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/90/47090/1 diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py index 472d0bb..84ff003 100755 --- a/src/ovirt/node/utils/system.py +++ b/src/ovirt/node/utils/system.py @@ -1299,12 +1299,23 @@ @classmethod def _query_vgs(self, option, pv=None): - cmd = ["lvm", "vgs", "--noheadings", "-o", option] + cmd = ["lvm", "vgs", "-P", "--noheadings", "-o", option] if pv: cmd.append(pv) - out = process.check_output(cmd).strip() + out = None + try: + out = process.check_output(cmd).strip() + except process.CalledProcessError as e: + # For just displaying vgs, we can probably ignore warnings + # about partial vgs + if e.returncode == 5 or "Couldn't find device with uuid" in \ + e.output: + self.logger.warning("Non-zero exit code when displaying vgs. " + "Please check the output of 'lvm vgs', " + "too verbose to log here") + vgs = None # If not VGs are found, just simulate an empty list of VGs diff --git a/src/ovirtnode/storage.py b/src/ovirtnode/storage.py index 5d43100..5d8d971 100644 --- a/src/ovirtnode/storage.py +++ b/src/ovirtnode/storage.py @@ -195,7 +195,7 @@ def _lvm_name_for_disk(self, disk): name = None - cmd = "lvm pvs --noheadings --nameprefixes --unquoted -o pv_name,vg_name '%s' 2> /dev/null" % disk + cmd = "lvm pvs --noheadings --nameprefixes --unquoted -P -o pv_name,vg_name '%s' 2> /dev/null" % disk lines = str(_functions.passthrough(cmd)).strip().split("\n") if len(lines) > 1: logger.warning("More than one PV for disk '%s' found: %s" % (disk, -- To view, visit https://gerrit.ovirt.org/47090 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If8ff2930ca97731af512d0dfede441dc7aeea785 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node Gerrit-Branch: master Gerrit-Owner: Ryan Barry <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
