virt-manager/virtinst-detect-suse-distros.patch
Charles Arnold 766768c9d2 - bnc#881551 - virt-manage: default storage image called
opensuse13.img for SLE-Server
  virtinst-detect-suse-distros.patch

- bnc#881549 - virt-manager/xen: Error changing VM configuration:
  'NoneType' object has no attribute 'split'
  virtinst-xenbus-disk-index-fix.patch

- Upstream bug fix
  538edb3b-manpage-fix-incorrect-description.patch 

- Upstream bug fixes
  536677aa-better-handling-of-keyboard-input-type.patch
  5385d602-lxc-no-default-disk.patch
  53869170-virt-install-add-events-support.patch
  538a11dc-raise-error-if-populating-summary-page-fails.patch
  538a3609-virtconv-fix-use-of-relative-OVF-file.patch
  538a3ba9-diskbackend-start-pool-if-not-running.patch
  538ca3f3-use-correct-dictionary-keys-for-old-pool-net-polling.patch
  538d00a4-xen-keyboard-cant-be-removed.patch
  538e2f74-fix-pool-create-call.patch
- Dropped 531e0a82-reverse-keyboard-grab-commit.patch. Fixed instead 
  with this patch.
  538a6862-vnc-dont-force-keyboard-grab-before-widget-is-realized.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=182
2014-06-12 05:14:17 +00:00

202 lines
6.9 KiB
Diff

