From: Roger Pau Monne Date: Fri, 2 Oct 2015 15:48:59 +0000 (+0200) Subject: xenconsole: try to attach to PV console if HVM fails X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2408 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=96b4f77a55833895677cf4b4a33fc50c7b3da032;p=xen.git xenconsole: try to attach to PV console if HVM fails HVM guests have always used the emulated serial console by default, but if the emulated serial pty cannot be fetched from xenstore try to use the PV console instead. Signed-off-by: Roger Pau Monné Acked-by: Wei Liu Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell Cc: Wei Liu --- diff --git a/tools/console/client/main.c b/tools/console/client/main.c index f130a605fe..d006fdcf60 100644 --- a/tools/console/client/main.c +++ b/tools/console/client/main.c @@ -333,7 +333,7 @@ int main(int argc, char **argv) { 0 }, }; - char *dom_path = NULL, *path = NULL; + char *dom_path = NULL, *path = NULL, *test = NULL; int spty, xsfd; struct xs_handle *xs; char *end; @@ -415,9 +415,15 @@ int main(int argc, char **argv) path = malloc(strlen(dom_path) + strlen("/device/console/0/tty") + 5); if (path == NULL) err(ENOMEM, "malloc"); - if (type == CONSOLE_SERIAL) + if (type == CONSOLE_SERIAL) { snprintf(path, strlen(dom_path) + strlen("/serial/0/tty") + 5, "%s/serial/%d/tty", dom_path, num); - else { + test = xs_read(xs, XBT_NULL, path, NULL); + free(test); + if (test == NULL) + type = CONSOLE_PV; + } + if (type == CONSOLE_PV) { + if (num == 0) snprintf(path, strlen(dom_path) + strlen("/console/tty") + 1, "%s/console/tty", dom_path); else