Federico Simoncelli has posted comments on this change. Change subject: lib: add create function to the qemuImg module ......................................................................
Patch Set 1: (1 comment) .................................................... File lib/vdsm/qemuImg.py Line 87: Line 88: return info Line 89: Line 90: Line 91: def create(image, size=None, format=None, backing=None, backingFormat=None): On the contrary, I don't think it's awkward, it's just how qemu-img works. The mandatory arguments are image and size: qemuImg.create("myimage.img", 1024**3) The format by default is "raw", so you can omit it, but if you want you can still specify it easily: qemuImg.create("myimage.img", 1024**3, qemuImg.FORMAT.QCOW2) Now you might say that you prefer always being explicit about the format, that's a good practice, agreed, but it has nothing to do with writing a wrapper where the goal is to expose the exact behavior of the command. The only reason for size being optional is that it can be automatically detected when a backing file is specified: qemuImg.create("myimage.img", ..., backing="mybacking.img") Now, the reason for not checking the size/backing presence is that we don't want to re-write checks, we'll rely on qemu-img failing (triggering the QImgError exception). Line 92: cmd = [_qemuimg.cmd, "create"] Line 93: Line 94: if format: Line 95: cmd.extend(("-f", format)) -- To view, visit http://gerrit.ovirt.org/18935 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I69522cd6231e511d891815248fab9a15cbc987e5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli <fsimo...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Federico Simoncelli <fsimo...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches