From d0b1be44189946ddbf2345f41705403cf945918e4502ef8336ed4f808ef2d17b Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Wed, 22 Dec 2010 21:45:08 +0000 Subject: [PATCH 1/8] Fix VNC port reservation race in qemu driver OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=79 --- c58b1056-init-bitmap-size.patch | 27 +++++++++++++++++++++++++++ libvirt.changes | 7 +++++++ libvirt.spec | 2 ++ 3 files changed, 36 insertions(+) create mode 100644 c58b1056-init-bitmap-size.patch diff --git a/c58b1056-init-bitmap-size.patch b/c58b1056-init-bitmap-size.patch new file mode 100644 index 0000000..9768761 --- /dev/null +++ b/c58b1056-init-bitmap-size.patch @@ -0,0 +1,27 @@ +commit c58b105625acf3404d75376b070903139e3346a3 +Author: Jim Fehlig +Date: Wed Dec 22 11:15:32 2010 -0700 + + Set bitmap size when allocating a bitmap + + I began noticing a race when reserving VNC ports as described here + + https://www.redhat.com/archives/libvir-list/2010-November/msg00379.html + + Turns out that we were not initializing the size field of bitmap + struct when allocating the bitmap. This subsequently caused + virBitmapSetBit() to fail since bitmap->size is 0, hence we never + actually reserved the port. + +diff --git a/src/util/bitmap.c b/src/util/bitmap.c +index 1b0c9da..9741668 100644 +--- a/src/util/bitmap.c ++++ b/src/util/bitmap.c +@@ -73,6 +73,7 @@ virBitmapPtr virBitmapAlloc(size_t size) + return NULL; + } + ++ bitmap->size = size; + return bitmap; + } + diff --git a/libvirt.changes b/libvirt.changes index b4eb9c9..b4d6edf 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Dec 22 14:41:46 MST 2010 - jfehlig@novell.com + +- Fix VNC port reservation race in qemu driver + c58b1056-init-bitmap-size.patch + bnc#659431 + ------------------------------------------------------------------- Fri Dec 10 16:31:02 MDT 2010 - jfehlig@novell.com diff --git a/libvirt.spec b/libvirt.spec index 25e7c70..fa444b1 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -171,6 +171,7 @@ Source1: libvirtd.init # Upstream patches Patch0: 45147ca3-macvtap-warning.patch Patch1: 474b1c14-macvtap-undefined.patch +Patch2: c58b1056-init-bitmap-size.patch # Need to go upstream Patch100: xen-name-for-devid.patch Patch102: clone.patch @@ -284,6 +285,7 @@ Authors: %setup -q %patch0 -p1 %patch1 -p1 +%patch2 -p1 %patch100 -p1 %patch102 %patch103 -p1 From 808ff08ac4911f9fc6feeff47f4e13eb2d81e2bd1be06da002f4c1d656108cf8 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Mon, 3 Jan 2011 20:16:51 +0000 Subject: [PATCH 2/8] update to 0.8.7 pre-release OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=80 --- 45147ca3-macvtap-warning.patch | 18 ----- 474b1c14-macvtap-undefined.patch | 121 ------------------------------- c58b1056-init-bitmap-size.patch | 27 ------- libvirt-0.8.6.tar.bz2 | 3 - libvirt-0.8.7.tar.bz2 | 3 + libvirt.changes | 5 ++ libvirt.spec | 10 +-- 7 files changed, 10 insertions(+), 177 deletions(-) delete mode 100644 45147ca3-macvtap-warning.patch delete mode 100644 474b1c14-macvtap-undefined.patch delete mode 100644 c58b1056-init-bitmap-size.patch delete mode 100644 libvirt-0.8.6.tar.bz2 create mode 100644 libvirt-0.8.7.tar.bz2 diff --git a/45147ca3-macvtap-warning.patch b/45147ca3-macvtap-warning.patch deleted file mode 100644 index 901b9a9..0000000 --- a/45147ca3-macvtap-warning.patch +++ /dev/null @@ -1,18 +0,0 @@ -commit 45147ca37f3d93ea67b02a6c0e435bdf40b4ddc5 -Author: Jean-Baptiste Rouault -Date: Wed Dec 1 12:00:32 2010 +0100 - - Fix warning when macvtap support is disabled - -diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c -index b0343c6..7cd0603 100644 ---- a/src/qemu/qemu_conf.c -+++ b/src/qemu/qemu_conf.c -@@ -1689,6 +1689,7 @@ qemudPhysIfaceConnect(virConnectPtr conn, - (void)qemuCmdFlags; - (void)driver; - (void)vmuuid; -+ (void)vmop; - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("No support for macvtap device")); - rc = -1; diff --git a/474b1c14-macvtap-undefined.patch b/474b1c14-macvtap-undefined.patch deleted file mode 100644 index a56fb8b..0000000 --- a/474b1c14-macvtap-undefined.patch +++ /dev/null @@ -1,121 +0,0 @@ -commit 474b1c1487828a17fe9e1025901334d9820ea350 -Author: Matthias Bolte -Date: Wed Dec 1 15:43:40 2010 +0100 - - Fix undefined symbol errors when macvtap support is disabled - - Use macvtap specific functions depending on WITH_MACVTAP. - - Use #if instead of #ifdef to check for WITH_MACVTAP, because - WITH_MACVTAP is always defined with value 0 or 1. - - Also export virVMOperationType{To|From}String unconditional, - because they are used unconditional in the domain config code. - -Index: libvirt-0.8.6/src/libvirt_macvtap.syms -=================================================================== ---- libvirt-0.8.6.orig/src/libvirt_macvtap.syms -+++ libvirt-0.8.6/src/libvirt_macvtap.syms -@@ -1,9 +1,10 @@ - # -+# These symbols are dependent on WITH_MACVTAP. -+# -+ - - # macvtap.h - delMacvtap; - openMacvtapTap; --virVMOperationTypeFromString; --virVMOperationTypeToString; - vpAssociatePortProfileId; - vpDisassociatePortProfileId; -Index: libvirt-0.8.6/src/libvirt_private.syms -=================================================================== ---- libvirt-0.8.6.orig/src/libvirt_private.syms -+++ libvirt-0.8.6/src/libvirt_private.syms -@@ -503,6 +503,11 @@ virLogStartup; - virLogUnlock; - - -+# macvtap.h -+virVMOperationTypeFromString; -+virVMOperationTypeToString; -+ -+ - # memory.h - virAlloc; - virAllocN; -Index: libvirt-0.8.6/src/qemu/qemu_driver.c -=================================================================== ---- libvirt-0.8.6.orig/src/qemu/qemu_driver.c -+++ libvirt-0.8.6/src/qemu/qemu_driver.c -@@ -11869,6 +11869,7 @@ cleanup: - return ret; - } - -+#if WITH_MACVTAP - static void - qemudVPAssociatePortProfiles(virDomainDefPtr def) { - int i; -@@ -11903,6 +11904,10 @@ err_exit: - } - } - } -+#else /* !WITH_MACVTAP */ -+static void -+qemudVPAssociatePortProfiles(virDomainDefPtr def ATTRIBUTE_UNUSED) { } -+#endif /* WITH_MACVTAP */ - - /* Finish is the third and final step, and it runs on the destination host. */ - static virDomainPtr -Index: libvirt-0.8.6/src/util/macvtap.h -=================================================================== ---- libvirt-0.8.6.orig/src/util/macvtap.h -+++ libvirt-0.8.6/src/util/macvtap.h -@@ -57,11 +57,6 @@ struct _virVirtualPortProfileParams { - } u; - }; - -- --# if defined(WITH_MACVTAP) -- --# include "internal.h" -- - enum virVMOperationType { - VIR_VM_OP_CREATE, - VIR_VM_OP_SAVE, -@@ -75,6 +70,10 @@ enum virVMOperationType { - VIR_VM_OP_LAST - }; - -+# if WITH_MACVTAP -+ -+# include "internal.h" -+ - int openMacvtapTap(const char *ifname, - const unsigned char *macaddress, - const char *linkdev, -@@ -90,11 +89,9 @@ void delMacvtap(const char *ifname, - const char *linkdev, - virVirtualPortProfileParamsPtr virtPortProfile); - --# endif /* WITH_MACVTAP */ -- --# define MACVTAP_MODE_PRIVATE_STR "private" --# define MACVTAP_MODE_VEPA_STR "vepa" --# define MACVTAP_MODE_BRIDGE_STR "bridge" -+# define MACVTAP_MODE_PRIVATE_STR "private" -+# define MACVTAP_MODE_VEPA_STR "vepa" -+# define MACVTAP_MODE_BRIDGE_STR "bridge" - - int vpAssociatePortProfileId(const char *macvtap_ifname, - const unsigned char *macvtap_macaddr, -@@ -109,6 +106,8 @@ int vpDisassociatePortProfileId(const ch - const virVirtualPortProfileParamsPtr virtPort, - enum virVMOperationType vmOp); - -+# endif /* WITH_MACVTAP */ -+ - VIR_ENUM_DECL(virVirtualPort) - VIR_ENUM_DECL(virVMOperation) - diff --git a/c58b1056-init-bitmap-size.patch b/c58b1056-init-bitmap-size.patch deleted file mode 100644 index 9768761..0000000 --- a/c58b1056-init-bitmap-size.patch +++ /dev/null @@ -1,27 +0,0 @@ -commit c58b105625acf3404d75376b070903139e3346a3 -Author: Jim Fehlig -Date: Wed Dec 22 11:15:32 2010 -0700 - - Set bitmap size when allocating a bitmap - - I began noticing a race when reserving VNC ports as described here - - https://www.redhat.com/archives/libvir-list/2010-November/msg00379.html - - Turns out that we were not initializing the size field of bitmap - struct when allocating the bitmap. This subsequently caused - virBitmapSetBit() to fail since bitmap->size is 0, hence we never - actually reserved the port. - -diff --git a/src/util/bitmap.c b/src/util/bitmap.c -index 1b0c9da..9741668 100644 ---- a/src/util/bitmap.c -+++ b/src/util/bitmap.c -@@ -73,6 +73,7 @@ virBitmapPtr virBitmapAlloc(size_t size) - return NULL; - } - -+ bitmap->size = size; - return bitmap; - } - diff --git a/libvirt-0.8.6.tar.bz2 b/libvirt-0.8.6.tar.bz2 deleted file mode 100644 index 6ef7935..0000000 --- a/libvirt-0.8.6.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:00392714fb1aca8c75d2dbe88dad91744da0028e7b259918a40ac930edabb0d9 -size 8912706 diff --git a/libvirt-0.8.7.tar.bz2 b/libvirt-0.8.7.tar.bz2 new file mode 100644 index 0000000..55faebe --- /dev/null +++ b/libvirt-0.8.7.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04bfc87bd6f91b5da74d4becab86db6585002a066c70d6ab107510df8def9b33 +size 9211439 diff --git a/libvirt.changes b/libvirt.changes index b4d6edf..6303c0a 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jan 3 13:12:21 MST 2010 - jfehlig@novell.com + +- Update to libvirt 0.8.7 (pre-release) + ------------------------------------------------------------------- Wed Dec 22 14:41:46 MST 2010 - jfehlig@novell.com diff --git a/libvirt.spec b/libvirt.spec index fa444b1..99e90a3 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -1,5 +1,5 @@ # -# spec file for package libvirt (Version 0.8.6) +# spec file for package libvirt (Version 0.8.7) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -144,7 +144,7 @@ Url: http://libvirt.org/ License: LGPLv2.1+ Group: Development/Libraries/C and C++ AutoReqProv: yes -Version: 0.8.6 +Version: 0.8.7 Release: 1 Summary: A C toolkit to interract with the virtualization capabilities of Linux # The client side, i.e. shared libs and virsh are in a subpackage @@ -169,9 +169,6 @@ Recommends: PolicyKit >= 0.6 Source0: %{name}-%{version}.tar.bz2 Source1: libvirtd.init # Upstream patches -Patch0: 45147ca3-macvtap-warning.patch -Patch1: 474b1c14-macvtap-undefined.patch -Patch2: c58b1056-init-bitmap-size.patch # Need to go upstream Patch100: xen-name-for-devid.patch Patch102: clone.patch @@ -283,9 +280,6 @@ Authors: %prep %setup -q -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 %patch100 -p1 %patch102 %patch103 -p1 From 0fd8fc72d6f9f51cdfc535bedc1d9195f598fa06156691cc4f13cf76dda287e3 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Mon, 3 Jan 2011 20:21:30 +0000 Subject: [PATCH 3/8] update copyright year OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=81 --- libvirt.changes | 2 +- libvirt.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libvirt.changes b/libvirt.changes index 6303c0a..423cca3 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,5 +1,5 @@ ------------------------------------------------------------------- -Mon Jan 3 13:12:21 MST 2010 - jfehlig@novell.com +Mon Jan 3 13:12:21 MST 2011 - jfehlig@novell.com - Update to libvirt 0.8.7 (pre-release) diff --git a/libvirt.spec b/libvirt.spec index 99e90a3..ee422f1 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -1,7 +1,7 @@ # # spec file for package libvirt (Version 0.8.7) # -# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2011 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 From a86da6b3395275d9ed3b1768fae78f8d2e3ea5a0599a95146bcb8964f2f03506 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Tue, 4 Jan 2011 21:14:42 +0000 Subject: [PATCH 4/8] update to official 0.8.7 release OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=82 --- libvirt-0.8.7.tar.bz2 | 4 ++-- libvirt.changes | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libvirt-0.8.7.tar.bz2 b/libvirt-0.8.7.tar.bz2 index 55faebe..38cfd5d 100644 --- a/libvirt-0.8.7.tar.bz2 +++ b/libvirt-0.8.7.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:04bfc87bd6f91b5da74d4becab86db6585002a066c70d6ab107510df8def9b33 -size 9211439 +oid sha256:98d76f1aa9ce28e887271969f67f7a470b554cfb1a22c4e9d2f2ae6db45e6135 +size 9205470 diff --git a/libvirt.changes b/libvirt.changes index 423cca3..600b1a4 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,7 +1,11 @@ ------------------------------------------------------------------- Mon Jan 3 13:12:21 MST 2011 - jfehlig@novell.com -- Update to libvirt 0.8.7 (pre-release) +- Update to libvirt 0.8.7 + - Preliminary support for VirtualBox 4.0 + - IPv6 support + - Add VMware Workstation and Player driver + - Add network disk support ------------------------------------------------------------------- Wed Dec 22 14:41:46 MST 2010 - jfehlig@novell.com From 87d443002ea8db88a1fd0085fbf09f77ad5fc915ed5048b0e139db24d8ab344c Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Tue, 11 Jan 2011 23:41:45 +0000 Subject: [PATCH 5/8] Support libvirt-guests on SuSE distros OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=83 --- libvirt.changes | 7 + libvirt.spec | 6 + use-libvirt-guests-on-suse.patch | 229 +++++++++++++++++++++++++++++++ 3 files changed, 242 insertions(+) create mode 100644 use-libvirt-guests-on-suse.patch diff --git a/libvirt.changes b/libvirt.changes index 600b1a4..6ce3aa7 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jan 11 16:40:27 MST 2011 - jfehlig@novell.com + +- Support libvirt-guests on SuSE distros + use-libvirt-guests-on-suse.patch + bnc#653398 + ------------------------------------------------------------------- Mon Jan 3 13:12:21 MST 2011 - jfehlig@novell.com diff --git a/libvirt.spec b/libvirt.spec index ee422f1..7fb76ca 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -177,6 +177,7 @@ Patch104: xen-domctl-ver7.patch Patch105: xend-disk-order.patch # Our patches Patch200: libvirtd-defaults.patch +Patch201: use-libvirt-guests-on-suse.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -286,6 +287,7 @@ Authors: %patch104 -p1 %patch105 -p1 %patch200 -p1 +%patch201 -p1 %build %if ! %{with_xen} @@ -431,6 +433,7 @@ rm -rf $RPM_BUILD_ROOT /sbin/ldconfig %if 0%{?sles_version} %{fillup_and_insserv -f -y libvirtd} +%{fillup_only -n libvirt-guests} %endif %preun @@ -507,6 +510,9 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/virt-xml-validate %{_bindir}/virt-pki-validate %{_libdir}/lib*.so.* +%{_localstatedir}/adm/fillup-templates/sysconfig.libvirt-guests +%config /etc/init.d/libvirt-guests +%{_sbindir}/rclibvirt-guests %dir %{_datadir}/libvirt/ %dir %{_datadir}/libvirt/schemas/ diff --git a/use-libvirt-guests-on-suse.patch b/use-libvirt-guests-on-suse.patch new file mode 100644 index 0000000..6d05406 --- /dev/null +++ b/use-libvirt-guests-on-suse.patch @@ -0,0 +1,229 @@ +Index: libvirt-0.8.7/tools/Makefile.am +=================================================================== +--- libvirt-0.8.7.orig/tools/Makefile.am ++++ libvirt-0.8.7/tools/Makefile.am +@@ -129,17 +129,18 @@ install-data-local: install-init + + uninstall-local: uninstall-init + +-if LIBVIRT_INIT_SCRIPT_RED_HAT + install-init: libvirt-guests.init +- mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d ++ mkdir -p $(DESTDIR)$(sysconfdir)/init.d + $(INSTALL_SCRIPT) libvirt-guests.init \ +- $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests +- mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig ++ $(DESTDIR)$(sysconfdir)/init.d/libvirt-guests ++ ln -s $(DESTDIR)$(sysconfdir)/init.d/libvirt-guests \ ++ $(DESTDIR)/usr/sbin/rclibvirt-guests ++ mkdir -p $(DESTDIR)/var/adm/fillup-templates + $(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \ +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests ++ $(DESTDIR)/var/adm/fillup-templates/sysconfig.libvirt-guests + + uninstall-init: +- rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests \ ++ rm -f $(DESTDIR)$(sysconfdir)/init.d/libvirt-guests \ + $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests + + BUILT_SOURCES += libvirt-guests.init +@@ -152,11 +153,6 @@ libvirt-guests.init: libvirt-guests.init + < $< > $@-t && \ + chmod a+x $@-t && \ + mv $@-t $@ +-else +-install-init: +-uninstall-init: +-libvirt-guests.init: +-endif # LIBVIRT_INIT_SCRIPT_RED_HAT + + + CLEANFILES = $(bin_SCRIPTS) $(man1_MANS) +Index: libvirt-0.8.7/tools/libvirt-guests.sysconf +=================================================================== +--- libvirt-0.8.7.orig/tools/libvirt-guests.sysconf ++++ libvirt-0.8.7/tools/libvirt-guests.sysconf +@@ -1,15 +1,23 @@ ++## Path: System/Virtualization/libvirt ++ ++## Type: string ++## Default: default + # URIs to check for running guests + # example: URIS='default xen:/// vbox+tcp://host/system lxc:///' +-#URIS=default ++URIS=default + ++## Type: string ++## Default: start + # action taken on host boot + # - start all guests which were running on shutdown are started on boot + # regardless on their autostart settings + # - ignore libvirt-guests init script won't start any guest on boot, however, + # guests marked as autostart will still be automatically started by + # libvirtd +-#ON_BOOT=start ++ON_BOOT=start + ++## Type: string ++## Default: suspend + # action taken on host shutdown + # - suspend all running guests are suspended using virsh managedsave + # - shutdown all running guests are asked to shutdown. Please be careful with +@@ -18,7 +26,9 @@ + # which just needs a long time to shutdown. When setting + # ON_SHUTDOWN=shutdown, you must also set SHUTDOWN_TIMEOUT to a + # value suitable for your guests. +-#ON_SHUTDOWN=suspend ++ON_SHUTDOWN=suspend + ++## Type: integer ++## Default: 120 + # number of seconds we're willing to wait for a guest to shut down +-#SHUTDOWN_TIMEOUT=0 ++SHUTDOWN_TIMEOUT=120 +Index: libvirt-0.8.7/tools/libvirt-guests.init.in +=================================================================== +--- libvirt-0.8.7.orig/tools/libvirt-guests.init.in ++++ libvirt-0.8.7/tools/libvirt-guests.init.in +@@ -4,10 +4,10 @@ + # + ### BEGIN INIT INFO + # Provides: libvirt-guests +-# Required-Start: libvirtd +-# Required-Stop: libvirtd +-# Default-Start: 2 3 4 5 +-# Default-Stop: 0 1 6 ++# Required-Start: $network $remote_fs libvirtd ++# Required-Stop: $network $remote_fs libvirtd ++# Default-Start: 3 5 ++# Default-Stop: 0 1 2 4 6 + # Short-Description: suspend/resume libvirt guests on shutdown/boot + # Description: This is a script for suspending active libvirt guests + # on shutdown and resuming them on next boot +@@ -24,14 +24,13 @@ + # See http://libvirt.org + # + ++. /etc/rc.status ++rc_reset ++ + sysconfdir=@sysconfdir@ + localstatedir=@localstatedir@ + libvirtd=@sbindir@/libvirtd + +-# Source function library. +-test ! -r "$sysconfdir"/rc.d/init.d/functions || +- . "$sysconfdir"/rc.d/init.d/functions +- + URIS=default + ON_BOOT=start + ON_SHUTDOWN=suspend +@@ -42,12 +41,10 @@ test -f "$sysconfdir"/sysconfig/libvirt- + LISTFILE="$localstatedir"/lib/libvirt/libvirt-guests + VAR_SUBSYS_LIBVIRT_GUESTS="$localstatedir"/lock/subsys/libvirt-guests + +-RETVAL=0 +- + retval() { + "$@" + if [ $? -ne 0 ]; then +- RETVAL=1 ++ rc_failed 1 + return 1 + else + return 0 +@@ -71,12 +68,31 @@ run_virsh_c() { + ( export LC_ALL=C; run_virsh "$@" ) + } + ++await_daemon_up() ++{ ++ uri=$1 ++ i=1 ++ rets=10 ++ run_virsh $uri list > /dev/null 2>&1 ++ while [ $? -ne 0 -a $i -lt $rets ]; do ++ sleep 1 ++ echo -n . ++ i=$(($i + 1)) ++ run_virsh $uri list > /dev/null 2>&1 ++ done ++ if [ $i -eq $rets ]; then ++ echo $"libvirt-guests unable to connect to URI: $uri" ++ return 1 ++ fi ++ return 0 ++} ++ + list_guests() { + uri=$1 + + list=$(run_virsh_c $uri list) + if [ $? -ne 0 ]; then +- RETVAL=1 ++ rc_failed 1 + return 1 + fi + +@@ -84,7 +100,7 @@ list_guests() { + for id in $(echo "$list" | awk 'NR > 2 {print $1}'); do + uuid=$(run_virsh_c $uri dominfo $id | awk '/^UUID:/{print $2}') + if [ -z "$uuid" ]; then +- RETVAL=1 ++ rc_failed 1 + return 1 + fi + uuids="$uuids $uuid" +@@ -111,7 +127,7 @@ guest_is_on() { + guest_running=false + info=$(run_virsh_c $uri dominfo $uuid) + if [ $? -ne 0 ]; then +- RETVAL=1 ++ rc_failed 1 + return 1 + fi + +@@ -148,6 +164,12 @@ start() { + continue + fi + ++ await_daemon_up $uri ++ if [ $? -ne 0 ]; then ++ echo $"Ignoring guests on $uri URI, can't connect" ++ continue ++ fi ++ + echo $"Resuming guests on $uri URI..." + for guest in $list; do + name=$(guest_name $uri $guest) +@@ -227,7 +249,7 @@ stop() { + suspending=false + if [ $SHUTDOWN_TIMEOUT -le 0 ]; then + echo $"Shutdown action requested but SHUTDOWN_TIMEOUT was not set" +- RETVAL=6 ++ rc_failed 6 + return + fi + fi +@@ -291,14 +313,13 @@ gueststatus() { + rh_status() { + if [ -f "$LISTFILE" ]; then + echo $"stopped, with saved guests" +- RETVAL=3 ++ rc_failed 3 + else + if [ -f "$VAR_SUBSYS_LIBVIRT_GUESTS" ]; then + echo $"started" + else + echo $"stopped, with no saved guests" + fi +- RETVAL=0 + fi + } + +@@ -340,4 +361,4 @@ case "$1" in + usage + ;; + esac +-exit $RETVAL ++rc_exit From 2c25ad0e78db82c2e865ab637f9d373c99f8d0cb87120082f3003c000cbcb883 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Wed, 12 Jan 2011 22:51:53 +0000 Subject: [PATCH 6/8] build script changes for libvirt-guests OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=84 --- libvirt.spec | 3 ++- use-libvirt-guests-on-suse.patch | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libvirt.spec b/libvirt.spec index 7fb76ca..0ad84e9 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -420,10 +420,11 @@ ln_dupes() ln_dupes .%{_docdir}/%{name} ln_dupes ./usr/share/locale ) -# init script +# init scripts mkdir -p $RPM_BUILD_ROOT/etc/init.d install %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/libvirtd ln -s /etc/init.d/libvirtd $RPM_BUILD_ROOT/usr/sbin/rclibvirtd +ln -s /etc/init.d/libvirt-guests $RPM_BUILD_ROOT/usr/sbin/rclibvirt-guests %find_lang %{name} %clean diff --git a/use-libvirt-guests-on-suse.patch b/use-libvirt-guests-on-suse.patch index 6d05406..79552f8 100644 --- a/use-libvirt-guests-on-suse.patch +++ b/use-libvirt-guests-on-suse.patch @@ -2,7 +2,7 @@ Index: libvirt-0.8.7/tools/Makefile.am =================================================================== --- libvirt-0.8.7.orig/tools/Makefile.am +++ libvirt-0.8.7/tools/Makefile.am -@@ -129,17 +129,18 @@ install-data-local: install-init +@@ -129,17 +129,16 @@ install-data-local: install-init uninstall-local: uninstall-init @@ -14,8 +14,6 @@ Index: libvirt-0.8.7/tools/Makefile.am - $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests - mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig + $(DESTDIR)$(sysconfdir)/init.d/libvirt-guests -+ ln -s $(DESTDIR)$(sysconfdir)/init.d/libvirt-guests \ -+ $(DESTDIR)/usr/sbin/rclibvirt-guests + mkdir -p $(DESTDIR)/var/adm/fillup-templates $(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \ - $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests @@ -27,7 +25,7 @@ Index: libvirt-0.8.7/tools/Makefile.am $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests BUILT_SOURCES += libvirt-guests.init -@@ -152,11 +153,6 @@ libvirt-guests.init: libvirt-guests.init +@@ -152,11 +151,6 @@ libvirt-guests.init: libvirt-guests.init < $< > $@-t && \ chmod a+x $@-t && \ mv $@-t $@ From f130666494f6fa69c262e182847dfdbaa221738c7678b5e84a84d4d8ae30a97b Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Wed, 12 Jan 2011 23:13:53 +0000 Subject: [PATCH 7/8] another Makefile adjustment for libvirt-guests OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=85 --- use-libvirt-guests-on-suse.patch | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/use-libvirt-guests-on-suse.patch b/use-libvirt-guests-on-suse.patch index 79552f8..9e48d9a 100644 --- a/use-libvirt-guests-on-suse.patch +++ b/use-libvirt-guests-on-suse.patch @@ -2,7 +2,7 @@ Index: libvirt-0.8.7/tools/Makefile.am =================================================================== --- libvirt-0.8.7.orig/tools/Makefile.am +++ libvirt-0.8.7/tools/Makefile.am -@@ -129,17 +129,16 @@ install-data-local: install-init +@@ -129,18 +129,18 @@ install-data-local: install-init uninstall-local: uninstall-init @@ -21,11 +21,14 @@ Index: libvirt-0.8.7/tools/Makefile.am uninstall-init: - rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests \ +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests + rm -f $(DESTDIR)$(sysconfdir)/init.d/libvirt-guests \ - $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests ++ $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests \ ++ $(DESTDIR)/var/adm/fillup-templates/sysconfig.libvirt-guests BUILT_SOURCES += libvirt-guests.init -@@ -152,11 +151,6 @@ libvirt-guests.init: libvirt-guests.init + +@@ -152,11 +152,6 @@ libvirt-guests.init: libvirt-guests.init < $< > $@-t && \ chmod a+x $@-t && \ mv $@-t $@ From c2191ca9d3395badc0a7f5dd85484f5b9b9ba0274f13a1ee09c7ca2017aa7385 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Fri, 14 Jan 2011 22:41:37 +0000 Subject: [PATCH 8/8] - Fix generation of dnsmasq's --dhcp-hostsfile option a43c7338-dnsmasq-hostfile-fix.patch - Disable yajl support as the library does not yet exist in SuSE distros. OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=86 --- a43c7338-dnsmasq-hostfile-fix.patch | 48 +++++++++++++++++++++++++++++ libvirt.changes | 8 +++++ libvirt.spec | 6 ++-- 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 a43c7338-dnsmasq-hostfile-fix.patch diff --git a/a43c7338-dnsmasq-hostfile-fix.patch b/a43c7338-dnsmasq-hostfile-fix.patch new file mode 100644 index 0000000..0336bf2 --- /dev/null +++ b/a43c7338-dnsmasq-hostfile-fix.patch @@ -0,0 +1,48 @@ +commit a43c7338d8772aa3a5bc0ec5914d3c28c20447c3 +Author: Kay Schubert +Date: Thu Jan 6 09:14:58 2011 +0100 + + bridge: Fix generation of dnsmasq's --dhcp-hostsfile option + + I added a host definition to a network definition: + + + Lokal + 2074f379-b82c-423f-9ada-305d8088daaa + + + + + + + + + + But due to the wrong if-statement the argument --dhcp-hostsfile doesn't get + added to the dnsmasq command. The patch below fixes it for me. + +diff --git a/AUTHORS b/AUTHORS +index b204bd6..721b8f8 100644 +--- a/AUTHORS ++++ b/AUTHORS +@@ -142,6 +142,7 @@ Patches have also been contributed by: + Josh Durgin + Roopa Prabhu + Paweł Krześniak ++ Kay Schubert + + [....send patches to get your name here....] + +diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c +index 7d43ef5..4c64a74 100644 +--- a/src/network/bridge_driver.c ++++ b/src/network/bridge_driver.c +@@ -524,7 +524,7 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network, + goto cleanup; + } + +- if (networkSaveDnsmasqHostsfile(ipdef, dctx, false) < 0) { ++ if (networkSaveDnsmasqHostsfile(ipdef, dctx, false) == 0) { + virCommandAddArgPair(cmd, "--dhcp-hostsfile", + dctx->hostsfile->path); + } diff --git a/libvirt.changes b/libvirt.changes index 6ce3aa7..c5baaee 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Jan 14 15:39:16 MST 2011 - jfehlig@novell.com + +- Fix generation of dnsmasq's --dhcp-hostsfile option + a43c7338-dnsmasq-hostfile-fix.patch +- Disable yajl support as the library does not yet exist in + SuSE distros. + ------------------------------------------------------------------- Tue Jan 11 16:40:27 MST 2011 - jfehlig@novell.com diff --git a/libvirt.spec b/libvirt.spec index 0ad84e9..f18a603 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -39,6 +39,8 @@ %define with_selinux 1 %define with_apparmor 0 # options +# still no yajl json library +%define with_yajl 0 %if 0%{?suse_version} >= 1130 %define with_capng 1 %else @@ -46,12 +48,10 @@ %endif %if 0%{?suse_version} >= 1140 %define with_netcf 1 -%define with_yajl 1 %define with_macvtap 1 %define with_virtualport 1 %else %define with_netcf 0 -%define with_yajl 0 %define with_macvtap 0 %define with_virtualport 0 %endif @@ -169,6 +169,7 @@ Recommends: PolicyKit >= 0.6 Source0: %{name}-%{version}.tar.bz2 Source1: libvirtd.init # Upstream patches +Patch0: a43c7338-dnsmasq-hostfile-fix.patch # Need to go upstream Patch100: xen-name-for-devid.patch Patch102: clone.patch @@ -281,6 +282,7 @@ Authors: %prep %setup -q +%patch0 -p1 %patch100 -p1 %patch102 %patch103 -p1