]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix xenstore serial console path for HVM guests
authorJim Fehlig <jfehlig@suse.com>
Tue, 3 Jan 2012 22:39:59 +0000 (15:39 -0700)
committerJim Fehlig <jfehlig@suse.com>
Wed, 4 Jan 2012 17:15:13 +0000 (10:15 -0700)
The console path in xenstore is /local/domain/<id>/console/tty
for PV guests (PV console) and /local/domain/<id>/serial/0/tty
(serial console) for HVM guests.  Similar to Xen's in-tree console
client, read the correct path for PV vs HVM.

src/xen/xend_internal.c
src/xen/xs_internal.c
src/xen/xs_internal.h

index 0c0b6cb9c8ae237bc15b8e3dc72c774bf0d32ef9..1d8e035528e9d29b13673605d594d8878e41ad47 100644 (file)
@@ -1761,7 +1761,10 @@ xenDaemonDomainFetch(virConnectPtr conn,
 
     id = xenGetDomIdFromSxpr(root, priv->xendConfigVersion);
     xenUnifiedLock(priv);
-    tty = xenStoreDomainGetConsolePath(conn, id);
+    if (sexpr_lookup(root, "domain/image/hvm"))
+        tty = xenStoreDomainGetSerialConsolePath(conn, id);
+    else
+        tty = xenStoreDomainGetConsolePath(conn, id);
     vncport = xenStoreDomainGetVNCPort(conn, id);
     xenUnifiedUnlock(priv);
     if (!(def = xenParseSxpr(root,
index a28e6cc8e14d143df183a55aaf1a121e9659cd05..86e5519b45d765424d136911deb0810b957d9e57 100644 (file)
@@ -852,6 +852,25 @@ char *          xenStoreDomainGetConsolePath(virConnectPtr conn, int domid) {
   return virDomainDoStoreQuery(conn, domid, "console/tty");
 }
 
+/**
+ * xenStoreDomainGetSerailConsolePath:
+ * @conn: the hypervisor connection
+ * @domid: id of the domain
+ *
+ * Return the path to the pseudo TTY on which the guest domain's
+ * serial console is attached.
+ *
+ * Returns the path to the serial console. It is the callers
+ * responsibilty to free() the return string. Returns NULL
+ * on error
+ *
+ * The caller must hold the lock on the privateData
+ * associated with the 'conn' parameter.
+ */
+char * xenStoreDomainGetSerialConsolePath(virConnectPtr conn, int domid) {
+    return virDomainDoStoreQuery(conn, domid, "serial/0/tty");
+}
+
 
 /*
  * xenStoreDomainGetNetworkID:
index 02787991a82e8af22e1c934b423ae7a75fd90783..f7e487b3be2b023973e9e53fcc02d88641615392 100644 (file)
@@ -45,6 +45,8 @@ int             xenStoreDomainGetVNCPort(virConnectPtr conn,
                                          int domid);
 char *          xenStoreDomainGetConsolePath(virConnectPtr conn,
                                          int domid);
+char *          xenStoreDomainGetSerialConsolePath(virConnectPtr conn,
+                                         int domid);
 char *         xenStoreDomainGetNetworkID(virConnectPtr conn,
                                          int id,
                                          const char *mac);