libxl: Support PV consoles

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:

<domain type='xen'>
  ...
  <devices>
    <console type='pty'>
      <target type='xen'/>
    </console>
  </devices>
</domain>

I have observed and tested this on ARM but I believe it also applies to x86 PV
guests.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Jim Fehlig <jfehlig@suse.com>
Cc: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Clark Laughlin <clark.laughlin@linaro.org>
This commit is contained in:
Ian Campbell 2014-04-25 16:54:20 +01:00 committed by Jim Fehlig
parent 2a1ea9067f
commit 657cb1e44d

View File

@ -3780,6 +3780,7 @@ libxlDomainOpenConsole(virDomainPtr dom,
{
virDomainObjPtr vm = NULL;
int ret = -1;
libxl_console_type console_type;
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;