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

[Xen-changelog] [xen-unstable] xl: Check domain existance when doing domain identifier lookups



# HG changeset patch
# User Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
# Date 1295980063 0
# Node ID 73b3debb90cfe4d811596a7cea83ff6389728c80
# Parent  b457e2520074179e76996446cdaaba5e17e46c67
xl: Check domain existance when doing domain identifier lookups

[ Code formatting fixed up to conform to libxl style. -iwj ]

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff -r b457e2520074 -r 73b3debb90cf tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue Jan 25 18:24:36 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Tue Jan 25 18:27:43 2011 +0000
@@ -143,11 +143,25 @@ static int domain_qualifier_to_domid(con
 static int domain_qualifier_to_domid(const char *p, uint32_t *domid_r,
                                      int *was_name_r)
 {
-    int was_name;
+    libxl_dominfo dominfo;
+    int was_name, rc;
 
     was_name = qualifier_to_id(p, domid_r);
-    if (was_name_r) *was_name_r = was_name;
-    return was_name ? libxl_name_to_domid(&ctx, p, domid_r) : 0;
+    if (was_name_r)
+        *was_name_r = was_name;
+
+    if (was_name) {
+        rc = libxl_name_to_domid(&ctx, p, domid_r);
+        if (rc)
+            return rc;
+    } else {
+        rc = libxl_domain_info(&ctx, &dominfo, *domid_r);
+        /* error only if domain does not exist */
+        if (rc == ERROR_INVAL)
+            return rc;
+    }
+
+    return 0;
 }
 
 static int cpupool_qualifier_to_cpupoolid(const char *p, uint32_t *poolid_r,

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


 


Rackspace

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