Accepting request 344929 from Virtualization

Bug fix for bsc#955401

OBS-URL: https://build.opensuse.org/request/show/344929
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/virt-manager?expand=0&rev=132
This commit is contained in:
Dominique Leuenberger 2015-11-18 21:34:50 +00:00 committed by Git OBS Bridge
commit bd641912bf
13 changed files with 57 additions and 231 deletions

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Tue Nov 17 09:00:28 MST 2015 - carnold@suse.com
- bsc#955401 - Can't create VM without disk: "list index out of
range"
virtinst-set-cache-mode-unsafe-for-install.patch
-------------------------------------------------------------------
Tue Nov 10 09:15:12 MST 2015 - carnold@suse.com
- bsc#947129 - Error launching manager: 'URI' is not in list
Set the locale to avoid parsing errors
virtman-show-suse-install-repos.patch
-------------------------------------------------------------------
Tue Oct 27 16:46:03 MDT 2015 - carnold@suse.com
- fate#319659 - vm-install: remove shutcut in virt-manager
Drop virtman-vminstall.patch
-------------------------------------------------------------------
Tue Oct 27 13:45:04 MDT 2015 - carnold@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package virt-manager
#
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -57,12 +57,11 @@ Patch16: cde2f0ef-Suppress-gi-warnings-about-lack-of-require_version.patc
Patch70: virtman-desktop.patch
Patch71: virtman-kvm.patch
Patch72: virtman-keycombo.patch
Patch73: virtman-vminstall.patch
Patch74: virtman-show-suse-install-repos.patch
Patch75: virtman-libvirtd-not-running.patch
Patch76: virtman-dont-allow-grub.xen-to-be-deleted.patch
Patch77: virtinst-pvgrub2-bootloader.patch
Patch78: virtinst-nfs-install-sanitize.patch
Patch73: virtman-show-suse-install-repos.patch
Patch74: virtman-libvirtd-not-running.patch
Patch75: virtman-dont-allow-grub.xen-to-be-deleted.patch
Patch76: virtinst-pvgrub2-bootloader.patch
Patch77: virtinst-nfs-install-sanitize.patch
# Features or Enhancements
Patch100: virtman-eepro100.patch
Patch101: virtman-default-guest-from-host-os.patch
@ -199,7 +198,6 @@ machine).
%patch75 -p1
%patch76 -p1
%patch77 -p1
%patch78 -p1
# Enhancements
%patch100 -p1
%patch101 -p1

View File

@ -12,7 +12,7 @@ Index: virt-manager-1.2.1/virtinst/guest.py
class Guest(XMLBuilder):
@@ -671,6 +672,15 @@ class Guest(XMLBuilder):
@@ -674,6 +675,15 @@ class Guest(XMLBuilder):
return
self.add_device(VirtualGraphics(self.conn))
@ -28,7 +28,7 @@ Index: virt-manager-1.2.1/virtinst/guest.py
def add_default_devices(self):
self.add_default_graphics()
self.add_default_video_device()
@@ -678,6 +688,7 @@ class Guest(XMLBuilder):
@@ -681,6 +691,7 @@ class Guest(XMLBuilder):
self.add_default_console_device()
self.add_default_usb_controller()
self.add_default_channels()

View File