Index: virt-manager-1.0.1/virtinst/urlfetcher.py
===================================================================
--- virt-manager-1.0.1.orig/virtinst/urlfetcher.py
+++ virt-manager-1.0.1/virtinst/urlfetcher.py
@@ -303,6 +303,88 @@ def _distroFromTreeinfo(fetcher, arch, v
return ob
+def _distroFromContent(fetcher, arch, vmtype=None):
+ # Parse content file for the 'LABEL' field containing the distribution name
+ # None if no content, GenericDistro if unknown label type.
+ if not fetcher.hasFile("content"):
+ return None
+
+ distribution = None
+ distro_version = None
+ distro_summary = None
+ distro_arch = None
+ filename = fetcher.acquireFile("content")
+ cbuf = f = None
+ try:
+ f = open(filename, "r")
+ cbuf = f.read()
+ except:
+ if f:
+ f.close()
+ os.unlink(filename)
+ return None
+ f.close()
+ os.unlink(filename)
+
+ lines = cbuf.splitlines()[1:]
+ for line in lines:
+ if line.startswith("LABEL "):
+ distribution = line.split(' ', 1)
+ elif line.startswith("DISTRO "):
+ distro_distro = line.rsplit(',', 1)
+ elif line.startswith("VERSION "):
+ distro_version = line.split(' ', 1)
+ elif line.startswith("SUMMARY "):
+ distro_summary = line.split(' ', 1)
+ elif line.startswith("BASEARCHS "):
+ distro_arch = line.split(' ', 1)
+ elif line.startswith("DEFAULTBASE "):
+ distro_arch = line.split(' ', 1)
+ if distribution and distro_version and distro_arch:
+ break
+
+ if not distribution:
+ if distro_summary:
+ distribution = distro_summary
+ elif distro_distro:
+ distribution = distro_distro
+ if distro_arch:
+ arch = distro_arch[1].strip()
+ else:
+ if cbuf.find("x86_64") != -1:
+ arch = "x86_64"
+ elif cbuf.find("i586") != -1:
+ arch = "i586"
+ elif cbuf.find("s390x") != -1:
+ arch = "s390x"
+
+ dclass = GenericDistro
+ if distribution:
+ if re.match(".*SUSE Linux Enterprise Server*", distribution[1]) or \
+ re.match(".*SUSE SLES*", distribution[1]):
+ dclass = SLESDistro
+ if distro_version is None:
+ distro_version = ['VERSION', distribution[1].strip().rsplit(' ')[4]]
+ elif re.match(".*SUSE Linux Enterprise Desktop*", distribution[1]):
+ dclass = SLEDDistro
+ if distro_version is None:
+ distro_version = ['VERSION', distribution[1].strip().rsplit(' ')[4]]
+ elif re.match(".*openSUSE.*", distribution[1]):
+ dclass = OpensuseDistro
+ if distro_version is None:
+ distro_version = ['VERSION', '13.1']
+
+ if distro_version is None:
+ return None
+
+ ob = dclass(fetcher, arch, vmtype)
+ if dclass != GenericDistro:
+ ob.content = distro_version
+
+ # Explictly call this, so we populate os_type/variant info
+ ob.isValidStore()
+
+ return ob
def getDistroStore(guest, fetcher):
stores = []
@@ -319,6 +401,10 @@ def getDistroStore(guest, fetcher):
if dist:
return dist
+ dist = _distroFromContent(fetcher, arch, _type)
+ if dist:
+ return dist
+
# FIXME: This 'distro ==' doesn't cut it. 'distro' is from our os
# dictionary, so would look like 'fedora9' or 'rhel5', so this needs
# to be a bit more intelligent
@@ -815,12 +901,11 @@ class SLDistro(RHELDistro):
class SuseDistro(Distro):
name = "SUSE"
- urldistro = "suse"
- os_variant = "linux"
_boot_iso_paths = ["boot/boot.iso"]
def __init__(self, *args, **kwargs):
+ self.content = None
Distro.__init__(self, *args, **kwargs)
if re.match(r'i[4-9]86', self.arch):
self.arch = 'i386'
@@ -831,22 +916,44 @@ class SuseDistro(Distro):
oldkern += "64"
oldinit += "64"
- # Tested with Opensuse >= 10.2, 11, and sles 10
- self._hvm_kernel_paths = [("boot/%s/loader/linux" % self.arch,
- "boot/%s/loader/initrd" % self.arch)]
- # Tested with Opensuse 10.0
- self._hvm_kernel_paths.append(("boot/loader/%s" % oldkern,
- "boot/loader/%s" % oldinit))
-
- # Matches Opensuse > 10.2 and sles 10
- self._xen_kernel_paths = [("boot/%s/vmlinuz-xen" % self.arch,
- "boot/%s/initrd-xen" % self.arch)]
+ if self.arch == "s390x":
+ self._hvm_kernel_paths = [ ("boot/%s/linux" % self.arch,
+ "boot/%s/initrd" % self.arch) ]
+ # No Xen on s390x
+ self._xen_kernel_paths = []
+ else:
+ # Tested with Opensuse >= 10.2, 11, and sles 10
+ self._hvm_kernel_paths = [ ("boot/%s/loader/linux" % self.arch,
+ "boot/%s/loader/initrd" % self.arch) ]
+ # Tested with Opensuse 10.0
+ self._hvm_kernel_paths.append(("boot/loader/%s" % oldkern,
+ "boot/loader/%s" % oldinit))
+
+ # Matches Opensuse > 10.2 and sles 10
+ self._xen_kernel_paths = [ ("boot/%s/vmlinuz-xen" % self.arch,
+ "boot/%s/initrd-xen" % self.arch) ]
def isValidStore(self):
+ # self.content is the VERSION line from the contents file
+ if self.content is None or self.content[1] is None:
+ return False
+ distro_version = self.content[1]
+ version = distro_version.split('.', 1)[0].strip()
+ if int(version) >= 10:
+ self.os_variant += version
+ else:
+ self.os_variant += "9"
+
if not self.fetcher.hasFile("directory.yast"):
return False
self.os_variant = self._detect_osdict_from_url()
+
+ # Reset kernel name for sle11 source on s390x
+ if self.arch == "s390x":
+ if self.os_variant == "sles11" or self.os_variant == "sled11":
+ self._hvm_kernel_paths = [ ("boot/%s/vmrdr.ikr" % self.arch,
+ "boot/%s/initrd" % self.arch) ]
return True
def _get_method_arg(self):
@@ -867,6 +974,27 @@ class SuseDistro(Distro):
return name
return self.os_variant
+class SLESDistro(SuseDistro):
+
+ urldistro = "sles"
+ os_variant = "sles"
+
+class SLEDDistro(SuseDistro):
+
+ urldistro = "sled"
+ os_variant = "sled"
+
+# 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"
+ os_variant = "opensuse"
+
+class OESDistro(SuseDistro):
+
+ urldistro = "oes"
+ os_variant = "oes"
class DebianDistro(Distro):
# ex. http://ftp.egr.msu.edu/debian/dists/sarge/main/installer-i386/