virt-manager-3.2.0-6.el9

- installer: Prefer xorrisofs over genisoimage/mkisofs (rhbz#1973236)
- urlfetcher: Factor out ISOReader class (rhbz#1973236)
- urlfetcher: Add xorriso ISOReader implementation (rhbz#1973236)
- urlfetcher: Delete the 'isoinfo' ISOReader (rhbz#1973236)
- Add gating.yaml for RHEL-9 (rhbz#1984222)

Resolves: rhbz#1973236, rhbz#1984222
This commit is contained in:
Jonathon Jongsma 2021-07-23 15:10:11 -05:00
parent debe74c6f2
commit 119523ad88
6 changed files with 466 additions and 2 deletions

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: libvirt-ci.virt-install.brew-build.gating.x86_64.tier1.functional}

View File

@ -0,0 +1,43 @@
From 89766dae2418fb8fd9d54b7ce1d93a11d5faecdd Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Wed, 7 Apr 2021 09:37:53 -0400
Subject: [PATCH] installer: Prefer xorrisofs over genisoimage/mkisofs
Apparently it's the most likely version to exist in distros these
days. Particularly the other options may not be shipped in stock
RHEL9
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 3785abc6f0cb07c02ecc55760547a6f425513915)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1973236
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
virtinst/install/installerinject.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/virtinst/install/installerinject.py b/virtinst/install/installerinject.py
index 29150c8e..97742f6a 100644
--- a/virtinst/install/installerinject.py
+++ b/virtinst/install/installerinject.py
@@ -45,10 +45,12 @@ def _run_initrd_commands(initrd, tempdir):
def _run_iso_commands(iso, tempdir, cloudinit=False):
- # Some distros do not link mkisofs to genisoimage (or vice-versa). As a
- # result of this, we have to actually check for both programs and use the
- # most appropriate one.
- programs = ["genisoimage", "mkisofs"]
+ # These three programs all behave similarly for our needs, and
+ # different distros only have some available. xorriso is apparently
+ # the actively maintained variant that should be available everywhere
+ # and without any license issues. Some more info here:
+ # https://wiki.debian.org/genisoimage
+ programs = ["xorrisofs", "genisoimage", "mkisofs"]
for program in programs:
if shutil.which(program):
break
--
2.31.1

View File

@ -0,0 +1,200 @@
From 2bda38a197a780a85e9ce448ea81a81fe866c981 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Wed, 7 Apr 2021 11:45:00 -0400
Subject: [PATCH] urlfetcher: Add xorriso ISOReader implementation
xorisso is the still maintained isoinfo alternative, and may be
the only iso reading tool in RHEL9, so we need to support it.
Make it the default for our spec file and test suite too
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit f793986378f84bb409d2451bdb62ca08fd4cb5b4)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1973236
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
man/virt-install.rst | 2 +-
tests/test_cli.py | 12 ++++-----
virt-manager.spec | 4 +--
virtinst/install/urldetect.py | 4 +--
virtinst/install/urlfetcher.py | 48 +++++++++++++++++++++++++---------
5 files changed, 47 insertions(+), 23 deletions(-)
diff --git a/man/virt-install.rst b/man/virt-install.rst
index 963f9564..f75af635 100644
--- a/man/virt-install.rst
+++ b/man/virt-install.rst
@@ -617,7 +617,7 @@ ftp://host/path
An FTP server location containing an installable distribution image.
ISO
- Probe the ISO and extract files using 'isoinfo'
+ Extract files directly from the ISO path
DIRECTORY
Path to a local directory containing an installable distribution image.
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 5e69a135..3534e0e2 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -39,7 +39,7 @@ MEDIA_DIR = os.path.relpath(utils.DATADIR + "/fakemedia", utils.TOPDIR)
UNATTENDED_DIR = XMLDIR + "/unattended"
OLD_OSINFO = utils.has_old_osinfo()
NO_OSINFO_UNATTEND = not unattended.OSInstallScript.have_new_libosinfo()
-HAS_ISOINFO = shutil.which("isoinfo")
+HAS_xorriso = shutil.which("xorriso")
# We use this check as a surrogate for a released libosinfo with a bug
# fix we need to get full test coverage
@@ -100,9 +100,9 @@ def has_old_osinfo():
return "osinfo is too old"
-def missing_isoinfo():
- if not HAS_ISOINFO:
- return "isoinfo not installed"
+def missing_xorriso():
+ if not HAS_xorriso:
+ return "xorriso not installed"
def no_osinfo_unattend_cb():
@@ -995,8 +995,8 @@ c.add_compare("--connect " + utils.URIs.kvm_session + " --disk size=8 --os-varia
c.add_valid("--connect " + utils.URIs.kvm_session + " --install fedora21", prerun_check=has_old_osinfo) # hits some get_search_paths and media_upload code paths
# misc KVM config tests
-c.add_compare("--disk none --location %(ISO-NO-OS)s,kernel=frib.img,initrd=/frob.img", "location-manual-kernel", prerun_check=missing_isoinfo) # --location with an unknown ISO but manually specified kernel paths
-c.add_compare("--disk %(EXISTIMG1)s --location %(ISOTREE)s --nonetworks", "location-iso", prerun_check=missing_isoinfo) # Using --location iso mounting
+c.add_compare("--disk none --location %(ISO-NO-OS)s,kernel=frib.img,initrd=/frob.img", "location-manual-kernel", prerun_check=missing_xorriso) # --location with an unknown ISO but manually specified kernel paths
+c.add_compare("--disk %(EXISTIMG1)s --location %(ISOTREE)s --nonetworks", "location-iso", prerun_check=missing_xorriso) # Using --location iso mounting
c.add_compare("--disk %(EXISTIMG1)s --cdrom %(ISOLABEL)s", "cdrom-centos-label") # Using --cdrom with centos CD label, should use virtio etc.
c.add_compare("--disk %(EXISTIMG1)s --install bootdev=network --os-variant rhel5.4 --cloud-init none", "kvm-rhel5") # RHEL5 defaults
c.add_compare("--disk %(EXISTIMG1)s --install kernel=%(ISO-WIN7)s,initrd=%(ISOLABEL)s,kernel_args='foo bar' --os-variant rhel6.4 --unattended none", "kvm-rhel6") # RHEL6 defaults. ISO paths are just to point at existing files
diff --git a/virt-manager.spec b/virt-manager.spec
index f523551b..3946c300 100644
--- a/virt-manager.spec
+++ b/virt-manager.spec
@@ -71,8 +71,8 @@ Requires: python3-requests
Requires: libosinfo >= 0.2.10
# Required for gobject-introspection infrastructure
Requires: python3-gobject-base
-# Required for pulling files from iso media with isoinfo
-Requires: genisoimage
+# Required for pulling files from iso media
+Requires: xorriso
%description common
Common files used by the different virt-manager interfaces, as well as
diff --git a/virtinst/install/urldetect.py b/virtinst/install/urldetect.py
index a73b0bf1..f5ed0270 100644
--- a/virtinst/install/urldetect.py
+++ b/virtinst/install/urldetect.py
@@ -40,9 +40,9 @@ class _DistroCache(object):
if path not in self._filecache:
try:
content = self._fetcher.acquireFileContent(path)
- except ValueError:
+ except ValueError as e:
content = None
- log.debug("Failed to acquire file=%s", path)
+ log.debug("Failed to acquire file=%s: %s", path, e)
self._filecache[path] = content
return self._filecache[path]
diff --git a/virtinst/install/urlfetcher.py b/virtinst/install/urlfetcher.py
index 3cacab1a..835c9e40 100644
--- a/virtinst/install/urlfetcher.py
+++ b/virtinst/install/urlfetcher.py
@@ -26,7 +26,7 @@ class _ISOReader:
def __init__(self, location):
self._location = location
- def grabFile(self, url):
+ def grabFile(self, url, scratchdir):
raise NotImplementedError()
def hasFile(self, url):
raise NotImplementedError()
@@ -43,20 +43,50 @@ class _ISOinfoReader(_ISOReader):
def _make_file_list(self):
cmd = ["isoinfo", "-J", "-i", self._location, "-f"]
- log.debug("Running isoinfo: %s", cmd)
+ log.debug("Generating iso filelist: %s", cmd)
output = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
return output.splitlines(False)
- def grabFile(self, url):
+ def grabFile(self, url, scratchdir):
+ ignore = scratchdir
cmd = ["isoinfo", "-J", "-i", self._location, "-x", url]
- log.debug("Running isoinfo: %s", cmd)
+ log.debug("Extracting iso file: %s", cmd)
return subprocess.check_output(cmd)
def hasFile(self, url):
return url.encode("ascii") in self._cache_file_list
+class _XorrisoReader(_ISOReader):
+ def __init__(self, location):
+ super().__init__(location)
+ self._cache_file_list = self._make_file_list()
+
+ def _make_file_list(self):
+ delim = "VIRTINST_BEGINLIST"
+ cmd = ["xorriso", "-indev", self._location, "-print", delim, "-find"]
+
+ log.debug("Generating iso filelist: %s", cmd)
+ output = subprocess.check_output(cmd,
+ stderr=subprocess.DEVNULL, text=True)
+ return output.split(delim, 1)[1].strip().splitlines()
+
+ def grabFile(self, url, scratchdir):
+ tmp = tempfile.NamedTemporaryFile(
+ prefix="virtinst-iso", suffix="-" + os.path.basename(url),
+ dir=scratchdir)
+
+ cmd = ["xorriso", "-osirrox", "on", "-indev", self._location,
+ "-extract", url, tmp.name]
+ log.debug("Extracting iso file: %s", cmd)
+ subprocess.check_output(cmd)
+ return open(tmp.name, "rb").read()
+
+ def hasFile(self, url):
+ return ("'.%s'" % url) in self._cache_file_list
+
+
###########################
# Fetcher implementations #
###########################
@@ -349,23 +379,17 @@ class _ISOURLFetcher(_URLFetcher):
def _get_isoreader(self):
if not self._isoreader:
- self._isoreader = _ISOinfoReader(self.location)
+ self._isoreader = _XorrisoReader(self.location)
return self._isoreader
def _grabber(self, url):
- """
- Use isoinfo to grab the file
- """
if not self._hasFile(url):
raise RuntimeError("iso doesn't have file=%s" % url)
- output = self._get_isoreader().grabFile(url)
+ output = self._get_isoreader().grabFile(url, self.scratchdir)
return io.BytesIO(output), len(output)
def _hasFile(self, url):
- """
- Use isoinfo to list and search for the file
- """
return self._get_isoreader().hasFile(url)
--
2.31.1

View File

@ -0,0 +1,78 @@
From a3017ef3d61139362482d5f3c5d6bf056fe6fb6e Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Sat, 22 May 2021 12:18:22 -0400
Subject: [PATCH] urlfetcher: Delete the 'isoinfo' ISOReader
We didn't delete this in the last commit, mostly to make it easier
to revert this commit if it turns out we need to support both isoinfo
and xorriso. Right now I don't know of any reason why that should
be necessary but time will tell.
If we do go that route it will take more work to teach urlfetcher
to dynamically detect the presence of one or the other, along with
similar tweaks.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 08d1a6a2ddd18f88222f9fdffa3f60f42a40bc67)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1973236
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
virtinst/install/urlfetcher.py | 38 +---------------------------------
1 file changed, 1 insertion(+), 37 deletions(-)
diff --git a/virtinst/install/urlfetcher.py b/virtinst/install/urlfetcher.py
index 835c9e40..838a206a 100644
--- a/virtinst/install/urlfetcher.py
+++ b/virtinst/install/urlfetcher.py
@@ -22,45 +22,9 @@ from ..logger import log
# isoreader abstraction #
#########################
-class _ISOReader:
+class _XorrisoReader():
def __init__(self, location):
self._location = location
-
- def grabFile(self, url, scratchdir):
- raise NotImplementedError()
- def hasFile(self, url):
- raise NotImplementedError()
-
-
-class _ISOinfoReader(_ISOReader):
- """
- Handle reading reading files off an iso
- """
- def __init__(self, location):
- super().__init__(location)
- self._cache_file_list = self._make_file_list()
-
- def _make_file_list(self):
- cmd = ["isoinfo", "-J", "-i", self._location, "-f"]
-
- log.debug("Generating iso filelist: %s", cmd)
- output = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
- return output.splitlines(False)
-
- def grabFile(self, url, scratchdir):
- ignore = scratchdir
- cmd = ["isoinfo", "-J", "-i", self._location, "-x", url]
-
- log.debug("Extracting iso file: %s", cmd)
- return subprocess.check_output(cmd)
-
- def hasFile(self, url):
- return url.encode("ascii") in self._cache_file_list
-
-
-class _XorrisoReader(_ISOReader):
- def __init__(self, location):
- super().__init__(location)
self._cache_file_list = self._make_file_list()
def _make_file_list(self):
--
2.31.1

View File

@ -0,0 +1,120 @@
From dae2f3471a56f3967952e6951f60f523060c89a0 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Wed, 7 Apr 2021 09:51:41 -0400
Subject: [PATCH] urlfetcher: Factor out ISOReader class
This contains all the isoinfo command logic. This will be used
to add an xorriso backend as well
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit b13b5e0f5edf8efabae643d28f12693f43f094db)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1973236
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
virtinst/install/urlfetcher.py | 64 +++++++++++++++++++++++++---------
1 file changed, 48 insertions(+), 16 deletions(-)
diff --git a/virtinst/install/urlfetcher.py b/virtinst/install/urlfetcher.py
index f531fe50..3cacab1a 100644
--- a/virtinst/install/urlfetcher.py
+++ b/virtinst/install/urlfetcher.py
@@ -18,6 +18,45 @@ import requests
from ..logger import log
+#########################
+# isoreader abstraction #
+#########################
+
+class _ISOReader:
+ def __init__(self, location):
+ self._location = location
+
+ def grabFile(self, url):
+ raise NotImplementedError()
+ def hasFile(self, url):
+ raise NotImplementedError()
+
+
+class _ISOinfoReader(_ISOReader):
+ """
+ Handle reading reading files off an iso
+ """
+ def __init__(self, location):
+ super().__init__(location)
+ self._cache_file_list = self._make_file_list()
+
+ def _make_file_list(self):
+ cmd = ["isoinfo", "-J", "-i", self._location, "-f"]
+
+ log.debug("Running isoinfo: %s", cmd)
+ output = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
+ return output.splitlines(False)
+
+ def grabFile(self, url):
+ cmd = ["isoinfo", "-J", "-i", self._location, "-x", url]
+
+ log.debug("Running isoinfo: %s", cmd)
+ return subprocess.check_output(cmd)
+
+ def hasFile(self, url):
+ return url.encode("ascii") in self._cache_file_list
+
+
###########################
# Fetcher implementations #
###########################
@@ -302,39 +341,32 @@ class _LocalURLFetcher(_URLFetcher):
class _ISOURLFetcher(_URLFetcher):
- _cache_file_list = None
+ _isoreader = None
_is_iso = True
def _make_full_url(self, filename):
return os.path.join("/", filename)
+ def _get_isoreader(self):
+ if not self._isoreader:
+ self._isoreader = _ISOinfoReader(self.location)
+ return self._isoreader
+
def _grabber(self, url):
"""
Use isoinfo to grab the file
"""
if not self._hasFile(url):
- raise RuntimeError("isoinfo didn't find file=%s" % url)
-
- cmd = ["isoinfo", "-J", "-i", self.location, "-x", url]
-
- log.debug("Running isoinfo: %s", cmd)
- output = subprocess.check_output(cmd)
+ raise RuntimeError("iso doesn't have file=%s" % url)
+ output = self._get_isoreader().grabFile(url)
return io.BytesIO(output), len(output)
def _hasFile(self, url):
"""
Use isoinfo to list and search for the file
"""
- if not self._cache_file_list:
- cmd = ["isoinfo", "-J", "-i", self.location, "-f"]
-
- log.debug("Running isoinfo: %s", cmd)
- output = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
-
- self._cache_file_list = output.splitlines(False)
-
- return url.encode("ascii") in self._cache_file_list
+ return self._get_isoreader().hasFile(url)
class DirectFetcher(_URLFetcher):
--
2.31.1

View File

@ -8,7 +8,7 @@
Name: virt-manager
Version: 3.2.0
Release: 5%{?dist}
Release: 6%{?dist}%{?extra_release}
%global verrel %{version}-%{release}
Summary: Desktop tool for managing virtual machines via libvirt
@ -19,6 +19,10 @@ Source0: https://virt-manager.org/download/sources/%{name}/%{name}-%{version}.ta
# Fix 'domain not found' race (bz #1901081)
Patch0001: 0001-virtinst-Fix-TOCTOU-in-domain-enumeration.patch
Patch2: virt-manager-installer-Prefer-xorrisofs-over-genisoimage-mkisofs.patch
Patch3: virt-manager-urlfetcher-Factor-out-ISOReader-class.patch
Patch4: virt-manager-urlfetcher-Add-xorriso-ISOReader-implementation.patch
Patch5: virt-manager-urlfetcher-Delete-the-isoinfo-ISOReader.patch
Requires: virt-manager-common = %{verrel}
@ -51,6 +55,7 @@ Recommends: libvirt-daemon-config-network
# Optional inspection of guests
Suggests: python3-libguestfs
BuildRequires: git
BuildRequires: gettext
BuildRequires: python3-devel
BuildRequires: python3-docutils
@ -100,7 +105,12 @@ machine).
%prep
%setup -q
%autosetup -S git_am -N
git config gc.auto 0
%autopatch
%build
@ -170,6 +180,13 @@ done
%changelog
* Fri Jul 23 2021 Jonathon Jongsma <jjongsma@redhat.com> - 3.2.0-6
- installer: Prefer xorrisofs over genisoimage/mkisofs (rhbz#1973236)
- urlfetcher: Factor out ISOReader class (rhbz#1973236)
- urlfetcher: Add xorriso ISOReader implementation (rhbz#1973236)
- urlfetcher: Delete the 'isoinfo' ISOReader (rhbz#1973236)
- Add gating.yaml for RHEL-9 (rhbz#1984222)
* Wed Jun 09 2021 Jonathon Jongsma <jjongsma@redhat.com> - 3.2.0-5
- Disable spice options in virt-manager. Resolves: rhbz#1946939