virt-manager/virtman-vminstall.patch
Charles Arnold f71f619bc9 - Update to virt-manager 1.2.0
virt-manager-1.2.0.tar.bz2
  virtinst-default-xen-to-qcow2-format.patch
  * OVMF/AAVMF Support (Laszlo Ersek, Giuseppe Scrivano, Cole Robinson)
  * Improved support for AArch64 qemu/kvm
  * virt-install: Support –disk type=network parameters
  * virt-install: Make –disk just work
  * virt-install: Add –disk sgio= option (Giuseppe Scrivano)
  * addhardware: default to an existing bus when adding a new disk (Giuseppe Scrivano)
  * virt-install: Add –input device option
  * virt-manager: Unify storagebrowser and storage details functionality
  * virt-manager: allow setting a custom connection row name
  * virt-install: Support –hostdev scsi passthrough
  * virt-install: Fill in a bunch of –graphics spice options
  * Disable spice image compression for new local VMs
  * virt-manager: big reworking of the migration dialog
- Dropped tarball and patches
  virt-manager-1.1.0.tar.bz2
  0b391fe9-Gtk-30.patch
  20fe2873-check-for-empty-network-name.patch
  24faf867-ignore-error-403-on-directories.patch
  65f7017e-createnet-fix.patch
  activate-default-console.patch
  ce74cd77-connection-state-tick-updates-lock.patch
  virtinst-ppc64le.patch
  virtinst-supported-disk-formats.patch
  virtinst-support-suse-distros.patch
  virt-manager-1.1.0.tar.bz2
  virtman-default-lxc-uri.patch
  virtman-stable-os-support.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=226
2015-05-04 20:15:01 +00:00

198 lines
8.3 KiB
Diff

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: