From a0ee59eff0d9e227ce220bbf90026958d6f6c7ac Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Wed, 3 Jul 2013 21:44:06 +0000 Subject: [PATCH] - 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 OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=118 --- virt-manager.changes | 11 ++ virt-manager.spec | 36 ++++--- virtman-allow-pv-iso-install.patch | 27 +++++ virtman-autoyast-label.patch | 38 +++++++ virtman-default-guest-from-host-os.patch | 69 ++++++++++++ virtman-storage-pool.patch | 51 --------- virtman-virtinstall.patch | 132 ----------------------- virtman-vminstall.patch | 124 +++++++++++++++++++-- 8 files changed, 282 insertions(+), 206 deletions(-) create mode 100644 virtman-allow-pv-iso-install.patch create mode 100644 virtman-autoyast-label.patch create mode 100644 virtman-default-guest-from-host-os.patch delete mode 100644 virtman-storage-pool.patch delete mode 100644 virtman-virtinstall.patch diff --git a/virt-manager.changes b/virt-manager.changes index e006449b..214dc2fe 100644 --- a/virt-manager.changes +++ b/virt-manager.changes @@ -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 diff --git a/virt-manager.spec b/virt-manager.spec index c992b802..184f3d97 100644 --- a/virt-manager.spec +++ b/virt-manager.spec @@ -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 diff --git a/virtman-allow-pv-iso-install.patch b/virtman-allow-pv-iso-install.patch new file mode 100644 index 00000000..8445b596 --- /dev/null +++ b/virtman-allow-pv-iso-install.patch @@ -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) + diff --git a/virtman-autoyast-label.patch b/virtman-autoyast-label.patch new file mode 100644 index 00000000..55e7127d --- /dev/null +++ b/virtman-autoyast-label.patch @@ -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 diff --git a/virtman-default-guest-from-host-os.patch b/virtman-default-guest-from-host-os.patch new file mode 100644 index 00000000..3a9b12a6 --- /dev/null +++ b/virtman-default-guest-from-host-os.patch @@ -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") diff --git a/virtman-storage-pool.patch b/virtman-storage-pool.patch deleted file mode 100644 index 0e289641..00000000 --- a/virtman-storage-pool.patch +++ /dev/null @@ -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) diff --git a/virtman-virtinstall.patch b/virtman-virtinstall.patch deleted file mode 100644 index 7b2d822a..00000000 --- a/virtman-virtinstall.patch +++ /dev/null @@ -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 @@ - False - False - -- -+ - True - False - True -@@ -306,7 +306,6 @@ - - - False -- True - - - -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) diff --git a/virtman-vminstall.patch b/virtman-vminstall.patch index 0fda2553..25c4c410 100644 --- a/virtman-vminstall.patch +++ b/virtman-vminstall.patch @@ -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 @@ + False + False + +- ++ + True + False + True +@@ -306,7 +306,6 @@ + + + False +- True + + + +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)