@ -9,7 +9,7 @@ Index: virt-manager-1.2.1/virtinst/util.py
===================================================================
--- virt-manager-1.2.1.orig/virtinst/util.py
+++ virt-manager-1.2.1/virtinst/util.py
@@ -559,3 +559,22 @@ def getInstallRepos(enabled_sources_only
@@ -561,3 +561,22 @@ def getInstallRepos(enabled_sources_only
zypper_output.insert(0, dom0_inst_source)
return (index_dom0, zypper_output)

View File

@ -16,7 +16,7 @@ Index: virt-manager-1.2.1/virtinst/guest.py
self.x86_cpu_default = self.cpu.SPECIAL_MODE_HOST_MODEL_ONLY
self.__os_object = None
@@ -620,11 +623,13 @@ class Guest(XMLBuilder):
@@ -623,11 +626,13 @@ class Guest(XMLBuilder):
self.conn.check_support(
self.conn.SUPPORT_CONN_VIRTIO_CONSOLE)):
dev.target_type = "virtio"
@ -31,7 +31,7 @@ Index: virt-manager-1.2.1/virtinst/guest.py
return
if self.get_devices("video"):
return
@@ -669,7 +674,7 @@ class Guest(XMLBuilder):
@@ -672,7 +677,7 @@ class Guest(XMLBuilder):
return
if self.os.is_container():
return
@ -40,7 +40,7 @@ Index: virt-manager-1.2.1/virtinst/guest.py
return
self.add_device(VirtualGraphics(self.conn))
@@ -997,7 +1002,7 @@ class Guest(XMLBuilder):
@@ -1000,7 +1005,7 @@ class Guest(XMLBuilder):
if self._hv_only_supports_virtio():
return True

View File

@ -12,28 +12,31 @@ Index: virt-manager-1.2.1/virtinst/guest.py
class Guest(XMLBuilder):
@@ -354,6 +355,14 @@ class Guest(XMLBuilder):
@@ -354,6 +355,17 @@ class Guest(XMLBuilder):
self._set_osxml_defaults()
+ # At install time set the target disk to 'unsafe' for
+ # better performance if the target is not a block device
+ saved_cache = "None"
+ if install:
+ target_disk = self.get_devices("disk")[0]
+ saved_cache = target_disk.driver_cache
+ if target_disk.type != VirtualDisk.TYPE_BLOCK:
+ target_disk.driver_cache = VirtualDisk.CACHE_MODE_UNSAFE
+ disk_devices = self.get_devices("disk")
+ if disk_devices:
+ target_disk = self.get_devices("disk")[0]
+ saved_cache = target_disk.driver_cache
+ if target_disk.type != VirtualDisk.TYPE_BLOCK:
+ target_disk.driver_cache = VirtualDisk.CACHE_MODE_UNSAFE
+
self.bootloader = None
if (not install and
self.os.is_xenpv() and
@@ -372,7 +381,10 @@ class Guest(XMLBuilder):
@@ -372,7 +384,10 @@ class Guest(XMLBuilder):
self.bootloader = "/usr/bin/pygrub"
self.os.clear()
- return self.get_xml_config()
+ xml_config = self.get_xml_config()
+ if install:
+ if install and saved_cache != "None":
+ target_disk.driver_cache = saved_cache
+ return xml_config

View File

@ -13,7 +13,7 @@ Index: virt-manager-1.2.1/virtinst/guest.py
import logging
import urlgrabber.progress as progress
@@ -807,14 +808,29 @@ class Guest(XMLBuilder):
@@ -810,14 +811,29 @@ class Guest(XMLBuilder):
self.emulator = None
return

View File

@ -4,7 +4,7 @@ Index: virt-manager-1.2.1/virtManager/engine.py
===================================================================
--- virt-manager-1.2.1.orig/virtManager/engine.py
+++ virt-manager-1.2.1/virtManager/engine.py
@@ -202,9 +202,6 @@ class vmmEngine(vmmGObject):
@@ -199,9 +199,6 @@ class vmmEngine(vmmGObject):
except:
logging.exception("Error talking to PackageKit")
@ -14,7 +14,7 @@ Index: virt-manager-1.2.1/virtManager/engine.py
warnmsg = _("The 'libvirtd' service will need to be started.\n\n"
"After that, virt-manager will connect to libvirt on\n"
"the next application start up.")
@@ -218,7 +215,11 @@ class vmmEngine(vmmGObject):
@@ -215,7 +212,11 @@ class vmmEngine(vmmGObject):
if not connected and do_start:
manager.err.ok(_("Libvirt service must be started"), warnmsg)

View File

@ -10,7 +10,7 @@ Index: virt-manager-1.2.1/virtManager/manager.py
===================================================================
--- virt-manager-1.2.1.orig/virtManager/manager.py
+++ virt-manager-1.2.1/virtManager/manager.py
@@ -864,7 +864,7 @@ class vmmManager(vmmGObjectUI):
@@ -859,7 +859,7 @@ class vmmManager(vmmGObjectUI):
show_pause = bool(vm and vm.is_unpauseable())
else:
show_pause = bool(vm and vm.is_pauseable())
@ -23,7 +23,7 @@ Index: virt-manager-1.2.1/virtManager/vmmenu.py
===================================================================
--- virt-manager-1.2.1.orig/virtManager/vmmenu.py
+++ virt-manager-1.2.1/virtManager/vmmenu.py
@@ -50,6 +50,7 @@ class _VMMenu(Gtk.Menu):
@@ -31,6 +31,7 @@ class _VMMenu(Gtk.Menu):
self._parent = src
self._current_vm_cb = current_vm_cb
self._show_open = show_open
@ -31,7 +31,7 @@ Index: virt-manager-1.2.1/virtManager/vmmenu.py
self._init_state()
@@ -111,6 +112,7 @@ class VMShutdownMenu(_VMMenu):
@@ -92,6 +93,7 @@ class VMShutdownMenu(_VMMenu):
name = getattr(child, "vmm_widget_name", None)
if name in statemap:
child.set_sensitive(statemap[name])
@ -39,7 +39,7 @@ Index: virt-manager-1.2.1/virtManager/vmmenu.py
if name == "reset":
child.set_tooltip_text(None)
@@ -127,7 +129,8 @@ class VMActionMenu(_VMMenu):
@@ -108,7 +110,8 @@ class VMActionMenu(_VMMenu):
self._add_action(_("_Pause"), "suspend", Gtk.STOCK_MEDIA_PAUSE)
self._add_action(_("R_esume"), "resume", Gtk.STOCK_MEDIA_PAUSE)
s = self._add_action(_("_Shut Down"), "shutdown", addcb=False)
@ -49,7 +49,7 @@ Index: virt-manager-1.2.1/virtManager/vmmenu.py
self.add(Gtk.SeparatorMenuItem())
self._add_action(_("Clone..."), "clone", None)
@@ -143,7 +146,7 @@ class VMActionMenu(_VMMenu):
@@ -124,7 +127,7 @@ class VMActionMenu(_VMMenu):
def update_widget_states(self, vm):
statemap = {
"run": bool(vm and vm.is_runable()),
@ -58,7 +58,7 @@ Index: virt-manager-1.2.1/virtManager/vmmenu.py
"suspend": bool(vm and vm.is_stoppable()),
"resume": bool(vm and vm.is_paused()),
"migrate": bool(vm and vm.is_stoppable()),
@@ -160,6 +163,8 @@ class VMActionMenu(_VMMenu):
@@ -141,6 +144,8 @@ class VMActionMenu(_VMMenu):
child.get_submenu().update_widget_states(vm)
if name in statemap:
child.set_sensitive(statemap[name])

View File

@ -6,7 +6,7 @@ Index: virt-manager-1.2.1/virtManager/engine.py
===================================================================
--- virt-manager-1.2.1.orig/virtManager/engine.py
+++ virt-manager-1.2.1/virtManager/engine.py
@@ -226,9 +226,22 @@ class vmmEngine(vmmGObject):
@@ -223,9 +223,22 @@ class vmmEngine(vmmGObject):
if not uris:
return
logging.debug("About to connect to uris %s", uris)

View File

@ -77,7 +77,7 @@ Index: virt-manager-1.2.1/virtManager/engine.py
===================================================================
--- virt-manager-1.2.1.orig/virtManager/engine.py
+++ virt-manager-1.2.1/virtManager/engine.py
@@ -192,21 +192,18 @@ class vmmEngine(vmmGObject):
@@ -189,21 +189,18 @@ class vmmEngine(vmmGObject):
ret = None
try:

View File

@ -40,7 +40,7 @@ Index: virt-manager-1.2.1/virtinst/util.py
def listify(l):
@@ -462,3 +465,97 @@ def register_libvirt_error_handler():
@@ -462,3 +465,99 @@ def register_libvirt_error_handler():
ignore = userdata
ignore = err
libvirt.registerErrorHandler(f=libvirt_callback, ctx=None)
@ -105,11 +105,13 @@ Index: virt-manager-1.2.1/virtinst/util.py
+ return (0, [])
+ dom0_inst_source = getHostInstallSource()
+ try:
+ env = os.environ.copy()
+ env['LC_ALL'] = 'C'
+ 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)
+ p = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE, env=env)
+ stdout, stderr = p.communicate()
+ zypper_output = stdout
+ zypper_list = zypper_output.split("\n")

View File

@ -1,197 +0,0 @@
Allow vm-install to be launched from virt-manager. Vm-install is
considered a legacy installation tool since SLE12 and os13.2. This
patch creates a pop-down menu to allow the selection of vm-install
as the install tool. Vm-install is the required installation tool
for s390 but is only a convenience for those still attached to using
it instead of virt-install on x86.
Index: virt-manager-1.2.0/ui/manager.ui
===================================================================
--- virt-manager-1.2.0.orig/ui/manager.ui
+++ virt-manager-1.2.0/ui/manager.ui
@@ -277,7 +277,7 @@
<property name="can_focus">False</property>
<property name="show_arrow">False</property>
<child>
- <object class="GtkToolButton" id="vm-new">
+ <object class="GtkMenuToolButton" id="vm-new">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
@@ -289,7 +289,6 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
</packing>
</child>
<child>
Index: virt-manager-1.2.0/virtManager/manager.py
===================================================================
--- virt-manager-1.2.0.orig/virtManager/manager.py
+++ virt-manager-1.2.0/virtManager/manager.py
@@ -92,6 +92,7 @@ class vmmManager(vmmGObjectUI):
"action-show-host": (GObject.SignalFlags.RUN_FIRST, None, [str]),
"action-show-preferences": (GObject.SignalFlags.RUN_FIRST, None, []),
"action-show-create": (GObject.SignalFlags.RUN_FIRST, None, [str]),
+ "action-show-create-vminstall": (GObject.SignalFlags.RUN_FIRST, None, [str]),
"action-suspend-domain": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
"action-resume-domain": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
"action-run-domain": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
@@ -289,7 +290,8 @@ class vmmManager(vmmGObjectUI):
def init_toolbar(self):
- self.widget("vm-new").set_icon_name("vm_new")
+ vmmenu.build_new_button_menu(self.widget("vm-new"),
+ self.vminstall_new_vm)
self.widget("vm-open").set_icon_name("icon_console")
menu = vmmenu.VMShutdownMenu(self, self.current_vm)
@@ -474,6 +476,9 @@ class vmmManager(vmmGObjectUI):
def new_vm(self, src_ignore=None):
self.emit("action-show-create", self.current_conn_uri())
+ def vminstall_new_vm(self, src_ignore=None):
+ self.emit("action-show-create-vminstall", self.current_conn_uri())
+
def show_about(self, src_ignore):
self.emit("action-show-about")
Index: virt-manager-1.2.0/virtManager/vmmenu.py
===================================================================
--- virt-manager-1.2.0.orig/virtManager/vmmenu.py
+++ virt-manager-1.2.0/virtManager/vmmenu.py
@@ -19,9 +19,28 @@
#
from gi.repository import Gtk
+from virtManager import config
####################################################################
+# Build toolbar new button menu (manager and details toolbar) #
+####################################################################
+
+def build_new_button_menu(widget, vminstall_cb):
+ icon_name = config.running_config.get_new_icon_name()
+ widget.set_icon_name(icon_name)
+ menu = Gtk.Menu()
+ widget.set_menu(menu)
+
+ vminstallimg = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
+
+ vminstall = Gtk.ImageMenuItem.new_with_mnemonic(_("_Vm-install"))
+ vminstall.set_image(vminstallimg)
+ vminstall.show()
+ vminstall.connect("activate", vminstall_cb)
+ menu.add(vminstall)
+
+####################################################################
# Build toolbar shutdown button menu (manager and details toolbar) #
####################################################################
Index: virt-manager-1.2.0/virtManager/config.py
===================================================================
--- virt-manager-1.2.0.orig/virtManager/config.py
+++ virt-manager-1.2.0/virtManager/config.py
@@ -197,6 +197,13 @@ class vmmConfig(object):
# General app wide helpers (gsettings agnostic)
+ def get_new_icon_name(self):
+ theme = Gtk.IconTheme.get_default()
+ iconname = "vm_new"
+ if theme.has_icon(iconname):
+ return iconname
+ return "media-record"
+
def get_appname(self):
return self.appname
def get_appversion(self):
Index: virt-manager-1.2.0/virtManager/engine.py
===================================================================
--- virt-manager-1.2.0.orig/virtManager/engine.py
+++ virt-manager-1.2.0/virtManager/engine.py
@@ -27,6 +27,8 @@ import re
import Queue
import threading
import traceback
+import os
+from subprocess import *
from . import packageutils
from .about import vmmAbout
@@ -72,6 +74,7 @@ class vmmEngine(vmmGObject):
self.windowCreate = None
self.windowManager = None
self.windowMigrate = None
+ self.remote_install = None
self.conns = {}
self.err = vmmErrorDialog()
@@ -819,6 +822,7 @@ class vmmEngine(vmmGObject):
obj.connect("action-show-domain", self._do_show_vm)
obj.connect("action-show-preferences", self._do_show_preferences)
obj.connect("action-show-create", self._do_show_create)
+ obj.connect("action-show-create-vminstall", self._do_show_create_vminstall)
obj.connect("action-show-about", self._do_show_about)
obj.connect("action-show-host", self._do_show_host)
obj.connect("action-show-connect", self._do_show_connect)
@@ -861,11 +865,52 @@ class vmmEngine(vmmGObject):
self.windowCreate = obj
return self.windowCreate
- def _do_show_create(self, src, uri):
- try:
- self._get_create_dialog().show(src.topwin, uri)
- except Exception, e:
- src.err.show_err(_("Error launching manager: %s") % str(e))
+ def _vmmcreate_closing(self,signal,key):
+ self.windowCreate = None
+
+ def _do_show_create_vminstall(self, src, uri):
+ self._do_show_create(src, uri, True)
+
+ def _do_show_create(self, src, uri, use_vminstall=False):
+ if uri is None:
+ uri = vmmConnect.default_uri()
+ conn = self._lookup_conn(uri)
+ do_remote = conn.is_remote()
+ if self.windowCreate == None or do_remote != self.remote_install:
+ try:
+ if do_remote or not use_vminstall:
+ self._get_create_dialog().show(src.topwin, uri)
+ self.remote_install = True
+ else:
+ if os.geteuid() == 0:
+ args = ['/usr/bin/vm-install']
+ logging.debug("Launching: %s" % str(args))
+ p = Popen(args)
+ self.windowCreate = None
+ self.remote_install = False
+ else:
+ from vminstall.msg import must_be_root
+ message_box = Gtk.MessageDialog(None,
+ Gtk.DialogFlags.MODAL,
+ Gtk.MessageType.WARNING,
+ Gtk.ButtonsType.OK,
+ must_be_root)
+ message_box.run()
+ message_box.destroy()
+ except Exception, e:
+ src.err.show_err(_("Error launching manager: %s") % str(e),
+ "".join(traceback.format_exc()))
+ else:
+ if do_remote:
+ self.windowCreate.show(src.topwin, uri)
+ else:
+ message_box = Gtk.MessageDialog(None,
+ Gtk.DialogFlags.MODAL,
+ Gtk.MessageType.WARNING,
+ Gtk.ButtonsType.OK,
+ _("A new installation is already in progress.\n\nUse the YaST \"Create Virtual Machines\" utility for concurrent installations."))
+ message_box.run()
+ message_box.destroy()
def _do_show_migrate(self, src, uri, connkey):
try: