- bsc#1054986 - Missing /media.1/products file on the ISO media

causes virt-install to fail detecting distro type and version
  virtinst-add-sle15-detection-support.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=359
This commit is contained in:
Charles Arnold 2017-08-24 22:03:36 +00:00 committed by Git OBS Bridge
parent 67142b1ff7
commit 7927813b30
3 changed files with 81 additions and 0 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Aug 24 15:56:38 MDT 2017 - carnold@suse.com
- bsc#1054986 - Missing /media.1/products file on the ISO media
causes virt-install to fail detecting distro type and version
virtinst-add-sle15-detection-support.patch
-------------------------------------------------------------------
Tue Aug 22 08:05:07 MDT 2017 - carnold@suse.com

View File

@ -79,6 +79,7 @@ Patch164: virtinst-use-qemu-for-cdrom-device.patch
Patch165: virtinst-fix-sle-distro-parsing.patch
Patch166: virtinst-check-date-format.patch
Patch167: virtinst-no-usb-tablet-for-xenpv.patch
Patch168: virtinst-add-sle15-detection-support.patch
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -202,6 +203,7 @@ machine).
%patch165 -p1
%patch166 -p1
%patch167 -p1
%patch168 -p1
%build
%if %{qemu_user}

View File

@ -0,0 +1,72 @@
References: bsc#1054986
With SLE15 and openSUSE 15 the content file has been removed from the media.
This file was used for SUSE distro version and arch detection. Now detection
must be done by parsing the media.1/products file for distro version and the
media.1/build file for the arch. The media.1/products and media.1/build files
have always been around so the entire _distroFromSUSEContent could be rewritten
(and simplified) to only check them. The products file format did change
between 11-SP4 and 12. SLE10 has no build file.
Index: virt-manager-1.4.2/virtinst/urlfetcher.py
===================================================================
--- virt-manager-1.4.2.orig/virtinst/urlfetcher.py
+++ virt-manager-1.4.2/virtinst/urlfetcher.py
@@ -392,7 +392,20 @@ def _distroFromSUSEContent(fetcher, arch
try:
cbuf = fetcher.acquireFileContent("content")
except ValueError:
- return None
+ try:
+ # If no content file, try media.1/products and media.1/build and create
+ # a cbuf with enough info for the content file parsing code below to work
+ pbuf = fetcher.acquireFileContent("media.1/products").rsplit('/', 1)[1].strip()
+ # Older style products format: SUSE-Linux-Enterprise-Server-11-SP4 11.4.4-1.109
+ # Newer style products format: SLES12-SP3 12.3-0
+ if pbuf.startswith('SLE'):
+ pbuf = pbuf.split(' ')[0]
+ pbuf = " ".join(re.split('(\d+)', pbuf, 1))
+ cbuf = "\nDISTRO ," + pbuf.replace('-', ' ')
+ bbuf = fetcher.acquireFileContent("media.1/build").split('-')
+ cbuf = cbuf + "\n" + " ".join(bbuf)
+ except ValueError:
+ return None
distribution = None
distro_version = None
@@ -465,7 +478,7 @@ def _distroFromSUSEContent(fetcher, arch
dclass = GenericDistro
if distribution:
if re.match(".*SUSE Linux Enterprise Server*", distribution[1]) or \
- re.match(".*SUSE SLES*", distribution[1]):
+ re.match(".*SUSE SLES*", distribution[1]) or re.match("SLES*", distribution[1]):
dclass = SLESDistro
if distro_version is None:
distro_version = _parse_sle_distribution(distribution)
@@ -481,7 +494,7 @@ def _distroFromSUSEContent(fetcher, arch
dclass = CAASPDistro
if distro_version is None:
distro_version = ['VERSION', distribution[1].strip().rsplit(' ')[6]]
- elif re.match(".*openSUSE.*", distribution[1]):
+ elif re.match(".*openSUSE.*", distribution[1]) or re.match("openSUSE *", distribution[1]):
dclass = OpensuseDistro
if distro_version is None:
distro_version = ['VERSION', distribution[0].strip().rsplit(':')[4]]
@@ -1034,6 +1047,9 @@ class SuseDistro(Distro):
# Tested with SLES 12 for ppc64le
self._hvm_kernel_paths.append(("boot/%s/linux" % self.arch,
"boot/%s/initrd" % self.arch))
+ # Tested with SLES 15
+ self._hvm_kernel_paths.append(("boot/%s/loader/linux" % self.arch,
+ "boot/%s/loader/initrd" % self.arch))
# Matches Opensuse > 10.2 and sles 10
if self.arch == "i386":
@@ -1042,6 +1058,8 @@ class SuseDistro(Distro):
else:
self._xen_kernel_paths = [("boot/%s/vmlinuz-xen" % self.arch,
"boot/%s/initrd-xen" % self.arch)]
+ self._xen_kernel_paths.append(("boot/%s/loader/linux" % self.arch,
+ "boot/%s/loader/initrd" % self.arch))
def _variantFromVersion(self):
distro_version = self.version_from_content[1].strip()