virt-manager/virtinst-add-sle15-detection-support.patch

121 lines
5.6 KiB
Diff
Raw Normal View History

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 .treeinfo file.
We must continue to keep the content parsing code for the older distros.
As a fallback, detection is also setup to look at the media.1/products and
media.1/build files.
Index: virt-manager-1.4.3/virtinst/urlfetcher.py
===================================================================
--- virt-manager-1.4.3.orig/virtinst/urlfetcher.py
+++ virt-manager-1.4.3/virtinst/urlfetcher.py
@@ -392,7 +392,23 @@ 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").strip()
+ pbuf = pbuf.split(' ', 1)[1].strip()
+ # The media.1/products file naming convention changed between SLE11 and SLE12
+ if pbuf.startswith('SLE'):
+ pbuf = pbuf.split(' ')[0]
+ pbuf = " ".join(re.split('(\d+)', pbuf, 1))
+ cbuf = "\nDISTRO ," + pbuf.replace('-', ' ')
+ try:
+ bbuf = fetcher.acquireFileContent("media.1/build").split('-')
+ except:
+ bbuf = ["x86_64"]
+ cbuf = cbuf + "\n" + " ".join(bbuf)
+ except ValueError:
+ return None
distribution = None
distro_version = None
@@ -465,7 +481,7 @@ def _distroFromSUSEContent(fetcher, arch
dclass = GenericDistro
if distribution:
if re.match(".*SUSE Linux Enterprise Server*", distribution[1]) or \
- Upstream bug fixes (bsc#1027942) 9a9f9ecd-ignore-comments-in-keymap-conf-files.patch 9617d126-systray-Use-APPLICATION_STATUS-for-appindicator.patch e73abe5a-diskbackend-convert-to-long-the-calculated-size.patch 6e6f59e7-diskbackend-get-a-proper-size-of-existing-block-device-while-cloning.patch 23aaf852-network-Set-bridge-name-to-None-instead-of-blank.patch d1e1cf64-progress-remove-trailing-white-space.patch 63fce081-pycodestyle-Use-isinstance-for-type-checking.patch 08a58d61-pycodestyle-remove-description-of-fixed-errors.patch bc3c9a9d-progress-remove-unused-import.patch 2d276ebe-progress-dont-overwrite-format.patch e2ad4b2f-convert-iteritems-to-items.patch dff00d4f-remove-deprecated-statvfs-module.patch 75210ed3-replace-StringIO-with-io.patch a2bcd6c4-dont-compare-between-None-and-int.patch 44de92b7-use-reload-from-imp-module.patch 69c84bea-import-reduce-from-functools-module.patch 37ea5207-replace-StandardError-with-Exception.patch f41aafc7-Use-enumerate-instead-of-range-and-len.patch 91c0669c-cli-Fix-OrderedDict-mutated-during-iteration-on-python3.patch b8fa0c6b-xmlnsqemu-order-XML-output-like-libvirt-does.patch d2648d81-virtconv-dont-implicitly-depend-on-dict-hash-order.patch 999dbb36-cli-Make-VirtCLIArgument-instantiation-less-crazy.patch 7f1b4cee-pycodestyle-fix-all-E125-warnings.patch d82022bd-manager-drop-python2-only-cmp-usage.patch 374a3779-urlfetcher-write-test-file-as-binary-content.patch f7c8cf9f-devicepanic-dont-return-empty-model-list.patch 3be78d1f-addhardware-dont-allow-panic-option-where-not-supported.patch 73de8285-systray-remove-redundant-variable-assignment.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=375
2017-10-30 21:23:56 +01:00
- 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 +497,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]]
@@ -1003,6 +1019,7 @@ class SLDistro(RHELDistro):
class SuseDistro(Distro):
name = "SUSE"
+ uses_treeinfo = True
_boot_iso_paths = ["boot/boot.iso"]
@@ -1040,8 +1057,11 @@ class SuseDistro(Distro):
self._xen_kernel_paths = [("boot/%s/vmlinuz-xenpae" % self.arch,
"boot/%s/initrd-xenpae" % self.arch)]
else:
- self._xen_kernel_paths = [("boot/%s/vmlinuz-xen" % self.arch,
- "boot/%s/initrd-xen" % self.arch)]
+ self._xen_kernel_paths = [("boot/%s/loader/linux" % self.arch,
+ "boot/%s/loader/initrd" % self.arch)]
+ # By appending this gets searched for first
+ self._xen_kernel_paths.append(("boot/%s/vmlinuz-xen" % self.arch,
+ "boot/%s/initrd-xen" % self.arch))
def _variantFromVersion(self):
distro_version = self.version_from_content[1].strip()
@@ -1053,7 +1073,7 @@ class SuseDistro(Distro):
if len(distro_version.split('.', 1)) == 2:
sp_version = 'sp' + distro_version.split('.', 1)[1].strip()
self.os_variant += version
- if sp_version:
+ if sp_version and sp_version != 'sp0':
self.os_variant += sp_version
elif self.os_variant.startswith("opensuse"):
if len(version) == 8:
@@ -1077,6 +1097,24 @@ class SuseDistro(Distro):
self.os_variant += "9"
def isValidStore(self):
+ if self.treeinfo:
+ ret = False
+ if self.urldistro:
+ family = self.treeinfo.get("general", "family")
+ if "SUSE Linux Enterprise Server" in family and 'sles' in self.urldistro or \
+ "SUSE Linux Enterprise Desktop" in family and 'sled' in self.urldistro or \
+ "SUSE Linux Enterprise" in family and 'sles' in self.urldistro or \
+ "SUSE Containers" in family and 'caasp' in self.urldistro or \
+ "openSUSE" in family and 'opensuse' in self.urldistro or \
+ "Open Enterprise" in family and 'oes' in self.urldistro:
+ ret = True
+ if ret:
+ version = self.treeinfo.get("general", "version")
+ distro_version = ['VERSION', version]
+ self.version_from_content = distro_version
+ self._variantFromVersion()
+ return ret
+
# self.version_from_content is the VERSION line from the contents file
if (not self.version_from_content or
self.version_from_content[1] is None):
@@ -1128,8 +1166,6 @@ class OESDistro(SuseDistro):
urldistro = "oes"
-# Suse image store is harder - we fetch the kernel RPM and a helper
-# RPM and then munge bits together to generate a initrd
class OpensuseDistro(SuseDistro):
urldistro = "opensuse"