From d0da1c4472bf5b5bed2677786c68be765c2a4ef7 Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Tue, 2 Jun 2015 20:12:49 +0000 Subject: [PATCH] - bsc#933242 - virt-manager: summary=Error launching manager: list index out of range virtman-show-suse-install-repos.patch - Add depedency on typelib(Libosinfo) OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=236 --- virt-manager.changes | 8 ++++ virt-manager.spec | 4 +- virtinst-nfs-install-sanitize.patch | 20 ++++----- virtman-show-suse-install-repos.patch | 62 ++++++++++++++------------- 4 files changed, 52 insertions(+), 42 deletions(-) diff --git a/virt-manager.changes b/virt-manager.changes index 4190ee4c..d06ea104 100644 --- a/virt-manager.changes +++ b/virt-manager.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Jun 2 14:08:51 MDT 2015 - carnold@suse.com + +- bsc#933242 - virt-manager: summary=Error launching manager: list + index out of range + virtman-show-suse-install-repos.patch +- Add depedency on typelib(Libosinfo) + ------------------------------------------------------------------- Wed May 20 13:14:27 MDT 2015 - carnold@suse.com diff --git a/virt-manager.spec b/virt-manager.spec index 5ab2371b..7506913d 100644 --- a/virt-manager.spec +++ b/virt-manager.spec @@ -1,7 +1,7 @@ # # spec file for package virt-manager # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,7 +15,6 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # - %define with_guestfs 0 %define askpass_package "openssh-askpass" %define qemu_user "qemu" @@ -96,6 +95,7 @@ Requires: dbus-1-x11 Requires: dconf Requires: gtk3 Requires: libosinfo >= 0.2.10 +Requires: typelib(Libosinfo) Requires: python-gconf Requires: virt-manager-common = %{verrel} Requires: vm-install >= 0.5.6 diff --git a/virtinst-nfs-install-sanitize.patch b/virtinst-nfs-install-sanitize.patch index 8029f417..3d03a293 100644 --- a/virtinst-nfs-install-sanitize.patch +++ b/virtinst-nfs-install-sanitize.patch @@ -5,11 +5,11 @@ A fix for accessing nfs mounted media. A comment in the code states, and carry the latter form around internally" We need the RFC version to work correctly whereas redhat's anaconda needs their own modified version. -Index: virt-manager-1.1.0/virtinst/util.py +Index: virt-manager-1.2.0/virtinst/util.py =================================================================== ---- virt-manager-1.1.0.orig/virtinst/util.py -+++ virt-manager-1.1.0/virtinst/util.py -@@ -557,3 +557,22 @@ def getInstallRepos(enabled_sources_only +--- virt-manager-1.2.0.orig/virtinst/util.py ++++ virt-manager-1.2.0/virtinst/util.py +@@ -559,3 +559,22 @@ def getInstallRepos(enabled_sources_only zypper_output.insert(0, dom0_inst_source) return (index_dom0, zypper_output) @@ -32,10 +32,10 @@ Index: virt-manager-1.1.0/virtinst/util.py + + return url + -Index: virt-manager-1.1.0/virtinst/distroinstaller.py +Index: virt-manager-1.2.0/virtinst/distroinstaller.py =================================================================== ---- virt-manager-1.1.0.orig/virtinst/distroinstaller.py -+++ virt-manager-1.1.0/virtinst/distroinstaller.py +--- virt-manager-1.2.0.orig/virtinst/distroinstaller.py ++++ virt-manager-1.2.0/virtinst/distroinstaller.py @@ -51,6 +51,8 @@ def _sanitize_url(url): """ Do nothing for http or ftp, but make sure nfs is in the expected format @@ -45,10 +45,10 @@ Index: virt-manager-1.1.0/virtinst/distroinstaller.py if url.startswith("nfs://"): # Convert RFC compliant NFS nfs://server/path/to/distro # to what mount/anaconda expect nfs:server:/path/to/distro -Index: virt-manager-1.1.0/virtinst/urlfetcher.py +Index: virt-manager-1.2.0/virtinst/urlfetcher.py =================================================================== ---- virt-manager-1.1.0.orig/virtinst/urlfetcher.py -+++ virt-manager-1.1.0/virtinst/urlfetcher.py +--- virt-manager-1.2.0.orig/virtinst/urlfetcher.py ++++ virt-manager-1.2.0/virtinst/urlfetcher.py @@ -33,6 +33,7 @@ import urlparse import urlgrabber.grabber as grabber diff --git a/virtman-show-suse-install-repos.patch b/virtman-show-suse-install-repos.patch index edcfb20c..0b2d4610 100644 --- a/virtman-show-suse-install-repos.patch +++ b/virtman-show-suse-install-repos.patch @@ -2,10 +2,10 @@ Enhancement that gets the hosts installation location from install.inf and also collects the repos provided by zypper. These locations are then presented as potential installation locations when createing a VM. -Index: virt-manager-1.1.0/virtManager/create.py +Index: virt-manager-1.2.0/virtManager/create.py =================================================================== ---- virt-manager-1.1.0.orig/virtManager/create.py -+++ virt-manager-1.1.0/virtManager/create.py +--- virt-manager-1.2.0.orig/virtManager/create.py ++++ virt-manager-1.2.0/virtManager/create.py @@ -359,7 +359,13 @@ class vmmCreate(vmmGObjectUI): self.widget("install-url-options").set_expanded(False) urlmodel = self.widget("install-url-box").get_model() @@ -21,15 +21,16 @@ Index: virt-manager-1.1.0/virtManager/create.py self.populate_media_model(ksmodel, self.config.get_kickstart_urls()) self.set_distro_labels("-", "-", force=True) -Index: virt-manager-1.1.0/virtinst/util.py +Index: virt-manager-1.2.0/virtinst/util.py =================================================================== ---- virt-manager-1.1.0.orig/virtinst/util.py -+++ virt-manager-1.1.0/virtinst/util.py -@@ -23,11 +23,13 @@ import os +--- virt-manager-1.2.0.orig/virtinst/util.py ++++ virt-manager-1.2.0/virtinst/util.py +@@ -23,11 +23,14 @@ import os import random import re import stat -+import commands ++import subprocess ++from subprocess import Popen, PIPE import libvirt @@ -39,7 +40,7 @@ Index: virt-manager-1.1.0/virtinst/util.py def listify(l): -@@ -462,3 +464,96 @@ def register_libvirt_error_handler(): +@@ -462,3 +465,97 @@ def register_libvirt_error_handler(): ignore = userdata ignore = err libvirt.registerErrorHandler(f=libvirt_callback, ctx=None) @@ -102,35 +103,36 @@ Index: virt-manager-1.1.0/virtinst/util.py + if os.geteuid() != 0: + return (0, []) + dom0_inst_source = getHostInstallSource() -+ locations = commands.getoutput("/usr/bin/zypper lr -u | awk -F'|' '{ print $6 }'") -+ locations = locations[(locations.rfind('URI')):].split() -+ index = 0 ++ try: ++ if enabled_sources_only is True: ++ cmd = ['/usr/bin/zypper', 'lr', '-u', '-E'] ++ else: ++ cmd = ['/usr/bin/zypper', 'lr', '-u'] ++ p = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE) ++ stdout, stderr = p.communicate() ++ zypper_output = stdout ++ except: ++ if dom0_inst_source is None: ++ dom0_inst_source = [] ++ return (0, dom0_inst_source) ++ ++ zypper_list = zypper_output.split("\n") ++ zypper_header = [x.strip(' ') for x in zypper_list[0].split("|")] ++ uri_index = zypper_header.index("URI") ++ + index_dom0 = -1 + number_of_sources = 0 + zypper_output = [] -+ # If we only want to list enabled sources -+ if enabled_sources_only == True: -+ enabled = commands.getoutput("/usr/bin/zypper lr -u | awk -F'|' '{ print $4 }'") -+ enabled = enabled[(enabled.rfind('Enabled')):].split() -+ for e in enabled: -+ if e == "Yes": -+ str = locations[index] -+ if str.startswith('ftp://') or str.startswith('http://') or str.startswith('nfs://') or str.startswith('smb://'): -+ zypper_output.append(str) -+ if dom0_inst_source is not None and str == dom0_inst_source: -+ index_dom0 = number_of_sources -+ number_of_sources += 1 -+ index += 1 -+ else: -+ locations.sort() -+ for l in locations: -+ str = locations[index] ++ for repo in zypper_list: ++ repo = [x.strip(' ') for x in repo.split("|")] ++ if len(repo) >= uri_index: ++ str = repo[uri_index] + if str.startswith('ftp://') or str.startswith('http://') or str.startswith('nfs://') or str.startswith('smb://'): + zypper_output.append(str) + if dom0_inst_source is not None and str == dom0_inst_source: + index_dom0 = number_of_sources + number_of_sources += 1 -+ index += 1 ++ + if index_dom0 == -1 and dom0_inst_source: + index_dom0 = 0 + zypper_output.insert(0, dom0_inst_source)