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

[Xen-devel] [PATCH 3 of 9] libxl: return libxl_dominfo from libxl_event_get_domain_death_info



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1280225498 -3600
# Node ID 8774eec37219f6f8c1f9dd35e648910e7398a51c
# Parent  74371f414f2012adebba8a8617ddef957f5e3ae0
libxl: return libxl_dominfo from libxl_event_get_domain_death_info

Removes a libxc data type from the libxl interface.


Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 74371f414f20 -r 8774eec37219 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Jul 27 11:11:33 2010 +0100
+++ b/tools/libxl/libxl.c       Tue Jul 27 11:11:38 2010 +0100
@@ -702,20 +702,19 @@ int libxl_free_waiter(libxl_waiter *wait
     return 0;
 }
 
-int libxl_event_get_domain_death_info(struct libxl_ctx *ctx, uint32_t domid, 
libxl_event *event, xc_domaininfo_t *info)
+int libxl_event_get_domain_death_info(struct libxl_ctx *ctx, uint32_t domid, 
libxl_event *event, struct libxl_dominfo *info)
 {
     int rc = 0, ret;
+    if (event && event->type == LIBXL_EVENT_DOMAIN_DEATH) {
+        ret = libxl_domain_info(ctx, info, domid);
 
-    if (event && event->type == LIBXL_EVENT_DOMAIN_DEATH) {
-        ret = xc_domain_getinfolist(ctx->xch, domid, 1, info);
-        if (ret == 1 && info->domain == domid) {
-                if (info->flags & XEN_DOMINF_running ||
-                    (!(info->flags & XEN_DOMINF_shutdown) && !(info->flags & 
XEN_DOMINF_dying)))
+        if (ret == 0 && info->domid == domid) {
+            if (info->running || (!info->shutdown && !info->dying))
                     goto out;
                 rc = 1;
                 goto out;
         }
-        memset(info, 0, sizeof(xc_dominfo_t));
+        memset(info, 0, sizeof(*info));
         rc = 1;
         goto out;
     }
diff -r 74371f414f20 -r 8774eec37219 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Tue Jul 27 11:11:33 2010 +0100
+++ b/tools/libxl/libxl.h       Tue Jul 27 11:11:38 2010 +0100
@@ -393,7 +393,7 @@ int libxl_free_event(libxl_event *event)
 int libxl_free_event(libxl_event *event);
 int libxl_free_waiter(libxl_waiter *waiter);
 
-int libxl_event_get_domain_death_info(struct libxl_ctx *ctx, uint32_t domid, 
libxl_event *event, xc_domaininfo_t *info);
+int libxl_event_get_domain_death_info(struct libxl_ctx *ctx, uint32_t domid, 
libxl_event *event, struct libxl_dominfo *info);
 int libxl_event_get_disk_eject_info(struct libxl_ctx *ctx, uint32_t domid, 
libxl_event *event, libxl_device_disk *disk);
 
 int libxl_domain_rename(struct libxl_ctx *ctx, uint32_t domid,
diff -r 74371f414f20 -r 8774eec37219 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue Jul 27 11:11:33 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Tue Jul 27 11:11:38 2010 +0100
@@ -1335,7 +1335,7 @@ start:
     while (1) {
         int ret;
         fd_set rfds;
-        xc_domaininfo_t info;
+        struct libxl_dominfo info;
         libxl_event event;
         libxl_device_disk disk;
         memset(&info, 0x00, sizeof(xc_domaininfo_t));
@@ -1351,11 +1351,10 @@ start:
             case LIBXL_EVENT_DOMAIN_DEATH:
                 if (libxl_event_get_domain_death_info(&ctx, domid, &event, 
&info)) {
                     LOG("Domain %d is dead", domid);
-                    if (info.flags & XEN_DOMINF_dying || (info.flags & 
XEN_DOMINF_shutdown && (((info.flags >> XEN_DOMINF_shutdownshift) & 
XEN_DOMINF_shutdownmask) != SHUTDOWN_suspend))) {
+                    if (info.dying || (info.shutdown && info.shutdown_reason 
!= SHUTDOWN_suspend)) {
                         LOG("Domain %d needs to be clean: destroying the 
domain", domid);
                         libxl_domain_destroy(&ctx, domid, 0);
-                        if (info.flags & XEN_DOMINF_shutdown &&
-                            (((info.flags >> XEN_DOMINF_shutdownshift) & 
XEN_DOMINF_shutdownmask) == SHUTDOWN_reboot)) {
+                        if (info.shutdown && info.shutdown_reason == 
SHUTDOWN_reboot) {
                             libxl_free_waiter(w1);
                             libxl_free_waiter(w2);
                             free(w1);

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


 


Rackspace

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