From f45b9190335861dd9d355ca5a41f1d9dc11b370c Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Tue, 7 Jan 2014 22:00:10 +0000 Subject: [PATCH] - Translate virt-install.ycp to virt-install.rb Added virt-install.rb Dropped virt-install.ycp - Drop virtman-autoconnect.patch - Pass --prefix to setup.py to fix build in 12.2 and older - Allow vm-install to be launched from the menu as an independent process. - bnc#847641 - L3: block device disappears with disabling cache virtman-support-unsafe-migration.patch - Dropped old tarball and upstream fixes OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=134 --- virt-install.rb | 75 +++++++++++ virt-install.ycp | 71 ---------- virt-manager.changes | 31 ++++- virt-manager.spec | 35 ++--- virtman-autoconnect.patch | 13 -- virtman-support-unsafe-migration.patch | 174 +++++++++++++++++++++++++ virtman-vminstall.patch | 37 ++---- 7 files changed, 309 insertions(+), 127 deletions(-) create mode 100644 virt-install.rb delete mode 100644 virt-install.ycp delete mode 100644 virtman-autoconnect.patch create mode 100644 virtman-support-unsafe-migration.patch diff --git a/virt-install.rb b/virt-install.rb new file mode 100644 index 00000000..b44707df --- /dev/null +++ b/virt-install.rb @@ -0,0 +1,75 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) 2013 Novell, Inc. All Rights Reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, you may find +# current contact information at www.novell.com. +# ------------------------------------------------------------------------------ +# + +# +# File: clients/virt-install.ycp +# Package: Installation of a virtual machine +# Summary: Main VM installation YaST frontend for python based virt-install +# Authors: Charles E. Arnold +# +# $Id$ + +module Yast + class VirtinstallClient < Client + def main + textdomain "virt-install" + + Yast.import "UI" + Yast.import "Popup" + Yast.import "String" + Yast.import "Arch" + + #=================================================================== + # Start virt-install (GUI) or vm-install if Text mode (commandline) + #------------------------------------------------------------------- + status = 0 + @details = {} + + Builtins.y2milestone("START HERE.") + if UI.TextMode() + Builtins.y2milestone("Running virt-install in text mode is not supported. Running vm-install instead in command line mode.") + status = UI.RunInTerminal("/usr/bin/vm-install") + else + Builtins.y2milestone("Launching virt-manager to run virt-install in GUI mode.") + if Arch.is_xen == false + details = Convert.to_map(SCR.Execute(path(".target.bash_output"), "/usr/bin/virt-manager --connect=qemu:///system --show-domain-creator")) + else + details = Convert.to_map(SCR.Execute(path(".target.bash_output"), "/usr/bin/virt-manager --connect=xen:/// --show-domain-creator")) + end + status = Ops.get_integer(details, "exit", 0) + end + + Builtins.y2milestone("virt-install finished with exit code: <%1>", status) + if status == 0 + return :next + else + if Builtins.size(Ops.get_string(details, "stderr", "")) > 0 + Popup.ErrorDetails(_("Failed to start virt-install"), Convert.to_string(details, "stderr", "")) + else + Popup.Error(_("Failed to start virt-install")) + end + end + + nil + end + end +end + +Yast::VirtinstallClient.new.main diff --git a/virt-install.ycp b/virt-install.ycp deleted file mode 100644 index 1f214884..00000000 --- a/virt-install.ycp +++ /dev/null @@ -1,71 +0,0 @@ -/* ------------------------------------------------------------------------------ - * Copyright (c) 2013 Novell, Inc. All Rights Reserved. - * - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of version 2 of the GNU General Public License as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, contact Novell, Inc. - * - * To contact Novell about this file by physical or electronic mail, you may find - * current contact information at www.novell.com. - * ------------------------------------------------------------------------------ - */ - -/** - * File: clients/virt-install.ycp - * Package: Installation of a virtual machine - * Summary: Main VM installation YaST frontend for python based virt-install - * Authors: Charles E. Arnold - * - * $Id$ - */ - -{ // begin -import "Popup"; -import "Arch"; - -textdomain "virt-install"; - -//=================================================================== -// Start virt-install (GUI) or vm-install if Text mode (commandline) -//------------------------------------------------------------------- -integer status = 0; -map details = $[]; -if (UI::TextMode()) -{ - y2milestone("Running virt-install in text mode is not supported. Running vm-install instead in command line mode."); - status = (integer)UI::RunInTerminal("/usr/bin/vm-install"); -} -else -{ - y2milestone("Launching virt-manager to run virt-install in GUI mode."); - if ( Arch::is_xen() == false ) { - details = (map)SCR::Execute(.target.bash_output, "/usr/bin/virt-manager --connect=qemu:///system --show-domain-creator"); - } - else { - details = (map)SCR::Execute(.target.bash_output, "/usr/bin/virt-manager --connect=xen:/// --show-domain-creator"); - } - status = details["exit"]:0; -} - -y2milestone("virt-install finished with exit code: <%1>", status); -if (status == 0) { - return `next; -} else { - if (size(details["stderr"]:"") > 0){ - Popup::ErrorDetails(_("Failed to start virt-install"), (string)details["stderr"]:""); - } else { - Popup::Error(_("Failed to start virt-install")); - } -} -return `nil; - -} // end - diff --git a/virt-manager.changes b/virt-manager.changes index c2cb3a65..6c6b0fd8 100644 --- a/virt-manager.changes +++ b/virt-manager.changes @@ -1,3 +1,32 @@ +------------------------------------------------------------------- +Thu Jan 07 14:25:13 MDT 2014 - carnold@suse.com + +- Translate virt-install.ycp to virt-install.rb + Added virt-install.rb + Dropped virt-install.ycp + +------------------------------------------------------------------- +Tue Dec 24 13:49:29 MST 2013 - carnold@suse.com + +- Drop virtman-autoconnect.patch + +------------------------------------------------------------------- +Sat Dec 14 16:49:34 CET 2013 - ohering@suse.de + +- Pass --prefix to setup.py to fix build in 12.2 and older + +------------------------------------------------------------------- +Mon Dec 9 16:35:32 MDT 2013 - carnold@suse.com + +- Allow vm-install to be launched from the menu as an independent + process. + +------------------------------------------------------------------- +Mon Dec 9 18:34:01 UTC 2013 - cbosdonnat@suse.com + +- bnc#847641 - L3: block device disappears with disabling cache + virtman-support-unsafe-migration.patch + ------------------------------------------------------------------- Mon Nov 25 16:12:07 MDT 2013 - carnold@suse.com @@ -26,7 +55,7 @@ Mon Nov 25 16:12:07 MDT 2013 - carnold@suse.com virtinst-storage-ocfs2.patch virtinst-support-suse-distros.patch virtinst-xen-drive-type.patch -- Dropped old tarball and fixes now upstream +- Dropped old tarball and upstream fixes virt-manager-0.9.5.tar.bz2 virtman-dropped-connection-segfault.patch virtman-graph-row-spacing.patch diff --git a/virt-manager.spec b/virt-manager.spec index dd764929..023c80fd 100644 --- a/virt-manager.spec +++ b/virt-manager.spec @@ -1,7 +1,7 @@ # # spec file for package virt-manager # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 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 @@ -33,13 +33,12 @@ License: GPL-2.0+ Group: System/Monitoring Url: http://virt-manager.org/ Source0: %{name}-%{version}.tar.bz2 -Source1: virt-install.ycp +Source1: virt-install.rb Source2: virt-install.desktop Patch50: virtman-desktop.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-eepro100.patch @@ -51,6 +50,7 @@ Patch67: virtman-default-guest-from-host-os.patch Patch68: virtman-allow-pv-iso-install.patch Patch69: virtman-autoyast-support.patch Patch70: virtman-vminstall.patch +Patch71: virtman-support-unsafe-migration.patch Patch150: virtinst-cdrom.patch Patch151: virtinst-storage-ocfs2.patch Patch152: virtinst-qed.patch @@ -66,9 +66,9 @@ BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build %define verrel %{version}-%{release} -Requires: virt-manager-common = %{verrel} Requires: gtk3 Requires: python-gconf +Requires: virt-manager-common = %{verrel} Requires: vm-install >= 0.5.6 # Libvirt-glib @@ -83,11 +83,11 @@ Requires: typelib-1_0-Vte-2_90 Requires: gtk-vnc2 Requires: libspice-client-glib-2_0-8 Requires: libspice-client-gtk-3_0-4 +Requires: typelib-1_0-GVnc-1_0 +Requires: typelib-1_0-Gtk-3_0 +Requires: typelib-1_0-GtkVnc-2_0 Requires: typelib-1_0-SpiceClientGlib-2_0 Requires: typelib-1_0-SpiceClientGtk-3_0 -Requires: typelib-1_0-Gtk-3_0 -Requires: typelib-1_0-GVnc-1_0 -Requires: typelib-1_0-GtkVnc-2_0 Recommends: python-SpiceClientGtk %if %{with_guestfs} @@ -114,8 +114,8 @@ Group: System/Monitoring # This version not strictly required: virt-manager should work with older, # however varying amounts of functionality will not be enabled. Requires: libvirt-python >= 0.7.0 -Requires: python-urlgrabber Requires: python-ipaddr +Requires: python-urlgrabber %description common Common files used by the different virt-manager interfaces, as well as @@ -128,10 +128,10 @@ Group: System/Monitoring Requires: virt-manager-common = %{verrel} -Provides: virt-clone -Provides: virt-image -Provides: virt-convert Provides: python-virtinst +Provides: virt-clone +Provides: virt-convert +Provides: virt-image Obsoletes: python-virtinst <= 0.600.4 %description -n virt-install @@ -146,7 +146,6 @@ machine). %patch51 -p1 %patch52 -p1 %patch53 -p1 -%patch54 -p1 %patch60 -p1 %patch61 -p1 %patch62 -p1 @@ -157,7 +156,8 @@ machine). %patch67 -p1 %patch68 -p1 %patch69 -p1 -#%patch70 -p1 +%patch70 -p1 +%patch71 -p1 %patch150 -p1 %patch151 -p1 %patch152 -p1 @@ -192,6 +192,7 @@ machine). %endif python setup.py configure \ + --prefix=%{_prefix} \ --pkgversion="%{version}" \ --default-graphics="spice" \ %{?_qemu_user} \ @@ -202,9 +203,11 @@ python setup.py configure \ %{?_default_graphics} %install -python setup.py install -O1 --root=$RPM_BUILD_ROOT +python setup.py install \ + --prefix=%{_prefix} \ + -O1 --root=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{_datadir}/YaST2/clients/ -install -m644 %SOURCE1 $RPM_BUILD_ROOT/%{_datadir}/YaST2/clients/virt-install.ycp +install -m644 %SOURCE1 $RPM_BUILD_ROOT/%{_datadir}/YaST2/clients/virt-install.rb mkdir -p $RPM_BUILD_ROOT/%{_datadir}/applications/YaST2/ install -m644 %SOURCE2 $RPM_BUILD_ROOT/%{_datadir}/applications/YaST2/virt-install.desktop @@ -269,7 +272,7 @@ fi %{_datadir}/%{name}/virt-convert %dir %{_datadir}/* %dir %{_datadir}/*/* -%{_datadir}/YaST2/clients/virt-install.ycp +%{_datadir}/YaST2/clients/virt-install.rb %{_datadir}/applications/YaST2/virt-install.desktop %{_bindir}/virt-install diff --git a/virtman-autoconnect.patch b/virtman-autoconnect.patch deleted file mode 100644 index cf30be61..00000000 --- a/virtman-autoconnect.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: virt-manager-0.10.0/virtManager/engine.py -=================================================================== ---- virt-manager-0.10.0.orig/virtManager/engine.py -+++ virt-manager-0.10.0/virtManager/engine.py -@@ -466,7 +466,7 @@ class vmmEngine(vmmGObject): - self.config.add_conn(conn.get_uri()) - - if autoconnect is not None: -- conn.set_autoconnect(bool(autoconnect)) -+ self.connect_to_uri(uri) - - if do_start: - conn.open() diff --git a/virtman-support-unsafe-migration.patch b/virtman-support-unsafe-migration.patch new file mode 100644 index 00000000..3a77f7f2 --- /dev/null +++ b/virtman-support-unsafe-migration.patch @@ -0,0 +1,174 @@ +bnc#847641 + +Index: virt-manager-0.10.0/ui/vmm-migrate.ui +=================================================================== +--- virt-manager-0.10.0.orig/ui/vmm-migrate.ui ++++ virt-manager-0.10.0/ui/vmm-migrate.ui +@@ -296,6 +296,53 @@ + + + ++ ++ True ++ False ++ 6 ++ ++ ++ True ++ False ++ 6 ++ ++ ++ True ++ False ++ _Allow unsafe migration: ++ True ++ migrate-unsafe ++ ++ ++ False ++ True ++ 0 ++ ++ ++ ++ ++ True ++ True ++ False ++ False ++ True ++ ++ ++ False ++ True ++ 1 ++ ++ ++ ++ ++ ++ ++ True ++ True ++ 1 ++ ++ ++ + + True + False +@@ -408,7 +455,7 @@ + + True + True +- 1 ++ 2 + + + +@@ -659,7 +706,7 @@ + + False + True +- 2 ++ 3 + + + +Index: virt-manager-0.10.0/virtManager/migrate.py +=================================================================== +--- virt-manager-0.10.0.orig/virtManager/migrate.py ++++ virt-manager-0.10.0/virtManager/migrate.py +@@ -147,6 +147,7 @@ class vmmMigrateDialog(vmmGObjectUI): + + self.widget("migrate-rate").set_value(0) + self.widget("migrate-secure").set_active(False) ++ self.widget("migrate-unsafe").set_active(False) + + downtime_box = self.widget("migrate-maxdowntime-box") + support_downtime = self.vm.support_downtime() +@@ -174,6 +175,16 @@ class vmmMigrateDialog(vmmGObjectUI): + secure_box.set_sensitive(support_secure) + secure_box.set_tooltip_text(secure_tooltip) + ++ unsafe_box = self.widget("migrate-unsafe-box") ++ support_unsafe = hasattr(libvirt, "VIR_MIGRATE_UNSAFE") ++ unsafe_tooltip = "" ++ if not support_unsafe: ++ unsafe_tooltip = _("Libvirt version does not support unsafe " ++ "migration.") ++ ++ unsafe_box.set_sensitive(support_unsafe) ++ unsafe_box.set_tooltip_text(unsafe_tooltip) ++ + self.rebuild_dest_rows() + + def set_state(self, vm): +@@ -234,6 +245,9 @@ class vmmMigrateDialog(vmmGObjectUI): + def get_config_secure(self): + return self.widget("migrate-secure").get_active() + ++ def get_config_unsafe(self): ++ return self.widget("migrate-unsafe").get_active() ++ + def get_config_max_downtime_enabled(self): + return self.widget("migrate-max-downtime").get_sensitive() + +@@ -456,6 +470,7 @@ class vmmMigrateDialog(vmmGObjectUI): + max_downtime = self.get_config_max_downtime() + live = not self.get_config_offline() + secure = self.get_config_secure() ++ unsafe = self.get_config_unsafe() + uri = self.build_migrate_uri(destconn, srcuri) + rate = self.get_config_rate() + if rate: +@@ -476,7 +491,7 @@ class vmmMigrateDialog(vmmGObjectUI): + + progWin = vmmAsyncJob(self._async_migrate, + [self.vm, destconn, uri, rate, live, secure, +- max_downtime], ++ unsafe, max_downtime], + _("Migrating VM '%s'" % self.vm.get_name()), + (_("Migrating VM '%s' from %s to %s. " + "This may take a while.") % +@@ -528,7 +543,7 @@ class vmmMigrateDialog(vmmGObjectUI): + + def _async_migrate(self, asyncjob, + origvm, origdconn, migrate_uri, rate, live, +- secure, max_downtime): ++ secure, unsafe, max_downtime): + meter = asyncjob.get_meter() + + srcconn = util.dup_conn(origvm.conn) +@@ -548,6 +563,6 @@ class vmmMigrateDialog(vmmGObjectUI): + timer = self.timeout_add(100, self._async_set_max_downtime, + vm, max_downtime, current_thread) + +- vm.migrate(dstconn, migrate_uri, rate, live, secure, meter=meter) ++ vm.migrate(dstconn, migrate_uri, rate, live, secure, unsafe, meter=meter) + if timer: + self.idle_add(GLib.source_remove, timer) +Index: virt-manager-0.10.0/virtManager/domain.py +=================================================================== +--- virt-manager-0.10.0.orig/virtManager/domain.py ++++ virt-manager-0.10.0/virtManager/domain.py +@@ -1269,7 +1269,7 @@ class vmmDomain(vmmLibvirtObject): + self._backend.migrateSetMaxDowntime(max_downtime, flag) + + def migrate(self, destconn, interface=None, rate=0, +- live=False, secure=False, meter=None): ++ live=False, secure=False, unsafe=False, meter=None): + self._install_abort = True + + newname = None +@@ -1282,6 +1282,9 @@ class vmmDomain(vmmLibvirtObject): + flags |= libvirt.VIR_MIGRATE_PEER2PEER + flags |= libvirt.VIR_MIGRATE_TUNNELLED + ++ if unsafe: ++ flags |= libvirt.VIR_MIGRATE_UNSAFE ++ + logging.debug("Migrating: conn=%s flags=%s dname=%s uri=%s rate=%s", + destconn.vmm, flags, newname, interface, rate) + diff --git a/virtman-vminstall.patch b/virtman-vminstall.patch index 3204bbe2..de59205b 100644 --- a/virtman-vminstall.patch +++ b/virtman-vminstall.patch @@ -70,7 +70,7 @@ Index: virt-manager-0.10.0/virtManager/uihelpers.py + + vminstallimg = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU) + -+ vminstall = Gtk.ImageMenuItem(_("_Vm-install")) ++ vminstall = Gtk.ImageMenuItem.new_with_mnemonic(_("_Vm-install")) + vminstall.set_image(vminstallimg) + vminstall.show() + vminstall.connect("activate", vminstall_cb) @@ -102,23 +102,16 @@ Index: virt-manager-0.10.0/virtManager/engine.py =================================================================== --- virt-manager-0.10.0.orig/virtManager/engine.py +++ virt-manager-0.10.0/virtManager/engine.py -@@ -27,6 +27,7 @@ from gi.repository import Gtk +@@ -27,6 +27,8 @@ from gi.repository import Gtk import logging import threading import os +import traceback ++from subprocess import * import libvirt import virtinst -@@ -44,7 +45,6 @@ from virtManager.manager import vmmManag - from virtManager.migrate import vmmMigrateDialog - from virtManager.details import vmmDetails - from virtManager.asyncjob import vmmAsyncJob --from virtManager.create import vmmCreate - from virtManager.host import vmmHost - from virtManager.error import vmmErrorDialog - from virtManager.systray import vmmSystray -@@ -89,6 +89,7 @@ class vmmEngine(vmmGObject): +@@ -89,6 +91,7 @@ class vmmEngine(vmmGObject): self.windowCreate = None self.windowManager = None self.windowMigrate = None @@ -126,7 +119,7 @@ Index: virt-manager-0.10.0/virtManager/engine.py self.conns = {} self.err = vmmErrorDialog() -@@ -663,6 +664,7 @@ class vmmEngine(vmmGObject): +@@ -663,6 +666,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) @@ -134,7 +127,7 @@ Index: virt-manager-0.10.0/virtManager/engine.py 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) -@@ -703,11 +705,49 @@ class vmmEngine(vmmGObject): +@@ -703,11 +707,41 @@ class vmmEngine(vmmGObject): self.windowCreate = obj return self.windowCreate @@ -157,21 +150,13 @@ Index: virt-manager-0.10.0/virtManager/engine.py + if self.windowCreate == None or do_remote != self.remote_install: + try: + if do_remote or not use_vminstall: -+ from virtManager.create import vmmCreate -+ create = vmmCreate(self) -+ create.connect("action-show-vm", self._do_show_vm) -+ create.connect("vmmcreate-closing", self._vmmcreate_closing) -+ self.remote_install = True -+ self.windowCreate = create -+ self.windowCreate.show(src.topwin, uri) ++ self._get_create_dialog().show(src.topwin, uri) + else: -+ from vminstall.gtk.interface import VMCreate as vmmCreate -+ create = vmmCreate(virtman=True,key=0) -+ create.connect("action-show-vm", self._do_show_vm) -+ create.connect("vmmcreate-closing", self._vmmcreate_closing) ++ args = ['/usr/bin/vm-install'] ++ logging.debug("Launching: %s" % str(args)) ++ p = Popen(args) ++ self.windowCreate = None + self.remote_install = False -+ self.windowCreate = create -+ self.windowCreate.show(src.topwin) + except Exception, e: + src.err.show_err(_("Error launching manager: %s") % str(e), + "".join(traceback.format_exc()))