0ac26d8208
Tumbleweed VM virtinst-pvgrub2-bootloader.patch - fate#320353 - Add the ability for virt-convirt to decompress compressed files in an OVA f11eb00b-virt-convert-decompress-gz-files-before-converting.patch - bsc#951726 - Error - 'wrong number of arguments (3 for 1) ...' when attempting to create DomU through the yast virt-manager.spec OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=301
54 lines
1.9 KiB
Diff
54 lines
1.9 KiB
Diff
References: fate#320353
|
|
|
|
Subject: virt-convert: decompress the .gz files before converting
|
|
From: Lin Ma lma@suse.com Mon Mar 7 18:39:23 2016 +0800
|
|
Date: Wed Mar 9 20:06:16 2016 -0500:
|
|
Git: f11eb00b9a630b7b8dbd9ad2ed7333b7a5303fd2
|
|
|
|
The OVF specification v1.1.0(page 15) indicates that "Each file
|
|
referenced by a File element may be compressed using gzip
|
|
(see RFC1952)."
|
|
|
|
In this case the .gz files should be decompressed first before
|
|
converting through qemu-img.
|
|
|
|
Signed-off-by: Lin Ma <lma@suse.com>
|
|
|
|
Index: virt-manager-1.3.2/virtconv/formats.py
|
|
===================================================================
|
|
--- virt-manager-1.3.2.orig/virtconv/formats.py
|
|
+++ virt-manager-1.3.2/virtconv/formats.py
|
|
@@ -240,6 +240,8 @@ class VirtConverter(object):
|
|
"""
|
|
binnames = ["qemu-img", "kvm-img"]
|
|
|
|
+ decompress_cmd = None
|
|
+
|
|
if _is_test():
|
|
executable = "/usr/bin/qemu-img"
|
|
else:
|
|
@@ -252,12 +254,23 @@ class VirtConverter(object):
|
|
raise RuntimeError(_("None of %s tools found.") % binnames)
|
|
|
|
base = os.path.basename(absin)
|
|
+ ext = os.path.splitext(base)[1]
|
|
+ if (ext and ext[1:] == "gz"):
|
|
+ if not find_executable("gzip"):
|
|
+ raise RuntimeError("'gzip' is needed to decompress the file, "
|
|
+ "but not found.")
|
|
+ decompress_cmd = ["gzip", "-d", absin]
|
|
+ base = os.path.splitext(base)[0]
|
|
+ absin = absin[0:-3]
|
|
+ self.print_cb("Running %s" % " ".join(decompress_cmd))
|
|
cmd = [executable, "convert", "-O", disk_format, base, absout]
|
|
self.print_cb("Running %s" % " ".join(cmd))
|
|
if dry:
|
|
return
|
|
|
|
cmd[4] = absin
|
|
+ if decompress_cmd is not None:
|
|
+ _run_cmd(decompress_cmd)
|
|
_run_cmd(cmd)
|
|
|
|
def convert_disks(self, disk_format, destdir=None, dry=False):
|