Nir Soffer has posted comments on this change.
Change subject: [WIP] core: Expose API for qemuimg commit
......................................................................
Patch Set 4:
(5 comments)
https://gerrit.ovirt.org/#/c/64222/4/lib/vdsm/qemuimg.py
File lib/vdsm/qemuimg.py:
Line 184:
Line 185: return QemuImgOperation(cmd, cwd=cwdPath)
Line 186:
Line 187:
Line 188: def commit(top, topFormat=None, base=None):
We should require topFormat, more secure to never let qemu detect the format.
Line 189: cmd = [_qemuimg.cmd, "commit", "-p"]
Line 190: cwdir = None
Line 191:
Line 192: if base:
Line 185: return QemuImgOperation(cmd, cwd=cwdPath)
Line 186:
Line 187:
Line 188: def commit(top, topFormat=None, base=None):
Line 189: cmd = [_qemuimg.cmd, "commit", "-p"]
Add -t none.
Line 190: cwdir = None
Line 191:
Line 192: if base:
Line 193: cmd.extend(("-b", base))
Line 186:
Line 187:
Line 188: def commit(top, topFormat=None, base=None):
Line 189: cmd = [_qemuimg.cmd, "commit", "-p"]
Line 190: cwdir = None
workdir?
Line 191:
Line 192: if base:
Line 193: cmd.extend(("-b", base))
Line 194: if not os.path.isabs(base):
Line 191:
Line 192: if base:
Line 193: cmd.extend(("-b", base))
Line 194: if not os.path.isabs(base):
Line 195: cwdir = cwdPath = os.path.dirname(base)
Lets always use workdir, to simplify the code.
Line 196: else:
Line 197: # If base volume is not provided, qemuimg commit will empty the top
Line 198: # volume after the operation has succeeded. Providing '-d'
option
Line 199: # will cause qemuimg commit not to empty the top volume. Note that
Line 201: # '-d' is always implied.
Line 202: cmd.append("-d")
Line 203:
Line 204: if topFormat:
Line 205: cmd.extend(("-f", str(topFormat)))
str not needed
Line 206:
Line 207: cmd.append(top)
Line 208:
Line 209: return QemuImgOperation(cmd, cwd=cwdir)
--
To view, visit
https://gerrit.ovirt.org/64222
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: If7a13be40541fb268541bd8614a642263b96b487
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ala Hino <ahino(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: Yes