[fedora-virt-maint] rpms/libvirt/F-9 libvirt-0.6.0-rpccall.patch, NONE, 1.1 libvirt-0.6.0-timeout.patch, NONE, 1.1 libvirt.spec, 1.98, 1.99 sources, 1.36, 1.37

Daniel P. Berrange berrange at fedoraproject.org
Fri Feb 6 20:01:32 UTC 2009


Author: berrange

Update of /cvs/pkgs/rpms/libvirt/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv18995

Modified Files:
	libvirt.spec sources 
Added Files:
	libvirt-0.6.0-rpccall.patch libvirt-0.6.0-timeout.patch 
Log Message:
Fix libvirtd --timeout usage
Fix RPC call problems and QEMU startup handling (rhbz #484414)
Fix unowned directories (rhbz #483442)

libvirt-0.6.0-rpccall.patch:

--- NEW FILE libvirt-0.6.0-rpccall.patch ---
diff -rup libvirt-0.6.0.orig/qemud/event.c libvirt-0.6.0.new/qemud/event.c
--- libvirt-0.6.0.orig/qemud/event.c	2009-02-06 19:30:58.000000000 +0000
+++ libvirt-0.6.0.new/qemud/event.c	2009-02-06 19:30:00.000000000 +0000
@@ -657,6 +657,8 @@ virPollEventToEventHandleType(int events
         ret |= VIR_EVENT_HANDLE_WRITABLE;
     if(events & POLLERR)
         ret |= VIR_EVENT_HANDLE_ERROR;
+    if(events & POLLNVAL) /* Treat NVAL as error, since libvirt doesn't distinguish */
+        ret |= VIR_EVENT_HANDLE_ERROR;
     if(events & POLLHUP)
         ret |= VIR_EVENT_HANDLE_HANGUP;
     return ret;
diff -rup libvirt-0.6.0.orig/src/domain_conf.c libvirt-0.6.0.new/src/domain_conf.c
--- libvirt-0.6.0.orig/src/domain_conf.c	2009-01-31 09:04:17.000000000 +0000
+++ libvirt-0.6.0.new/src/domain_conf.c	2009-02-06 19:30:00.000000000 +0000
@@ -504,6 +504,7 @@ virDomainObjPtr virDomainAssignDef(virCo
     domain->state = VIR_DOMAIN_SHUTOFF;
     domain->def = def;
     domain->monitor_watch = -1;
+    domain->monitor = -1;
 
     if (VIR_REALLOC_N(doms->objs, doms->count + 1) < 0) {
         virReportOOMError(conn);
diff -rup libvirt-0.6.0.orig/src/remote_internal.c libvirt-0.6.0.new/src/remote_internal.c
--- libvirt-0.6.0.orig/src/remote_internal.c	2009-01-31 09:04:18.000000000 +0000
+++ libvirt-0.6.0.new/src/remote_internal.c	2009-02-06 19:30:00.000000000 +0000
@@ -6198,17 +6198,17 @@ processCalls(virConnectPtr conn,
                 continue;
             virReportSystemError(in_open ? NULL : conn, errno,
                                  "%s", _("poll on socket failed"));
-            return -1;
+            goto error;
         }
 
         if (fds[0].revents & POLLOUT) {
             if (processCallSend(conn, priv, in_open) < 0)
-                return -1;
+                goto error;
         }
 
         if (fds[0].revents & POLLIN) {
             if (processCallRecv(conn, priv, in_open) < 0)
-                return -1;
+                goto error;
         }
 
         /* Iterate through waiting threads and if
@@ -6259,9 +6259,21 @@ processCalls(virConnectPtr conn,
         if (fds[0].revents & (POLLHUP | POLLERR)) {
             errorf(in_open ? NULL : conn, VIR_ERR_INTERNAL_ERROR,
                    "%s", _("received hangup / error event on socket"));
-            return -1;
+            goto error;
         }
     }
+
+
+error:
+    priv->waitDispatch = thiscall->next;
+    DEBUG("Giving up the buck due to I/O error %d %p %p", thiscall->proc_nr, thiscall, priv->waitDispatch);
+    /* See if someone else is still waiting
+     * and if so, then pass the buck ! */
+    if (priv->waitDispatch) {
+        DEBUG("Passing the buck to %d %p", priv->waitDispatch->proc_nr, priv->waitDispatch);
+        virCondSignal(&priv->waitDispatch->cond);
+    }
+    return -1;
 }
 
 /*

libvirt-0.6.0-timeout.patch:

--- NEW FILE libvirt-0.6.0-timeout.patch ---
diff -rup libvirt-0.6.0.orig/qemud/event.c libvirt-0.6.0.new/qemud/event.c
--- libvirt-0.6.0.orig/qemud/event.c	2008-12-22 13:02:54.000000000 +0000
+++ libvirt-0.6.0.new/qemud/event.c	2009-02-06 19:29:28.000000000 +0000
@@ -68,6 +68,7 @@ struct virEventTimeout {
 /* State for the main event loop */
 struct virEventLoop {
     pthread_mutex_t lock;
+    int running;
     pthread_t leader;
     int wakeupfd[2];
     int handlesCount;
@@ -521,6 +522,7 @@ int virEventRunOnce(void) {
     int ret, timeout, nfds;
 
     virEventLock();
+    eventLoop.running = 1;
     eventLoop.leader = pthread_self();
     if ((nfds = virEventMakePollFDs(&fds)) < 0) {
         virEventUnlock();
@@ -572,7 +574,7 @@ int virEventRunOnce(void) {
         return -1;
     }
 
-    eventLoop.leader = 0;
+    eventLoop.running = 0;
     virEventUnlock();
     return 0;
 }
@@ -611,7 +613,9 @@ int virEventInit(void)
 static int virEventInterruptLocked(void)
 {
     char c = '\0';
-    if (pthread_self() == eventLoop.leader)
+
+    if (!eventLoop.running ||
+        pthread_self() == eventLoop.leader)
         return 0;
 
     if (safewrite(eventLoop.wakeupfd[1], &c, sizeof(c)) != sizeof(c))
diff -rup libvirt-0.6.0.orig/qemud/qemud.c libvirt-0.6.0.new/qemud/qemud.c
--- libvirt-0.6.0.orig/qemud/qemud.c	2009-01-31 09:04:17.000000000 +0000
+++ libvirt-0.6.0.new/qemud/qemud.c	2009-02-06 19:29:28.000000000 +0000
@@ -2013,11 +2013,15 @@ static int qemudOneLoop(void) {
     return 0;
 }
 
-static void qemudInactiveTimer(int timer ATTRIBUTE_UNUSED, void *data) {
+static void qemudInactiveTimer(int timerid, void *data) {
     struct qemud_server *server = (struct qemud_server *)data;
-    DEBUG0("Got inactive timer expiry");
-    if (!virStateActive()) {
-        DEBUG0("No state active, shutting down");
+
+    if (virStateActive() ||
+        server->clients) {
+        DEBUG0("Timer expired but still active, not shutting down");
+        virEventUpdateTimeoutImpl(timerid, -1);
+    } else {
+        DEBUG0("Timer expired and inactive, shutting down");
         server->shutdown = 1;
     }
 }
@@ -2048,9 +2052,18 @@ static void qemudFreeClient(struct qemud
 static int qemudRunLoop(struct qemud_server *server) {
     int timerid = -1;
     int ret = -1, i;
+    int timerActive = 0;
 
     virMutexLock(&server->lock);
 
+    if (timeout > 0 &&
+        (timerid = virEventAddTimeoutImpl(-1,
+                                          qemudInactiveTimer,
+                                          server, NULL)) < 0) {
+        VIR_ERROR0(_("Failed to register shutdown timeout"));
+        return -1;
+    }
+
     if (min_workers > max_workers)
         max_workers = min_workers;
 
@@ -2071,11 +2084,21 @@ static int qemudRunLoop(struct qemud_ser
          * if any drivers have active state, if not
          * shutdown after timeout seconds
          */
-        if (timeout > 0 && !virStateActive() && !server->clients) {
-            timerid = virEventAddTimeoutImpl(timeout*1000,
-                                             qemudInactiveTimer,
-                                             server, NULL);
-            DEBUG("Scheduling shutdown timer %d", timerid);
+        if (timeout > 0) {
+            if (timerActive) {
+                if (server->clients) {
+                    DEBUG("Deactivating shutdown timer %d", timerid);
+                    virEventUpdateTimeoutImpl(timerid, -1);
+                    timerActive = 0;
+                }
+            } else {
+                if (!virStateActive() &&
+                    !server->clients) {
+                    DEBUG("Activating shutdown timer %d", timerid);
+                    virEventUpdateTimeoutImpl(timerid, timeout * 1000);
+                    timerActive = 1;
+                }
+            }
         }
 
         virMutexUnlock(&server->lock);
@@ -2129,15 +2152,6 @@ static int qemudRunLoop(struct qemud_ser
             }
         }
 
-        /* Unregister any timeout that's active, since we
-         * just had an event processed
-         */
-        if (timerid != -1) {
-            DEBUG("Removing shutdown timer %d", timerid);
-            virEventRemoveTimeoutImpl(timerid);
-            timerid = -1;
-        }
-
         if (server->shutdown) {
             ret = 0;
             break;


Index: libvirt.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libvirt/F-9/libvirt.spec,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -r1.98 -r1.99
--- libvirt.spec	31 Jan 2009 10:16:17 -0000	1.98
+++ libvirt.spec	6 Feb 2009 20:01:02 -0000	1.99
@@ -47,10 +47,12 @@
 Summary: Library providing a simple API virtualization
 Name: libvirt
 Version: 0.6.0
-Release: 1%{?dist}%{?extra_release}
+Release: 2%{?dist}%{?extra_release}
 License: LGPLv2+
 Group: Development/Libraries
 Source: libvirt-%{version}.tar.gz
+Patch1: %{name}-%{version}-timeout.patch
+Patch2: %{name}-%{version}-rpccall.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 URL: http://libvirt.org/
 BuildRequires: python python-devel
@@ -177,6 +179,8 @@
 
 %prep
 %setup -q
+%patch1 -p1
+%patch2 -p1
 
 %build
 %if ! %{with_xen}
@@ -390,6 +394,7 @@
 %if %{with_network}
 %dir %{_localstatedir}/run/libvirt/network/
 %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/iptables/
 %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/iptables/filter/
 %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/iptables/nat/
 %endif
@@ -408,6 +413,7 @@
 %{_datadir}/PolicyKit/policy/org.libvirt.unix.policy
 %endif
 
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/
 %if %{with_qemu}
 %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
 %endif
@@ -457,6 +463,11 @@
 %endif
 
 %changelog
+* Fri Feb  6 2009 Daniel P. Berrange <berrange at redhat.com> - 0.6.0-2.fc9
+- Fix libvirtd --timeout usage
+- Fix RPC call problems and QEMU startup handling (rhbz #484414)
+- Fix unowned directories (rhbz #483442)
+
 * Sat Jan 31 2009 Daniel Veillard <veillard at redhat.com> - 0.6.0-1.fc9
 - upstream release 0.6.0
 - thread safety of API


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/libvirt/F-9/sources,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- sources	31 Jan 2009 10:16:17 -0000	1.36
+++ sources	6 Feb 2009 20:01:02 -0000	1.37
@@ -1,2 +1 @@
-abc697978e9c66cbc8d8db4fa3f1c1b6  libvirt-0.5.1.tar.gz
 8e0120d5452b37179f682031bf0895ea  libvirt-0.6.0.tar.gz




More information about the Fedora-virt-maint mailing list