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 | 5 ++++-
src/xen/xs_internal.c | 19 +++++++++++++++++++
src/xen/xs_internal.h | 2 ++
3 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 0c0b6cb..1d8e035 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -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,
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index a28e6cc..86e5519 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -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:
diff --git a/src/xen/xs_internal.h b/src/xen/xs_internal.h
index 0278799..f7e487b 100644
--- a/src/xen/xs_internal.h
+++ b/src/xen/xs_internal.h
@@ -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);
--
1.7.7