File virtinst-add-sle16-detection-support.patch of Package virt-manager

Index: virt-manager-5.0.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-5.0.0.orig/virtinst/install/urldetect.py
+++ virt-manager-5.0.0/virtinst/install/urldetect.py
@@ -279,6 +279,14 @@ class _SUSEContent(object):
             else:
                 if "SUSE SL Micro" in self.product_name:
                     sle_version = self.product_name.strip().rsplit(' ')[3]
+                elif "SLES Full" in self.product_name or "SUSE SLES" in self.product_name:
+                    # For SLES 16
+                    sle_version = self.product_name.strip().rsplit(' ')
+                    for num in sle_version:
+                        num = num.rstrip(".0")
+                        if num.isnumeric():
+                            sle_version = num
+                            break
                 else:
                     sle_version = self.product_name.strip().rsplit(' ')[4]
             if len(self.product_name.strip().rsplit(' ')) > 5 and not " Micro " in self.product_name:
@@ -521,10 +529,16 @@ class _SuseDistro(_RHELDistro):
             content_str = cache.acquire_file_content("content")
             if content_str is None:
                 products_str = cache.acquire_file_content("media.1/products")
+                if not products_str:
+                    # For SLES16 install iso (not agama)
+                    products_str = cache.acquire_file_content("install/media.1/products")
                 if products_str:
                     products_str = products_str.replace('/', ' ,', 1)
                     products_str = "DISTRO " + products_str.replace('-', ' ')
                 media_str = cache.acquire_file_content("media.1/media")
+                if not media_str:
+                    # For SLES16 install iso (not agama)
+                    media_str = cache.acquire_file_content("install/media.1/media")
                 if media_str:
                     media_arch = "x86_64"
                     if 'aarch64' in media_str:
@@ -582,6 +596,10 @@ class _SuseDistro(_RHELDistro):
                 self._kernel_paths.append(
                     ("suseboot/linux64", "suseboot/initrd64"))
 
+        # Tested with SLES 16
+        self._kernel_paths.append(
+            ("../boot/%s/loader/linux" % tree_arch,
+             "../boot/%s/loader/initrd" % tree_arch))
         # Tested with SLES 12 for ppc64le, all s390x
         self._kernel_paths.append(
             ("boot/%s/linux" % tree_arch,
@@ -675,7 +693,7 @@ class _SLESDistro(_SuseDistro):
     PRETTY_NAME = "SLES"
     matching_distros = ["sles"]
     _variant_prefix = "sles"
-    _suse_regex = [".*SUSE Linux Enterprise Server*", ".*SUSE SLES*"]
+    _suse_regex = [".*SUSE Linux Enterprise Server*", ".*SLES Full*", ".*SUSE SLES*"]
     famregex = ".*SUSE Linux Enterprise.*"
 
 
openSUSE Build Service is sponsored by