Change in vdsm[master]: v2v: Use tarfile instead of running tar process
nsoffer at redhat.com
nsoffer at redhat.com
Tue Dec 8 15:45:46 UTC 2015
Nir Soffer has posted comments on this change.
Change subject: v2v: Use tarfile instead of running tar process
......................................................................
Patch Set 2:
(2 comments)
https://gerrit.ovirt.org/#/c/50106/2/vdsm/v2v.py
File vdsm/v2v.py:
Line 916: raise ClientError('OVA does not contains file with .ovf suffix')
Line 917:
Line 918:
Line 919: def _read_ovf_from_tar_ova(ova_path):
Line 920: with closing(tarfile.open(ova_path)) as tar:
You don't need closing() here, since the returned file object support the context manager interface - use:
with tarfile.open(path) as tar:
...
Line 921: for member in tar:
Line 922: if member.name.endswith('.ovf'):
Line 923: with tar.extractfile(member) as ovf:
Line 924: return ovf.read()
Line 919: def _read_ovf_from_tar_ova(ova_path):
Line 920: with closing(tarfile.open(ova_path)) as tar:
Line 921: for member in tar:
Line 922: if member.name.endswith('.ovf'):
Line 923: with tar.extractfile(member) as ovf:
This does not work, the returned file-like object does not support the context manager protocol, so you must close it using "with closing()".
Line 924: return ovf.read()
Line 925: raise ClientError('OVA does not contains file with .ovf suffix')
Line 926:
Line 927:
--
To view, visit https://gerrit.ovirt.org/50106
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I5e027470f0ab283b3260fc02aafc01fe3debc95f
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list