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 7/7] libxenlight meta-resend: get state for one domai

To: Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>, Vincent Hanquez <vincent.hanquez@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 7/7] libxenlight meta-resend: get state for one domain
From: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
Date: Thu, 03 Dec 2009 12:08:19 -0500
Cc:
Delivery-date: Thu, 03 Dec 2009 09:09:06 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4B16ABF9.9000408@xxxxxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4B16ABF9.9000408@xxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.23 (X11/20090817)
Simple function to get the dominfo state of a single domain.

Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
# HG changeset patch
# User Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
# Date 1259857202 18000
# Node ID 3588737e991624290d499c2804959af14b8128de
# Parent  7315ca037a680d18a6c23d030139b5389a73000b
Simple function to get the dominfo state of a single domain.

Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>

diff -r 7315ca037a68 -r 3588737e9916 libxl.c
--- a/libxl.c
+++ b/libxl.c
@@ -334,6 +334,31 @@ static int libxl_save_device_model(struc
     return 0;
 }
 
+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;
+    }
+    if (info->domid != domid) {
+        free(info);
+        XL_LOG(ctx, XL_LOG_ERROR, "Failed to get info for domain %u"
+                        ", seems to not exist anymore", domid);
+        return NULL;
+    }
+
+    return info;
+}
 int libxl_domain_suspend(struct libxl_ctx *ctx, libxl_domain_suspend_info 
*info,
                          uint32_t domid, int fd)
 {
diff -r 7315ca037a68 -r 3588737e9916 libxl.h
--- a/libxl.h
+++ b/libxl.h
@@ -276,6 +276,7 @@ int libxl_console_attach(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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>