* [PATCH] enable xm console for vmx guest
@ 2005-11-07 2:45 Ling, Xiaofeng
2005-11-07 6:10 ` Daniel Stekloff
0 siblings, 1 reply; 3+ messages in thread
From: Ling, Xiaofeng @ 2005-11-07 2:45 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 279 bytes --]
Enable xm console for vmx guest.
When the serial port is redirect to pty, write the allocated
device to xenstore, then xm console can get it.
TODO:serial port by pty shall not block if there are no reading
on the other end
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
[-- Attachment #2: vmxconsole.patch --]
[-- Type: text/x-patch, Size: 4068 bytes --]
# HG changeset patch
# User Xiaofeng Ling <xiaofeng.ling@intel.com>
# Node ID 34d300132f3b4dc3944fbe980c97b84671c40e46
# Parent 1e82f5c841ac5cac5598040a5bc305835ff2965c
Enable xm console for vmx guest.
When the serial port is redirect to pty, write the allocated
device to xenstore, then xm console can get it.
TODO:serial port by pty shall not block if there are no reading
on the other end
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
diff -r 1e82f5c841ac -r 34d300132f3b tools/examples/xmexample.vmx
--- a/tools/examples/xmexample.vmx Tue Nov 1 22:01:25 2005 +0800
+++ b/tools/examples/xmexample.vmx Tue Nov 1 22:02:14 2005 +0800
@@ -117,6 +117,11 @@
#nographic=0
+#-----------------------------------------------------------------------------
+# serial port re-direct to pty deivce, /dev/pts/n
+# then xm console or minicom can connect
+#serial='pty'
+
#----------------------------------------------------------------------------
# enable ne2000, default = 0(use pcnet)
ne2000=0
diff -r 1e82f5c841ac -r 34d300132f3b tools/ioemu/target-i386-dm/Makefile
--- a/tools/ioemu/target-i386-dm/Makefile Tue Nov 1 22:01:25 2005 +0800
+++ b/tools/ioemu/target-i386-dm/Makefile Tue Nov 1 22:02:14 2005 +0800
@@ -7,7 +7,7 @@
TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH)
-DEFINES+= -I$(XEN_ROOT)/tools/libxc
+DEFINES+= -I$(XEN_ROOT)/tools/libxc -I$(XEN_ROOT)/tools/xenstore
ifdef CONFIG_USER_ONLY
VPATH+=:$(SRC_PATH)/linux-user
DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
@@ -188,7 +188,7 @@
#########################################################
DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DAPIC_SUPPORT
-LIBS+=-lm -L../../libxc -lxenctrl
+LIBS+=-lm -L../../libxc -lxenctrl -L../../xenstore -lxenstore
ifndef CONFIG_USER_ONLY
LIBS+=-lz
endif
diff -r 1e82f5c841ac -r 34d300132f3b tools/ioemu/vl.c
--- a/tools/ioemu/vl.c Tue Nov 1 22:01:25 2005 +0800
+++ b/tools/ioemu/vl.c Tue Nov 1 22:02:14 2005 +0800
@@ -73,6 +73,7 @@
#endif /* CONFIG_SDL */
#include "xenctrl.h"
+#include "xs.h"
#include "exec-all.h"
//#define DO_TB_FLUSH
@@ -1163,6 +1164,47 @@
return chr;
}
+int store_console_dev(int domid, char *pts)
+{
+ int xc_handle;
+ unsigned int len = 0;
+ struct xs_handle *xs;
+ char *path;
+
+ xs = xs_daemon_open();
+ if (xs == NULL) {
+ fprintf(logfile, "Could not contact XenStore\n");
+ return -1;
+ }
+
+ xc_handle = xc_interface_open();
+ if (xc_handle == -1) {
+ fprintf(logfile, "xc_interface_open() error\n");
+ return -1;
+ }
+
+ path = xs_get_domain_path(xs, domid);
+ if (path == NULL) {
+ fprintf(logfile, "xs_get_domain_path() error\n");
+ return -1;
+ }
+ path = realloc(path, strlen(path) + strlen("/console/tty") + 1);
+ if (path == NULL) {
+ fprintf(logfile, "realloc error\n");
+ return -1;
+ }
+ strcat(path, "/console/tty");
+ if (!xs_write(xs, NULL, path, pts, strlen(pts))) {
+ fprintf(logfile, "xs_write for console fail");
+ return -1;
+ }
+
+ xs_daemon_close(xs);
+ close(xc_handle);
+
+ return 0;
+}
+
#if defined(__linux__)
CharDriverState *qemu_chr_open_pty(void)
{
@@ -1174,6 +1216,7 @@
return NULL;
}
fprintf(stderr, "char device redirected to %s\n", slave_name);
+ store_console_dev(domid, slave_name);
return qemu_chr_open_fd(master_fd, master_fd);
}
#else
@@ -2688,7 +2731,9 @@
break;
case QEMU_OPTION_nographic:
pstrcpy(monitor_device, sizeof(monitor_device), "stdio");
- pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "stdio");
+ if(!strcmp(serial_devices[0], "vc"))
+ pstrcpy(serial_devices[0], sizeof(serial_devices[0]),
+ "stdio");
nographic = 1;
break;
#ifdef CONFIG_VNC
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] enable xm console for vmx guest
2005-11-07 2:45 [PATCH] enable xm console for vmx guest Ling, Xiaofeng
@ 2005-11-07 6:10 ` Daniel Stekloff
2005-11-07 13:18 ` Ling Xiaofeng
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Stekloff @ 2005-11-07 6:10 UTC (permalink / raw)
To: xen-devel; +Cc: Ling, Xiaofeng
On Sunday 06 November 2005 18:45, Ling, Xiaofeng wrote:
> Enable xm console for vmx guest.
> When the serial port is redirect to pty, write the allocated
> device to xenstore, then xm console can get it.
> TODO:serial port by pty shall not block if there are no reading
> on the other end
>
> Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
Hi,
I believe that you must free() path in store_console_dev() when you're done
with it:
from xs.h:
/* Query the home path of a domain. Call free() after use.
*/
char *xs_get_domain_path(struct xs_handle *h, unsigned int domid);
Thanks,
Dan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] enable xm console for vmx guest
2005-11-07 6:10 ` Daniel Stekloff
@ 2005-11-07 13:18 ` Ling Xiaofeng
0 siblings, 0 replies; 3+ messages in thread
From: Ling Xiaofeng @ 2005-11-07 13:18 UTC (permalink / raw)
To: Daniel Stekloff, xen-devel
[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]
Yes, thanks for pointing out. I've updated in the attach patch.
----- Original Message -----
From: "Daniel Stekloff" <dsteklof@us.ibm.com>
To: <xen-devel@lists.xensource.com>
Cc: "Ling, Xiaofeng" <xiaofeng.ling@intel.com>
Sent: Monday, November 07, 2005 2:10 PM
Subject: Re: [Xen-devel] [PATCH] enable xm console for vmx guest
> On Sunday 06 November 2005 18:45, Ling, Xiaofeng wrote:
> > Enable xm console for vmx guest.
> > When the serial port is redirect to pty, write the allocated
> > device to xenstore, then xm console can get it.
> > TODO:serial port by pty shall not block if there are no reading
> > on the other end
> >
> > Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
>
> Hi,
>
> I believe that you must free() path in store_console_dev() when you're
done
> with it:
>
> from xs.h:
>
> /* Query the home path of a domain. Call free() after use.
> */
> char *xs_get_domain_path(struct xs_handle *h, unsigned int domid);
>
> Thanks,
>
> Dan
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
[-- Attachment #2: vmxconsole.patch --]
[-- Type: application/octet-stream, Size: 4130 bytes --]
# HG changeset patch
# User Xiaofeng Ling <xiaofeng.ling@intel.com>
# Node ID 34d300132f3b4dc3944fbe980c97b84671c40e46
# Parent 1e82f5c841ac5cac5598040a5bc305835ff2965c
Enable xm console for vmx guest.
When the serial port is redirect to pty, write the allocated
device to xenstore, then xm console can get it.
TODO:serial port by pty shall not block if there are no reading
on the other end
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
diff -r 01a959ee39dd tools/examples/xmexample.vmx
--- a/tools/examples/xmexample.vmx Mon Nov 7 10:47:10 2005 +0800
+++ b/tools/examples/xmexample.vmx Mon Nov 7 20:52:16 2005 +0800
@@ -117,6 +117,11 @@
#nographic=0
+#-----------------------------------------------------------------------------
+# serial port re-direct to pty deivce, /dev/pts/n
+# then xm console or minicom can connect
+#serial='pty'
+
#----------------------------------------------------------------------------
# enable ne2000, default = 0(use pcnet)
ne2000=0
diff -r 01a959ee39dd tools/ioemu/target-i386-dm/Makefile
--- a/tools/ioemu/target-i386-dm/Makefile Mon Nov 7 10:47:10 2005 +0800
+++ b/tools/ioemu/target-i386-dm/Makefile Mon Nov 7 20:52:16 2005 +0800
@@ -7,7 +7,7 @@
TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH)
-DEFINES+= -I$(XEN_ROOT)/tools/libxc
+DEFINES+= -I$(XEN_ROOT)/tools/libxc -I$(XEN_ROOT)/tools/xenstore
ifdef CONFIG_USER_ONLY
VPATH+=:$(SRC_PATH)/linux-user
DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
@@ -188,7 +188,7 @@
#########################################################
DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-LIBS+=-lm -L../../libxc -lxenctrl
+LIBS+=-lm -L../../libxc -lxenctrl -L../../xenstore -lxenstore
ifndef CONFIG_USER_ONLY
LIBS+=-lz
endif
diff -r 01a959ee39dd tools/ioemu/vl.c
--- a/tools/ioemu/vl.c Mon Nov 7 10:47:10 2005 +0800
+++ b/tools/ioemu/vl.c Mon Nov 7 20:52:16 2005 +0800
@@ -76,6 +76,7 @@
#endif /* CONFIG_SDL */
#include "xenctrl.h"
+#include "xs.h"
#include "exec-all.h"
//#define DO_TB_FLUSH
@@ -1171,6 +1172,47 @@
return chr;
}
+int store_console_dev(int domid, char *pts)
+{
+ int xc_handle;
+ unsigned int len = 0;
+ struct xs_handle *xs;
+ char *path;
+
+ xs = xs_daemon_open();
+ if (xs == NULL) {
+ fprintf(logfile, "Could not contact XenStore\n");
+ return -1;
+ }
+
+ xc_handle = xc_interface_open();
+ if (xc_handle == -1) {
+ fprintf(logfile, "xc_interface_open() error\n");
+ return -1;
+ }
+
+ path = xs_get_domain_path(xs, domid);
+ if (path == NULL) {
+ fprintf(logfile, "xs_get_domain_path() error\n");
+ return -1;
+ }
+ path = realloc(path, strlen(path) + strlen("/console/tty") + 1);
+ if (path == NULL) {
+ fprintf(logfile, "realloc error\n");
+ return -1;
+ }
+ strcat(path, "/console/tty");
+ if (!xs_write(xs, NULL, path, pts, strlen(pts))) {
+ fprintf(logfile, "xs_write for console fail");
+ return -1;
+ }
+
+ xs_daemon_close(xs);
+ close(xc_handle);
+
+ return 0;
+}
+
#if defined(__linux__)
CharDriverState *qemu_chr_open_pty(void)
{
@@ -1182,6 +1224,7 @@
return NULL;
}
fprintf(stderr, "char device redirected to %s\n", slave_name);
+ store_console_dev(domid, slave_name);
return qemu_chr_open_fd(master_fd, master_fd);
}
#else
@@ -2701,7 +2744,9 @@
break;
case QEMU_OPTION_nographic:
pstrcpy(monitor_device, sizeof(monitor_device), "stdio");
- pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "stdio");
+ if(!strcmp(serial_devices[0], "vc"))
+ pstrcpy(serial_devices[0], sizeof(serial_devices[0]),
+ "stdio");
nographic = 1;
break;
#ifdef CONFIG_VNC
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-11-07 13:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-07 2:45 [PATCH] enable xm console for vmx guest Ling, Xiaofeng
2005-11-07 6:10 ` Daniel Stekloff
2005-11-07 13:18 ` Ling Xiaofeng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.