From: Ian Campbell Subject: [PATCH v2] libxl: Support PV consoles Date: Fri, 25 Apr 2014 16:54:20 +0100 Message-ID: <1398441260-19568-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: libvir-list@redhat.com, xen-devel@lists.xen.org Cc: Dario Faggioli , Jim Fehlig , Clark Laughlin , Ian Campbell List-Id: xen-devel@lists.xenproject.org Currently the driver only exposes the ability to connect to the serial console of a Xen guest, which doesn't work for a PV guest. Since for an HVM guest the serial devices are duplicated as consoles it is sufficient to just use the console devices unconditionally. Tested with the following bit of config XML: ... I have observed and tested this on ARM but I believe it also applies to x86 PV guests. Signed-off-by: Ian Campbell Cc: Jim Fehlig Cc: Dario Faggioli Cc: Clark Laughlin --- v2: Just use nconsoles unconditionally, they contain serial too --- src/libxl/libxl_driver.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index a6ae8a1..535e7da 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -3780,6 +3780,7 @@ libxlDomainOpenConsole(virDomainPtr dom, { virDomainObjPtr vm = NULL; int ret = -1; + libxl_console_type console_type = LIBXL_CONSOLE_TYPE_UNKNOWN; virDomainChrDefPtr chr = NULL; libxlDomainObjPrivatePtr priv; char *console = NULL; @@ -3807,8 +3808,8 @@ libxlDomainOpenConsole(virDomainPtr dom, priv = vm->privateData; - if (vm->def->nserials) - chr = vm->def->serials[0]; + if (vm->def->nconsoles) + chr = vm->def->consoles[0]; if (!chr) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -3824,7 +3825,12 @@ libxlDomainOpenConsole(virDomainPtr dom, goto cleanup; } - ret = libxl_primary_console_get_tty(priv->ctx, vm->def->id, &console); + console_type = + (chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL ? + LIBXL_CONSOLE_TYPE_SERIAL : LIBXL_CONSOLE_TYPE_PV); + + ret = libxl_console_get_tty(priv->ctx, vm->def->id, chr->target.port, + console_type, &console); if (ret) goto cleanup; -- 1.7.10.4