]> xenbits.xensource.com Git - people/julieng/xen-unstable.git/commitdiff
xenconsole: try to attach to PV console if HVM fails
authorRoger Pau Monne <roger.pau@citrix.com>
Fri, 2 Oct 2015 15:48:59 +0000 (17:48 +0200)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 8 Oct 2015 11:22:45 +0000 (12:22 +0100)
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é <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
tools/console/client/main.c

index f130a605fe489e78abd9bc75a21fb6e50366af28..d006fdcf60147473ab54613eb278b90f90fa170b 100644 (file)
@@ -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