pv-qemu 10/10: Make xenconsoled ignore doms with qemu-dm
authorKeir Fraser <keir@xensource.com>
Thu, 25 Oct 2007 13:45:47 +0000 (14:45 +0100)
committerKeir Fraser <keir@xensource.com>
Thu, 25 Oct 2007 13:45:47 +0000 (14:45 +0100)
This patch writes a field /local/vm/DOMID/console/type taking the
value 'ioemu' or 'xenconsoled'. If xenconsoled sees a type that is
not its own, then it skips handling of that guest. The qemu-dm
process doesn't need to read this field since it will only attach
to the console if given the -serial pty arg which XenD already
ensures matches this xenstore field.

The overall behaviour is that if a paravirt guest has a qemu-dm
process running then that handles the console, otherwise the
xenconsoled handles it. The former is more functional, with the
exception of not currently supporting persistent logging to a
file at the same time as exposing a PTY.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tools/console/daemon/io.c
tools/python/xen/xend/XendDomainInfo.py

index dbc9a8326ce490037f3d3bbc5a3bd2cce2a46960..c6dc6cd9732aa5e29d57c57b674274d8cd06ed37 100644 (file)
@@ -377,6 +377,7 @@ int xs_gather(struct xs_handle *xs, const char *dir, ...)
 static int domain_create_ring(struct domain *dom)
 {
        int err, remote_port, ring_ref, rc;
+       char *type, path[PATH_MAX];
 
        err = xs_gather(xs, dom->serialpath,
                        "ring-ref", "%u", &ring_ref,
@@ -393,6 +394,14 @@ static int domain_create_ring(struct domain *dom)
        } else
                dom->use_consolepath = 0;
 
+       sprintf(path, "%s/type", dom->use_consolepath ? dom->conspath: dom->serialpath);
+       type = xs_read(xs, XBT_NULL, path, NULL);
+       if (type && strcmp(type, "xenconsoled") != 0) {
+               free(type);
+               return 0;
+       }
+       free(type);
+
        if ((ring_ref == dom->ring_ref) && (remote_port == dom->remote_port))
                goto out;
 
index 4fe6897001948b7787b4aecc4e076c7602937518..d07926bb7de93cf11a4a91c0cea84dd56f3fe40c 100644 (file)
@@ -916,8 +916,15 @@ class XendDomainInfo:
                 else:
                     to_store[n] = str(v)
 
+        # Figure out if we need to tell xenconsoled to ignore this guest's
+        # console - device model will handle console if it is running
+        constype = "ioemu"
+        if 'device_model' not in self.info['platform']:
+            constype = "xenconsoled"
+
         f('console/port',     self.console_port)
         f('console/ring-ref', self.console_mfn)
+        f('console/type',     constype)
         f('store/port',       self.store_port)
         f('store/ring-ref',   self.store_mfn)