Ala Hino has uploaded a new change for review.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
qemuimg: Add wrapper to execute command
Add wrapper to execute qemuimg command and raise QImgError if error encountered.
Change-Id: I3483a202f9543098ad75e8be8bf4b398d26c8e4a Signed-off-by: Ala Hino ahino@redhat.com --- M lib/vdsm/qemuimg.py 1 file changed, 11 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/65178/1
diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py index ef98149..c9e72ec 100644 --- a/lib/vdsm/qemuimg.py +++ b/lib/vdsm/qemuimg.py @@ -71,9 +71,7 @@ cmd.extend(("-f", format))
cmd.append(image) - rc, out, err = commands.execCmd(cmd, raw=True) - if rc != 0: - raise QImgError(rc, out, err) + out = _run_cmd(cmd)
try: qemu_info = _parse_qemuimg_json(out) @@ -125,10 +123,7 @@ if size is not None: cmd.append(str(size))
- rc, out, err = commands.execCmd(cmd, cwd=cwdPath) - - if rc != 0: - raise QImgError(rc, out, err) + _run_cmd(cmd, cwd=cwdPath)
def check(image, format=None): @@ -138,11 +133,7 @@ cmd.extend(("-f", format))
cmd.append(image) - rc, out, err = commands.execCmd(cmd, raw=True) - - # FIXME: handle different error codes and raise errors accordingly - if rc != 0: - raise QImgError(rc, out, err) + out = _run_cmd(cmd)
try: qemu_check = _parse_qemuimg_json(out) @@ -300,10 +291,7 @@ cmd.extend(("-f", format))
cmd.extend((image, str(newSize))) - rc, out, err = commands.execCmd(cmd) - - if rc != 0: - raise QImgError(rc, out, err) + _run_cmd(cmd)
def rebase(image, backing, format=None, backingFormat=None, unsafe=False, @@ -351,3 +339,10 @@ if value not in _QCOW2_COMPAT_SUPPORTED: raise ValueError("Invalid compat version %r" % value) return value + + +def _run_cmd(cmd, cwd=None): + rc, out, err = commands.execCmd(cmd, raw=True, cwd=cwd) + if rc != 0: + raise QImgError(rc, out, err) + return out
gerrit-hooks has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 1:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 2:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
Nir Soffer has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 2:
(3 comments)
https://gerrit.ovirt.org/#/c/65178/2/lib/vdsm/qemuimg.py File lib/vdsm/qemuimg.py:
Line 86: if format: Line 87: cmd.extend(("-f", format)) Line 88: Line 89: cmd.append(image) Line 90: out = _run_cmd(cmd, raw=True) raw=True is not needed, it enforced by _run_cmd. Line 91: Line 92: try: Line 93: qemu_info = _parse_qemuimg_json(out) Line 94: except ValueError:
Line 148: if format: Line 149: cmd.extend(("-f", format)) Line 150: Line 151: cmd.append(image) Line 152: out = _run_cmd(cmd, raw=True) raw=True is not needed, it enforced by _run_cmd. Line 153: Line 154: try: Line 155: qemu_check = _parse_qemuimg_json(out) Line 156: except ValueError:
Line 360: Line 361: def _run_cmd(cmd, cwd=None): Line 362: rc, out, err = commands.execCmd(cmd, raw=True, cwd=cwd) Line 363: if rc != 0: Line 364: raise QImgError(rc, out, err) cmd missing
gerrit-hooks has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 3:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
Ala Hino has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 2:
(3 comments)
https://gerrit.ovirt.org/#/c/65178/2/lib/vdsm/qemuimg.py File lib/vdsm/qemuimg.py:
Line 86: if format: Line 87: cmd.extend(("-f", format)) Line 88: Line 89: cmd.append(image) Line 90: out = _run_cmd(cmd, raw=True)
raw=True is not needed, it enforced by _run_cmd.
Done Line 91: Line 92: try: Line 93: qemu_info = _parse_qemuimg_json(out) Line 94: except ValueError:
Line 148: if format: Line 149: cmd.extend(("-f", format)) Line 150: Line 151: cmd.append(image) Line 152: out = _run_cmd(cmd, raw=True)
raw=True is not needed, it enforced by _run_cmd.
Done Line 153: Line 154: try: Line 155: qemu_check = _parse_qemuimg_json(out) Line 156: except ValueError:
Line 360: Line 361: def _run_cmd(cmd, cwd=None): Line 362: rc, out, err = commands.execCmd(cmd, raw=True, cwd=cwd) Line 363: if rc != 0: Line 364: raise QImgError(rc, out, err)
cmd missing
Done
gerrit-hooks has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 4:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 5:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
Nir Soffer has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 5: Code-Review+1
Please fix pep8 errors in this topic.
gerrit-hooks has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 6:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 7:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
Ala Hino has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 7: Verified+1
Nir Soffer has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 7:
Waiting for Adam review.
Nir Soffer has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 7: Code-Review+2
Lets move faster, If Adam has issues with this we will enhance this later.
Nir Soffer has submitted this change and it was merged.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
qemuimg: Add wrapper to execute command
Add wrapper to execute qemuimg command and raise QImgError if error encountered.
Change-Id: I3483a202f9543098ad75e8be8bf4b398d26c8e4a Signed-off-by: Ala Hino ahino@redhat.com Reviewed-on: https://gerrit.ovirt.org/65178 Continuous-Integration: Jenkins CI Reviewed-by: Nir Soffer nsoffer@redhat.com --- M lib/vdsm/qemuimg.py 1 file changed, 11 insertions(+), 16 deletions(-)
Approvals: Nir Soffer: Looks good to me, approved Jenkins CI: Passed CI tests Ala Hino: Verified
gerrit-hooks has posted comments on this change.
Change subject: qemuimg: Add wrapper to execute command ......................................................................
Patch Set 8:
* Update tracker: IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found.
vdsm-patches@lists.fedorahosted.org