Nir Soffer has posted comments on this change.
Change subject: core: Expose API for qemuimg commit ......................................................................
Patch Set 6:
(3 comments)
https://gerrit.ovirt.org/#/c/64222/6/lib/vdsm/qemuimg.py File lib/vdsm/qemuimg.py:
Line 186: Line 187: Line 188: def commit(top, topFormat, base=None): Line 189: cmd = [_qemuimg.cmd, "commit", "-p", "-t", "none"] Line 190: # For simplicity, we always run commit in the working directory. in the image directory Line 191: workdir = os.path.dirname(top) Line 192: Line 193: if base: Line 194: cmd.extend(("-b", base))
Line 196: # If base volume is not provided, qemuimg commit will empty the top Line 197: # volume after the operation has succeeded. Providing '-d' option Line 198: # will cause qemuimg commit not to empty the top volume. Note that Line 199: # if a backing chain is provided, i.e. a base volume is provided, Line 200: # '-d' is always implied. See my comment about this comment in previous version. Line 201: cmd.append("-d") Line 202: Line 203: cmd.extend(("-f", topFormat)) Line 204:
Line 202: Line 203: cmd.extend(("-f", topFormat)) Line 204: Line 205: cmd.append(top) Line 206: We use workdir only here, so better create it just before we use it. Smaller scope leave no place for bugs. Line 207: return QemuImgOperation(cmd, cwd=workdir) Line 208: Line 209: Line 210: class QemuImgOperation(object):