Skip to contentSkip to conversation

: libxenlight, get state for one domain

PATCH In review Andres Lagar-Cavilla 2 participants 2 messages Nov 30, 2009 – Dec 1, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 10/14 : libxenlight, get state for one domain

Simple function to get the dominfo state of a single domain.

# HG changeset patch
# User Andres Lagar-Cavilla <[email protected]> # Date 1259285614 18000
# Node ID 5ddc9d9d07b925df3211bfadf191d0f149bdbdd7 # Parent 0839849168539b27fa63149be96bffb5ef4141f9 Simple function to get the dominfo state of a single domain.

libxl.c +20 -0
diff -r 083984916853 -r 5ddc9d9d07b9 libxl.c
@@ -324,6 +324,26 @@ xc_dominfo_t * libxl_domain_infolist(str
     return info;
 }
 
+xc_dominfo_t *libxl_domain_info(struct libxl_ctx *ctx, uint32_t domid)
+{
+    xc_dominfo_t *info;
+    int rc;
+
+    info = (xc_dominfo_t *) calloc(1, sizeof(xc_dominfo_t));
+    if (!info) {
+        return NULL;
+    }
+
+    rc = xc_domain_getinfo(ctx->xch, domid, 1, info);
+    if (rc != 1) {
+        free(info);
+        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Failed to get info for domain %u", 
+                        domid);
+        return NULL;
+    }
+
+    return info;
+}
 int libxl_domain_suspend(struct libxl_ctx *ctx, libxl_domain_suspend_info *info,
                          uint32_t domid, int fd)
 {
libxl.h +1 -0
diff -r 083984916853 -r 5ddc9d9d07b9 libxl.h
@@ -276,6 +276,7 @@ int libxl_domain_unpause(struct libxl_ct
 
 struct libxl_dominfo * libxl_domain_list(struct libxl_ctx *ctx, int *nb_domain);
 xc_dominfo_t * libxl_domain_infolist(struct libxl_ctx *ctx, int *nb_domain);
+xc_dominfo_t * libxl_domain_info(struct libxl_ctx *ctx, uint32_t domid);
 
 typedef struct libxl_device_model_starting libxl_device_model_starting;
 int libxl_create_device_model(struct libxl_ctx *ctx,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 3 lines · Andres Lagar-Cavilla

Simple function to get the dominfo state of a single domain.

it should be the domain_getinfolist hypercall.
not the domain_getinfo which use the getinfolist hypercall anyway.

the other domain_infolist call that return a xc_dominfo is also wrong btw.

Signature · 1 line
Vincent