|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] [mq]: patch_libxl_get_console_tty.diff
diff -r 9dda0efd8ce1 -r 4a6043e1434a tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Fri Apr 27 17:57:55 2012 +0200
+++ b/tools/libxl/libxl.c Sat Apr 28 22:36:56 2012 +0800
@@ -15,6 +15,8 @@
*/
#include "libxl_osdeps.h"
+//#include "libxl_osdeps.h"
+//#include "libxl_osdeps.h"
#include "libxl_internal.h"
@@ -1173,6 +1175,29 @@ int libxl_primary_console_exec(libxl_ctx
return rc;
}
+int libxl_get_console_tty(libxl_ctx *ctx, uint32_t domid, char **path)
+{
+ GC_INIT(ctx);
+ char *dom_path = 0;
+ char *tty_path = 0, *os_type_path = 0, *vm_uuid_path = 0;
+ char *tty = 0, *os_type = 0, *vm_uuid = 0;
+
+ dom_path = libxl__xs_get_dompath(gc, domid);
+ vm_uuid_path = libxl__sprintf(gc, "%s/vm", dom_path);
+ vm_uuid = libxl__xs_read(gc, XBT_NULL, vm_uuid_path);
+ os_type_path = libxl__sprintf(gc, "%s/image/ostype", vm_uuid);
+ os_type = libxl__xs_read(gc, XBT_NULL, os_type_path);
+ if ( !strcmp("hvm", os_type)) {
+ tty_path = libxl__sprintf(gc, "%s/serial/0/tty", dom_path);
+ } else {
+ tty_path = libxl__sprintf(gc, "%s/console/tty", dom_path);
+ }
+ tty = libxl__xs_read(gc, XBT_NULL, tty_path);
+ *path = strdup(tty);
+ GC_FREE;
+ return 0;
+}
+
int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass)
{
GC_INIT(ctx);
diff -r 9dda0efd8ce1 -r 4a6043e1434a tools/libxl/libxl.h
--- a/tools/libxl/libxl.h Fri Apr 27 17:57:55 2012 +0200
+++ b/tools/libxl/libxl.h Sat Apr 28 22:36:56 2012 +0800
@@ -534,6 +534,10 @@ int libxl_console_exec(libxl_ctx *ctx, u
* case of HVM guests, and before libxl_run_bootloader in case of PV
* guests using pygrub. */
int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm);
+/* libxl_get_console_tty get the tty path from xenstore according to the
+ * domain id.
+ */
+int libxl_get_console_tty(libxl_ctx *ctx, uint32_t domid, char **path);
/* May be called with info_r == NULL to check for domain's existance */
int libxl_domain_info(libxl_ctx*, libxl_dominfo *info_r,
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |