Accepting request 181938 from Virtualization

Checkin for os13.1 Milestone 3

OBS-URL: https://build.opensuse.org/request/show/181938
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/virt-manager?expand=0&rev=83
This commit is contained in:
Stephan Kulow 2013-07-08 10:36:53 +00:00 committed by Git OBS Bridge
commit 757c7114bd
8 changed files with 282 additions and 206 deletions

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Jul 3 14:52:48 MDT 2013 - carnold@suse.com
- Default to virt-install when installation icon is selected
- Allow virt-install to install Xen PV guests from ISO media
virtman-allow-pv-iso-install.patch
- Detect SUSE installation sources and use as default when found
virtman-default-guest-from-host-os.patch
- Use 'Autoyast' instead of 'Kickstart' if installing SUSE distro
virtman-autoyast-label.patch
-------------------------------------------------------------------
Fri May 31 15:08:01 MDT 2013 - carnold@suse.com

View File

@ -34,20 +34,21 @@ Release: 0
Url: http://virt-manager.et.redhat.com
Source0: virt-manager-%{version}.tar.bz2
Patch50: virtman-desktop.patch
Patch51: virtman-vminstall.patch
Patch52: virtman-cdrom.patch
Patch53: virtman-kvm.patch
Patch54: virtman-keycombo.patch
Patch55: virtman-autoconnect.patch
Patch51: virtman-cdrom.patch
Patch52: virtman-kvm.patch
Patch53: virtman-keycombo.patch
Patch54: virtman-autoconnect.patch
Patch60: virtman-device-flags.patch
Patch61: virtman-autorestart.patch
Patch62: virtman-storage-pool.patch
Patch63: virtman-eepro100.patch
Patch64: virtman-qed.patch
Patch65: virtman-update-backend.patch
Patch66: virtman-slow-mouse.patch
Patch67: virtman-virtinstall.patch
Patch68: virtman-reverse-serialcon.patch
Patch62: virtman-eepro100.patch
Patch63: virtman-qed.patch
Patch64: virtman-update-backend.patch
Patch65: virtman-slow-mouse.patch
Patch66: virtman-vminstall.patch
Patch67: virtman-reverse-serialcon.patch
Patch68: virtman-default-guest-from-host-os.patch
Patch69: virtman-allow-pv-iso-install.patch
Patch70: virtman-autoyast-label.patch
ExclusiveArch: %{ix86} x86_64 s390x
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%gconf_schemas_prereq
@ -72,13 +73,13 @@ Requires: vtemodule.so()(64bit)
%endif
Requires: librsvg
Requires: netcat-openbsd
Requires: scrollkeeper
Requires: python-gtk-vnc
Requires: python-urlgrabber
Requires: python-gconf
Requires: python-gobject2
Requires: python-gtk
Requires: python-gtk-vnc
Requires: python-urlgrabber
Requires: python-virtinst == %{virtinst_maj}.%{virtinst_min}.%{virtinst_rel}
Requires: scrollkeeper
Requires: xorg-x11-fonts
Recommends: python-SpiceClientGtk
@ -104,16 +105,17 @@ Authors:
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch60 -p1
%patch61 -p1
#%patch62 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
%patch69 -p1
%patch70 -p1
%build
# autoreconf -i

View File

@ -0,0 +1,27 @@
Index: virt-manager-0.9.5/src/virtManager/create.py
===================================================================
--- virt-manager-0.9.5.orig/src/virtManager/create.py
+++ virt-manager-0.9.5/src/virtManager/create.py
@@ -686,8 +686,13 @@ class vmmCreate(vmmGObjectUI):
default = len(model)
if gtype == "xen":
+ pv_cdrom = False
+ if self.guest and self.guest._lookup_osdict_key('pv_cdrom_install'):
+ pv_cdrom = True
+
if (instmethod == INSTALL_PAGE_PXE or
- instmethod == INSTALL_PAGE_ISO):
+ instmethod == INSTALL_PAGE_ISO and
+ pv_cdrom == False):
sensitive = False
tooltip = _("Only URL or import installs are supported "
"for paravirt.")
@@ -700,6 +705,7 @@ class vmmCreate(vmmGObjectUI):
util.tooltip_wrapper(hv_info, tooltip)
else:
hv_info.hide()
+ default = 0
hv_list.set_active(default)

View File

@ -0,0 +1,38 @@
Index: virt-manager-0.9.5/src/virtManager/create.py
===================================================================
--- virt-manager-0.9.5.orig/src/virtManager/create.py
+++ virt-manager-0.9.5/src/virtManager/create.py
@@ -1248,12 +1248,25 @@ class vmmCreate(vmmGObjectUI):
variant = self.widget("install-os-version")
variant.set_active(0)
+ def _update_kickstart_label(self):
+ # Update label based on os version selected to either kickstart vs autoyast
+ combo = self.widget("install-os-version")
+ if combo.get_active() != -1:
+ ver = combo.get_active_text()
+ label = self.widget("kickstart-url-label")
+ if ver.startswith('opensuse') or ver.startswith('sle') or ver.startswith('oes'):
+ label.set_text("AutoYaST file:")
+ else:
+ label.set_text("Kickstart URL:")
+
def change_os_version(self, box):
model = box.get_model()
idx = box.get_active()
if idx == -1:
return
+ self._update_kickstart_label()
+
# Get previous
os_type_list = self.widget("install-os-type")
os_type_model = os_type_list.get_model()
@@ -2116,6 +2129,7 @@ class vmmCreate(vmmGObjectUI):
dl = self.set_os_val(self.widget("install-os-type"), distro)
vl = self.set_os_val(self.widget("install-os-version"), ver)
self.set_distro_labels(dl, vl)
+ self._update_kickstart_label()
def check_detection(self, idx, forward):
results = None

View File

@ -0,0 +1,69 @@
Index: virt-manager-0.9.5/src/virtManager/create.py
===================================================================
--- virt-manager-0.9.5.orig/src/virtManager/create.py
+++ virt-manager-0.9.5/src/virtManager/create.py
@@ -20,6 +20,8 @@
import threading
import logging
+import sys
+import os
import gtk
@@ -1159,6 +1161,47 @@ class vmmCreate(vmmGObjectUI):
return
self.start_detection(forward=forward)
+ def _lookup_host_os(self):
+ if sys.platform == 'linux2':
+ if os.path.exists('/etc/issue'):
+ f = open('/etc/issue')
+ lines = f.readlines()
+ f.close()
+ for line in lines:
+ if "openSUSE" in line:
+ return 'linux', 'opensuse12'
+ if "SUSE Linux Enterprise Server" in line:
+ return 'linux', 'sles11'
+ if "Fedora" in line:
+ return 'linux', 'fedora17'
+ if "Red Hat Enterprise Linux Server" in line:
+ return 'linux', 'rhel6'
+ return None, None
+
+ def detect_host_os(self):
+ box = self.widget('install-os-type')
+ if box.get_active() <= 0:
+ os_type, os_variant = self._lookup_host_os()
+ if os_type is None:
+ return
+ model = box.get_model()
+ index = 0
+ for row in model:
+ if row[0] == 'linux':
+ box.set_active(index)
+ break
+ index += 1
+ if os_variant is None:
+ return
+ box = self.widget('install-os-version')
+ model = box.get_model()
+ index = 0
+ for row in model:
+ if row[0] == os_variant:
+ box.set_active(index)
+ break
+ index += 1
+
def toggle_detect_os(self, src):
dodetect = src.get_active()
@@ -1174,6 +1217,7 @@ class vmmCreate(vmmGObjectUI):
self.widget("install-os-version-label").hide()
self.widget("install-os-type").show()
self.widget("install-os-version").show()
+ self.detect_host_os()
def _selected_os_row(self):
box = self.widget("install-os-type")

View File

@ -1,51 +0,0 @@
When connecting to a xen host, create default dir storage pool
in /var/lib/xen/images instead of /var/lib/libvirt/images.
Index: virt-manager-0.8.5/src/virtManager/connection.py
===================================================================
--- virt-manager-0.8.5.orig/src/virtManager/connection.py
+++ virt-manager-0.8.5/src/virtManager/connection.py
@@ -1144,7 +1144,8 @@ class vmmConnection(gobject.GObject):
else:
# Try to create the default storage pool
try:
- util.build_default_pool(self.vmm)
+ util.build_default_pool(self.vmm, \
+ self.config.get_default_image_dir(self))
except Exception, e:
logging.debug("Building default pool failed: %s" % str(e))
Index: virt-manager-0.8.5/src/virtManager/util.py
===================================================================
--- virt-manager-0.8.5.orig/src/virtManager/util.py
+++ virt-manager-0.8.5/src/virtManager/util.py
@@ -31,9 +31,8 @@ import virtManager
import virtinst
DEFAULT_POOL_NAME = "default"
-DEFAULT_POOL_PATH = "/var/lib/libvirt/images"
-def build_default_pool(conn):
+def build_default_pool(conn, path):
"""
Helper to build the 'default' storage pool
"""
@@ -54,15 +53,15 @@ def build_default_pool(conn):
try:
logging.debug("Attempting to build default pool with target '%s'" %
- DEFAULT_POOL_PATH)
+ path)
defpool = virtinst.Storage.DirectoryPool(conn=conn,
name=DEFAULT_POOL_NAME,
- target_path=DEFAULT_POOL_PATH)
+ target_path=path)
newpool = defpool.install(build=True, create=True)
newpool.setAutostart(True)
except Exception, e:
raise RuntimeError(_("Couldn't create default storage pool '%s': %s") %
- (DEFAULT_POOL_PATH, str(e)))
+ (path, str(e)))
def get_ideal_path_info(conn, config, name):
path = get_default_dir(conn, config)

View File

@ -1,132 +0,0 @@
Index: virt-manager-0.9.5/src/vmm-manager.ui
===================================================================
--- virt-manager-0.9.5.orig/src/vmm-manager.ui
+++ virt-manager-0.9.5/src/vmm-manager.ui
@@ -293,7 +293,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>
@@ -306,7 +306,6 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
</packing>
</child>
<child>
Index: virt-manager-0.9.5/src/virtManager/manager.py
===================================================================
--- virt-manager-0.9.5.orig/src/virtManager/manager.py
+++ virt-manager-0.9.5/src/virtManager/manager.py
@@ -260,7 +260,8 @@ class vmmManager(vmmGObjectUI):
self.config.is_vmlist_network_traffic_visible())
def init_toolbar(self):
- self.widget("vm-new").set_icon_name("vm_new")
+ uihelpers.build_new_button_menu(self.widget("vm-new"),
+ self.virtinstall_new_vm)
self.widget("vm-open").set_icon_name("icon_console")
uihelpers.build_shutdown_button_menu(self.widget("vm-shutdown"),
self.poweroff_vm,
@@ -510,6 +511,9 @@ class vmmManager(vmmGObjectUI):
def new_vm(self, src_ignore=None):
self.emit("action-show-create", self.current_conn_uri())
+ def virtinstall_new_vm(self, src_ignore=None):
+ self.emit("action-show-create-virtinstall", self.current_conn_uri())
+
def show_about(self, src_ignore):
self.emit("action-show-about")
@@ -1238,6 +1242,7 @@ vmmManager.signal_new(vmmManager, "actio
vmmManager.signal_new(vmmManager, "action-show-host", [str])
vmmManager.signal_new(vmmManager, "action-show-preferences", [])
vmmManager.signal_new(vmmManager, "action-show-create", [str])
+vmmManager.signal_new(vmmManager, "action-show-create-virtinstall", [str])
vmmManager.signal_new(vmmManager, "action-suspend-domain", [str, str])
vmmManager.signal_new(vmmManager, "action-resume-domain", [str, str])
vmmManager.signal_new(vmmManager, "action-run-domain", [str, str])
Index: virt-manager-0.9.5/src/virtManager/uihelpers.py
===================================================================
--- virt-manager-0.9.5.orig/src/virtManager/uihelpers.py
+++ virt-manager-0.9.5/src/virtManager/uihelpers.py
@@ -837,6 +837,24 @@ def mediadev_set_default_selection(widge
####################################################################
+# Build toolbar new button menu (manager and details toolbar) #
+####################################################################
+
+def build_new_button_menu(widget, virtinstall_cb):
+ icon_name = util.running_config.get_new_icon_name()
+ widget.set_icon_name(icon_name)
+ menu = gtk.Menu()
+ widget.set_menu(menu)
+
+ virtinstallimg = gtk.image_new_from_icon_name(icon_name, gtk.ICON_SIZE_MENU)
+
+ virtinstall = gtk.ImageMenuItem(_("_Virt-install"))
+ virtinstall.set_image(virtinstallimg)
+ virtinstall.show()
+ virtinstall.connect("activate", virtinstall_cb)
+ menu.add(virtinstall)
+
+####################################################################
# Build toolbar shutdown button menu (manager and details toolbar) #
####################################################################
Index: virt-manager-0.9.5/src/virtManager/config.py
===================================================================
--- virt-manager-0.9.5.orig/src/virtManager/config.py
+++ virt-manager-0.9.5/src/virtManager/config.py
@@ -150,6 +150,13 @@ class vmmConfig(object):
# General app wide helpers (gconf agnostic)
+ def get_new_icon_name(self):
+ theme = gtk.icon_theme_get_default()
+ iconname = "vm_new"
+ if theme.has_icon(iconname):
+ return iconname
+ return "media-record"
+
def get_shutdown_icon_name(self):
theme = gtk.icon_theme_get_default()
iconname = "system-shutdown"
Index: virt-manager-0.9.5/src/virtManager/engine.py
===================================================================
--- virt-manager-0.9.5.orig/src/virtManager/engine.py
+++ virt-manager-0.9.5/src/virtManager/engine.py
@@ -634,6 +634,7 @@ class vmmEngine(vmmGObject):
obj.connect("action-show-vm", 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-virtinstall", self._do_show_create_virtinstall)
obj.connect("action-show-help", self._do_show_help)
obj.connect("action-show-about", self._do_show_about)
obj.connect("action-show-host", self._do_show_host)
@@ -680,14 +681,17 @@ class vmmEngine(vmmGObject):
def _vmmcreate_closing(self,signal,key):
self.windowCreate = None
- def _do_show_create(self, src, uri):
+ def _do_show_create_virtinstall(self, src, uri):
+ self._do_show_create(src, uri, True)
+
+ def _do_show_create(self, src, uri, use_virtinstall=False):
if uri is None:
uri = 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:
+ if do_remote or use_virtinstall:
from virtManager.create import vmmCreate
create = vmmCreate(self)
create.connect("action-show-vm", self._do_show_vm)

View File

@ -1,3 +1,103 @@
Index: virt-manager-0.9.5/src/vmm-manager.ui
===================================================================
--- virt-manager-0.9.5.orig/src/vmm-manager.ui
+++ virt-manager-0.9.5/src/vmm-manager.ui
@@ -293,7 +293,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>
@@ -306,7 +306,6 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
</packing>
</child>
<child>
Index: virt-manager-0.9.5/src/virtManager/manager.py
===================================================================
--- virt-manager-0.9.5.orig/src/virtManager/manager.py
+++ virt-manager-0.9.5/src/virtManager/manager.py
@@ -260,7 +260,8 @@ class vmmManager(vmmGObjectUI):
self.config.is_vmlist_network_traffic_visible())
def init_toolbar(self):
- self.widget("vm-new").set_icon_name("vm_new")
+ uihelpers.build_new_button_menu(self.widget("vm-new"),
+ self.vminstall_new_vm)
self.widget("vm-open").set_icon_name("icon_console")
uihelpers.build_shutdown_button_menu(self.widget("vm-shutdown"),
self.poweroff_vm,
@@ -510,6 +511,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")
@@ -1238,6 +1242,7 @@ vmmManager.signal_new(vmmManager, "actio
vmmManager.signal_new(vmmManager, "action-show-host", [str])
vmmManager.signal_new(vmmManager, "action-show-preferences", [])
vmmManager.signal_new(vmmManager, "action-show-create", [str])
+vmmManager.signal_new(vmmManager, "action-show-create-vminstall", [str])
vmmManager.signal_new(vmmManager, "action-suspend-domain", [str, str])
vmmManager.signal_new(vmmManager, "action-resume-domain", [str, str])
vmmManager.signal_new(vmmManager, "action-run-domain", [str, str])
Index: virt-manager-0.9.5/src/virtManager/uihelpers.py
===================================================================
--- virt-manager-0.9.5.orig/src/virtManager/uihelpers.py
+++ virt-manager-0.9.5/src/virtManager/uihelpers.py
@@ -837,6 +837,24 @@ def mediadev_set_default_selection(widge
####################################################################
+# Build toolbar new button menu (manager and details toolbar) #
+####################################################################
+
+def build_new_button_menu(widget, vminstall_cb):
+ icon_name = util.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.ICON_SIZE_MENU)
+
+ vminstall = gtk.ImageMenuItem(_("_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-0.9.5/src/virtManager/config.py
===================================================================
--- virt-manager-0.9.5.orig/src/virtManager/config.py
+++ virt-manager-0.9.5/src/virtManager/config.py
@@ -150,6 +150,13 @@ class vmmConfig(object):
# General app wide helpers (gconf agnostic)
+ def get_new_icon_name(self):
+ theme = gtk.icon_theme_get_default()
+ iconname = "vm_new"
+ if theme.has_icon(iconname):
+ return iconname
+ return "media-record"
+
def get_shutdown_icon_name(self):
theme = gtk.icon_theme_get_default()
iconname = "system-shutdown"
Index: virt-manager-0.9.5/src/virtManager/engine.py
===================================================================
--- virt-manager-0.9.5.orig/src/virtManager/engine.py
@ -18,25 +118,37 @@ Index: virt-manager-0.9.5/src/virtManager/engine.py
from virtManager.host import vmmHost
from virtManager.error import vmmErrorDialog
from virtManager.systray import vmmSystray
@@ -676,11 +676,47 @@ class vmmEngine(vmmGObject):
@@ -634,6 +634,7 @@ class vmmEngine(vmmGObject):
obj.connect("action-show-vm", 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-help", self._do_show_help)
obj.connect("action-show-about", self._do_show_about)
obj.connect("action-show-host", self._do_show_host)
@@ -677,11 +678,50 @@ class vmmEngine(vmmGObject):
self.windowCreate = obj
return self.windowCreate
+ def _vmmcreate_closing(self,signal,key):
+ self.windowCreate = None
+
def _do_show_create(self, src, uri):
- 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 = 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:
+ if do_remote or not use_vminstall:
+ from virtManager.create import vmmCreate
+ create = vmmCreate(self)
+ create.connect("action-show-vm", self._do_show_vm)