import virt-manager-3.2.0-8.el9
This commit is contained in:
commit
71a0699fb4
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
SOURCES/virt-manager-3.2.0.tar.gz
|
1
.virt-manager.metadata
Normal file
1
.virt-manager.metadata
Normal file
@ -0,0 +1 @@
|
|||||||
|
f620494a41f898422581846ccf38b0e4540ea54e SOURCES/virt-manager-3.2.0.tar.gz
|
44
SOURCES/0001-virtinst-Fix-TOCTOU-in-domain-enumeration.patch
Normal file
44
SOURCES/0001-virtinst-Fix-TOCTOU-in-domain-enumeration.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From 4d0e323227f18e58283c45be4d240b506faacb22 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-Id: <4d0e323227f18e58283c45be4d240b506faacb22.1610390294.git.crobinso@redhat.com>
|
||||||
|
From: Martin Pitt <martin@piware.de>
|
||||||
|
Date: Tue, 24 Nov 2020 14:24:06 +0100
|
||||||
|
Subject: [PATCH virt-manager] virtinst: Fix TOCTOU in domain enumeration
|
||||||
|
|
||||||
|
Similar to commit 49a01b5482, _fetch_all_domains_raw() has a race
|
||||||
|
condition where a domain may disappear (from parallel libvirt
|
||||||
|
operations) in between enumerating and inspecting the objects.
|
||||||
|
|
||||||
|
Ignore these missing domains instead of crashing.
|
||||||
|
|
||||||
|
https://bugzilla.redhat.com/show_bug.cgi?id=1901081
|
||||||
|
Signed-off-by: Cole Robinson <crobinso@redhat.com>
|
||||||
|
---
|
||||||
|
virtinst/connection.py | 12 ++++++++++--
|
||||||
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/virtinst/connection.py b/virtinst/connection.py
|
||||||
|
index fec273b7..06bc60ad 100644
|
||||||
|
--- a/virtinst/connection.py
|
||||||
|
+++ b/virtinst/connection.py
|
||||||
|
@@ -182,8 +182,16 @@ class VirtinstConnection(object):
|
||||||
|
def _fetch_all_domains_raw(self):
|
||||||
|
dummy1, dummy2, ret = pollhelpers.fetch_vms(
|
||||||
|
self, {}, lambda obj, ignore: obj)
|
||||||
|
- return [Guest(weakref.proxy(self), parsexml=obj.XMLDesc(0))
|
||||||
|
- for obj in ret]
|
||||||
|
+ domains = []
|
||||||
|
+ for obj in ret:
|
||||||
|
+ # TOCTOU race: a domain may go away in between enumeration and inspection
|
||||||
|
+ try:
|
||||||
|
+ xml = obj.XMLDesc(0)
|
||||||
|
+ except libvirt.libvirtError as e: # pragma: no cover
|
||||||
|
+ log.debug("Fetching domain XML failed: %s", e)
|
||||||
|
+ continue
|
||||||
|
+ domains.append(Guest(weakref.proxy(self), parsexml=xml))
|
||||||
|
+ return domains
|
||||||
|
|
||||||
|
def _build_pool_raw(self, poolobj):
|
||||||
|
return StoragePool(weakref.proxy(self),
|
||||||
|
--
|
||||||
|
2.29.2
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
120
SOURCES/virt-manager-urlfetcher-Factor-out-ISOReader-class.patch
Normal file
120
SOURCES/virt-manager-urlfetcher-Factor-out-ISOReader-class.patch
Normal 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
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
From 900413f1fccc3a4f64f66066d851e3a03b821156 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Cole Robinson <crobinso@redhat.com>
|
||||||
|
Date: Fri, 30 Jul 2021 10:45:07 -0400
|
||||||
|
Subject: [PATCH] urlfetcher: Silence xorisso stderr output
|
||||||
|
|
||||||
|
Signed-off-by: Cole Robinson <crobinso@redhat.com>
|
||||||
|
(cherry picked from commit 8754a59d9228caacf43bcb1af6ad307da7217b09)
|
||||||
|
|
||||||
|
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1973236
|
||||||
|
|
||||||
|
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
|
||||||
|
---
|
||||||
|
virtinst/install/urlfetcher.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/virtinst/install/urlfetcher.py b/virtinst/install/urlfetcher.py
|
||||||
|
index 838a206a..67a68002 100644
|
||||||
|
--- a/virtinst/install/urlfetcher.py
|
||||||
|
+++ b/virtinst/install/urlfetcher.py
|
||||||
|
@@ -44,7 +44,7 @@ class _XorrisoReader():
|
||||||
|
cmd = ["xorriso", "-osirrox", "on", "-indev", self._location,
|
||||||
|
"-extract", url, tmp.name]
|
||||||
|
log.debug("Extracting iso file: %s", cmd)
|
||||||
|
- subprocess.check_output(cmd)
|
||||||
|
+ subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
|
||||||
|
return open(tmp.name, "rb").read()
|
||||||
|
|
||||||
|
def hasFile(self, url):
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
1228
SPECS/virt-manager.spec
Normal file
1228
SPECS/virt-manager.spec
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user