WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Minor fix to xentop to stop it dying when domains go

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Minor fix to xentop to stop it dying when domains go away at the wrong time
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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