xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: libvir-list@redhat.com, xen-devel@lists.xen.org
Cc: Dario Faggioli <dario.faggioli@citrix.com>,
	Jim Fehlig <jfehlig@suse.com>,
	Clark Laughlin <clark.laughlin@linaro.org>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH v2] libxl: Support PV consoles
Date: Fri, 25 Apr 2014 16:54:20 +0100	[thread overview]
Message-ID: <1398441260-19568-1-git-send-email-ian.campbell@citrix.com> (raw)

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>
---
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

             reply	other threads:[~2014-04-25 15:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-25 15:54 Ian Campbell [this message]
2014-04-25 16:03 ` [libvirt] [PATCH v2] libxl: Support PV consoles Daniel P. Berrange
2014-04-25 16:30 ` Jim Fehlig
     [not found] ` <535A8DB9.4050403@suse.com>
2014-04-25 17:24   ` [libvirt] " Jim Fehlig
     [not found]   ` <535A9A37.2010908@suse.com>
2014-04-25 17:32     ` Konrad Rzeszutek Wilk
2014-04-25 18:51     ` Ian Campbell
     [not found]     ` <20140425173244.GA27228@phenom.dumpdata.com>
2014-04-25 18:52       ` Ian Campbell
     [not found]       ` <1398451975.23380.50.camel@dagon.hellion.org.uk>
2014-04-25 19:13         ` Konrad Rzeszutek Wilk
     [not found]     ` <1398451911.23380.49.camel@dagon.hellion.org.uk>
2014-04-25 20:12       ` Jim Fehlig
     [not found]       ` <535AC1AD.4080208@suse.com>
2014-04-28 11:17         ` Ian Campbell
     [not found]         ` <1398683841.29700.66.camel@kazak.uk.xensource.com>
2014-04-28 11:20           ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1398441260-19568-1-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=clark.laughlin@linaro.org \
    --cc=dario.faggioli@citrix.com \
    --cc=jfehlig@suse.com \
    --cc=libvir-list@redhat.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).