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

[Xen-devel] [PATCH v2 4/5] libxl: introduce APIs to get and set log level



Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Jan Beulich <JBeulich@xxxxxxxx>
---
 tools/libxl/libxl.c | 40 ++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl.h | 11 +++++++++++
 2 files changed, 51 insertions(+)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 1c81239..ff70af7 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -6599,6 +6599,46 @@ int libxl_send_debug_keys(libxl_ctx *ctx, char *keys)
     return 0;
 }
 
+int libxl_set_log_level(libxl_ctx *ctx, bool guest,
+                        char *lower_thresh, char *upper_thresh)
+{
+    int rc, ret;
+    GC_INIT(ctx);
+
+    ret = xc_set_log_level(ctx->xch, guest, lower_thresh, upper_thresh);
+    if (ret) {
+        LOGE(ERROR, "unable to set log level");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    rc = 0;
+out:
+    GC_FREE;
+    return rc;
+}
+
+int libxl_get_log_level(libxl_ctx *ctx, bool guest,
+                        char *lower_thresh, unsigned int *lower_thresh_bufsize,
+                        char *upper_thresh, unsigned int *upper_thresh_bufsize)
+{
+    int rc, ret;
+    GC_INIT(ctx);
+
+    ret = xc_get_log_level(ctx->xch, guest, lower_thresh, lower_thresh_bufsize,
+                           upper_thresh, upper_thresh_bufsize);
+    if (ret) {
+        LOGE(ERROR, "unable to get log level");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    rc = 0;
+out:
+    GC_FREE;
+    return rc;
+}
+
 libxl_xen_console_reader *
     libxl_xen_console_read_start(libxl_ctx *ctx, int clear)
 {
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 2c0f868..c460d11 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -67,6 +67,12 @@
  * the same $(XEN_VERSION) (e.g. throughout a major release).
  */
 
+/* LIBXL_HAVE_GET_SET_LOG_LEVEL
+ *
+ * If this is defined libxl has a pair of APIs to get and set log levels
+ */
+#define LIBXL_HAVE_GET_SET_LOG_LEVEL 1
+
 /* LIBXL_HAVE_VNUMA
  *
  * If this is defined the type libxl_vnode_info exists, and a
@@ -1951,6 +1957,11 @@ int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
                        libxl_trigger trigger, uint32_t vcpuid);
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq);
 int libxl_send_debug_keys(libxl_ctx *ctx, char *keys);
+int libxl_set_log_level(libxl_ctx *ctx, bool guest,
+                        char *lower_thresh, char *upper_thresh);
+int libxl_get_log_level(libxl_ctx *ctx, bool guest,
+                        char *lower_thresh, unsigned int *lower_thresh_bufsize,
+                        char *upper_thresh, unsigned int 
*upper_thresh_bufsize);
 
 typedef struct libxl__xen_console_reader libxl_xen_console_reader;
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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