Change in vdsm[master]: mkimage: extract mkfloppy helper
Jenkins CI RO has abandoned this change. Change subject: mkimage: extract mkfloppy helper .. Abandoned Abandoned due to no activity - please restore if still relevant -- To view, visit https://gerrit.ovirt.org/56852 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I6f07095e0ddfd0cea5bda59cee9875ff1b7515ba Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Jenkins CI RO Gerrit-Reviewer: gerrit-hooks ___ vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org
Change in vdsm[master]: mkimage: extract mkfloppy helper
gerrit-hooks has posted comments on this change. Change subject: mkimage: extract mkfloppy helper .. Patch Set 1: * Update tracker: IGNORE, no Bug-Url found -- To view, visit https://gerrit.ovirt.org/56852 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6f07095e0ddfd0cea5bda59cee9875ff1b7515ba Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Jenkins CI RO Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org
Change in vdsm[master]: mkimage: extract mkfloppy helper
gerrit-hooks has posted comments on this change. Change subject: mkimage: extract mkfloppy helper .. 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']) -- To view, visit https://gerrit.ovirt.org/56852 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6f07095e0ddfd0cea5bda59cee9875ff1b7515ba Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: mkimage: extract mkfloppy helper
Francesco Romani has uploaded a new change for review. Change subject: mkimage: extract mkfloppy helper .. mkimage: extract mkfloppy helper A future patch wants to add a different way to create a floppy image, so we extract the common code into a shared helper. Change-Id: I6f07095e0ddfd0cea5bda59cee9875ff1b7515ba Signed-off-by: Francesco Romani --- M vdsm/mkimage.py 1 file changed, 21 insertions(+), 14 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/56852/1 diff --git a/vdsm/mkimage.py b/vdsm/mkimage.py index a737e1a..8f1ee26 100644 --- a/vdsm/mkimage.py +++ b/vdsm/mkimage.py @@ -94,25 +94,32 @@ return path +def _mkFloppyImage(floppy, volumeName=None): +command = [EXT_MKFS_MSDOS, '-C', floppy, '1440'] +if volumeName is not None: +command.extend(['-n', volumeName]) +rc, out, err = execCmd(command, raw=True) +if rc: +raise OSError(errno.EIO, "could not create floppy file: " + "code %s, out %s\nerr %s" % (rc, out, err)) + +dirname = tempfile.mkdtemp() +m = mount.Mount(floppy, dirname) +m.mount(mntOpts='loop') +try: +yield dirname +# TODO: kill floppy fs image if we get an exception? +finally: +m.umount(force=True, freeloop=True) +shutil.rmtree(dirname) + + def mkFloppyFs(vmId, files, volumeName=None): floppy = dirname = None try: floppy = _getFileName(vmId, files) -command = [EXT_MKFS_MSDOS, '-C', floppy, '1440'] -if volumeName is not None: -command.extend(['-n', volumeName]) -rc, out, err = execCmd(command, raw=True) -if rc: -raise OSError(errno.EIO, "could not create floppy file: " - "code %s, out %s\nerr %s" % (rc, out, err)) - -dirname = tempfile.mkdtemp() -m = mount.Mount(floppy, dirname) -m.mount(mntOpts='loop') -try: +with _mkFloppyImage(floppy, volumeName) as dirname: _decodeFilesIntoDir(files, dirname) -finally: -m.umount(force=True, freeloop=True) finally: _commonCleanFs(dirname, floppy) -- To view, visit https://gerrit.ovirt.org/56852 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6f07095e0ddfd0cea5bda59cee9875ff1b7515ba Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches