# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1262177141 0
# Node ID 88e59cfb48de60b3bfd04c74e6ac230d061ae5b0
# Parent d4613b5217982fa82710adc96a9f1d8b4c0a491e
libxl: add a get_shutdown_reason
Signed-off-by: Vincent Hanquez <vincent.hanquez@xxxxxxxxxxxxx>
---
tools/libxl/libxl_dom.c | 15 +++++++++++++++
tools/libxl/libxl_internal.h | 3 +++
2 files changed, 18 insertions(+)
diff -r d4613b521798 -r 88e59cfb48de tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c Wed Dec 30 12:45:13 2009 +0000
+++ b/tools/libxl/libxl_dom.c Wed Dec 30 12:45:41 2009 +0000
@@ -40,6 +40,21 @@ int is_hvm(struct libxl_ctx *ctx, uint32
if (info.domain != domid)
return -1;
return !!(info.flags & XEN_DOMINF_hvm_guest);
+}
+
+int get_shutdown_reason(struct libxl_ctx *ctx, uint32_t domid)
+{
+ xc_domaininfo_t info;
+ int ret;
+
+ ret = xc_domain_getinfolist(ctx->xch, domid, 1, &info);
+ if (ret != 1)
+ return -1;
+ if (info.domain != domid)
+ return -1;
+ if (!(info.flags & XEN_DOMINF_shutdown))
+ return -1;
+ return dominfo_get_shutdown_reason(&info);
}
int build_pre(struct libxl_ctx *ctx, uint32_t domid,
diff -r d4613b521798 -r 88e59cfb48de tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Wed Dec 30 12:45:13 2009 +0000
+++ b/tools/libxl/libxl_internal.h Wed Dec 30 12:45:41 2009 +0000
@@ -124,6 +124,9 @@ char **libxl_xs_directory(struct libxl_c
/* from xl_dom */
int is_hvm(struct libxl_ctx *ctx, uint32_t domid);
+int get_shutdown_reason(struct libxl_ctx *ctx, uint32_t domid);
+#define dominfo_get_shutdown_reason(info) (((info)->flags >>
XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask)
+
int build_pre(struct libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state);
int build_post(struct libxl_ctx *ctx, uint32_t domid,
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|