[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Minor fix to xentop to stop it dying when domains go away at the wrong time


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Graham, Simon" <Simon.Graham@xxxxxxxxxxx>
  • Date: Fri, 14 Jul 2006 15:00:50 -0400
  • Delivery-date: Fri, 14 Jul 2006 12:01:35 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: Acand9LoRipfzu2uScKevuqfQHi0Uw==
  • Thread-topic: [PATCH] Minor fix to xentop to stop it dying when domains go away at the wrong time

Currently, xentop exits with a failure if xenstat_get_node() returns
NULL - this can happen if a VM is deleted between the time
xenstat_get_node() gets the list of VMs and the time it attempts to
collect information about the VMs. This patch modifies xentop to simply
ignore a NULL return and loop around to try the call again.

Note that the patch supplied is against 3.0.testing although I think
unstable is basically the same.

Signed-off-by: Simon Graham Simon.Graham@xxxxxxxxxxx

---
Index: xentop.c
===================================================================
--- xentop.c    (revision 3098)
+++ xentop.c    (working copy)
@@ -762,14 +762,18 @@
 {
        xenstat_domain **domains;
        unsigned int i, num_domains = 0;
+        xenstat_node *new_node = xenstat_get_node(xhandle,
XENSTAT_ALL);
 
-       /* Now get the node information */
+        if (new_node == NULL) {
+               // This can happen if domains change during call - just
+               // return and try again
+               return;
+        }
+
        if (prev_node != NULL)
                xenstat_free_node(prev_node);
        prev_node = cur_node;
-       cur_node = xenstat_get_node(xhandle, XENSTAT_ALL);
-       if (cur_node == NULL)
-               fail("Failed to retrieve statistics from libxenstat\n");
+       cur_node = new_node;
 
        /* dump summary top information */
        do_summary();
@@ -871,8 +875,10 @@
                if(ch != ERR || (curtime.tv_sec - oldtime.tv_sec) >=
delay) {
                        clear();
                        top();
-                       oldtime = curtime;
-                       refresh();
+                        if (cur_node != NULL) {
+                               oldtime = curtime;
+                               refresh();
+                        }
                }
                ch = getch();
        } while (handle_key(ch));





_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.