8000 qemuimg: log warning on cmd error by aesteve-rh · Pull Request #356 · oVirt/vdsm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

qemuimg: log warning on cmd error #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/vdsm/storage/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ class Command(object):
"""

def __init__(self, cmd, cwd=None, nice=utils.NICENESS.HIGH,
ioclass=utils.IOCLASS.IDLE):
ioclass=utils.IOCLASS.IDLE, warn_stderr=False):
self._cmd = cmd
self._cwd = cwd
self._nice = nice
self._ioclass = ioclass
self._lock = threading.Lock()
self._state = CREATED
self._proc = None
self._warn_stderr = warn_stderr

def run(self):
"""
Expand Down Expand Up @@ -150,7 +151,12 @@ def _finalize(self, out, err):
`RuntimeError` if operation state is invalid
"""
rc = self._proc.returncode
log.debug(cmdutils.retcode_log_line(rc, err))
if rc == 0 and self._warn_stderr and err:
log.warning(
"Command %s succeeded with warnings: %s", self._cmd, err)
else:
log.debug("%s", cmdutils.retcode_log_line(rc, err))

with self._lock:
self._proc = None
if self._state == ABORTING:
Expand Down
2 changes: 1 addition & 1 deletion lib/vdsm/storage/qemuimg.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ class ProgressCommand(object):
REGEXPR = re.compile(br'\s*\(([\d.]+)/100%\)\s*')

def __init__(self, cmd, cwd=None):
self._operation = operation.Command(cmd, cwd=cwd)
self._operation = operation.Command(cmd, cwd=cwd, warn_stderr=True)
self._progress = 0.0

def run(self):
Expand Down
0