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-changelog

[Xen-changelog] [xen-unstable] libxenlight: fix name to domid conversion

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxenlight: fix name to domid conversion
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Nov 2009 07:50:17 -0800
Delivery-date: Fri, 13 Nov 2009 07:50:23 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1258126224 0
# Node ID d714386b668fd4082f708ee1e417719901a095eb
# Parent  accded2f185f4178f875b170a5c01544648a68d2
libxenlight: fix name to domid conversion

This patch makes sure that the domain name to domid conversion is
correct, cross referencing the information found on xenstore with the
list of running domains.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_utils.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff -r accded2f185f -r d714386b668f tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Thu Nov 12 13:15:40 2009 +0000
+++ b/tools/libxl/libxl_utils.c Fri Nov 13 15:30:24 2009 +0000
@@ -53,18 +53,26 @@ int libxl_name_to_domid(struct libxl_ctx
 {
     unsigned int num, len;
     char path[strlen("/local/domain") + 12];
-    int i;
+    int i, j, nb_domains;
     char *domname, **l;
+    struct libxl_dominfo *dominfo;
+
+    dominfo = libxl_domain_list(ctx, &nb_domains);
 
     l = xs_directory(ctx->xsh, XBT_NULL, "/local/domain", &num);
     for (i = 0; i < num; i++) {
         snprintf(path, sizeof(path), "/local/domain/%s/name", l[i]);
         domname = xs_read(ctx->xsh, XBT_NULL, path, &len);
         if (domname != NULL && !strncmp(domname, name, len)) {
-            *domid = atoi(l[i]);
-            free(l);
-            free(domname);
-            return 0;
+            int domid_i = atoi(l[i]);
+            for (j = 0; j < nb_domains; j++) {
+                if (dominfo[j].domid == domid_i) {
+                    *domid = domid_i;
+                    free(l);
+                    free(domname);
+                    return 0;
+                }
+            }
         }
         free(domname);
     }

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxenlight: fix name to domid conversion, Xen patchbot-unstable <=