[libvirt] [Xen-devel] [PATCH v2] libxl: Support PV consoles

Konrad Rzeszutek Wilk konrad.wilk at oracle.com
Fri Apr 25 17:32:44 UTC 2014


On Fri, Apr 25, 2014 at 11:24:07AM -0600, Jim Fehlig wrote:
> Jim Fehlig wrote:
> > Ian Campbell wrote:
> >   
> >> 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.
> >>   
> >>     
> >
> > Yep, I think you are right.
> >
> > ACK to the patch.  I'll push it, after a bit of testing.
> >
> > Regards,
> > Jim
> >
> >   
> >> Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
> >> Cc: Jim Fehlig <jfehlig at suse.com>
> >> Cc: Dario Faggioli <dario.faggioli at citrix.com>
> >> Cc: Clark Laughlin <clark.laughlin at 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;
> >>     
> 
> This doesn't compile with Xen 4.2.x

Hey Jim!

The development version of Xen is 4.5. The latest stable
is Xen 4.4.

If you want to backport it - then your suggestion is correct.
Or just backport the relevant patches ?

> 
> libxl/libxl_driver.c: In function 'libxlDomainOpenConsole':
> libxl/libxl_driver.c:3783:39: error: 'LIBXL_CONSOLE_TYPE_UNKNOWN'
> undeclared (first use in this function)
> libxl/libxl_driver.c:3783:39: note: each undeclared identifier is
> reported only once for each function it appears in
> 
> xen.git commit 166bb0fe introduced UNKNOWN in the enum.  I suppose it is
> best to initialize console_type with 0, along  with a comment?
> 
> Regards,
> Jim
> 
> >>      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;
> >>  
> >>   
> >>     
> >
> > --
> > libvir-list mailing list
> > libvir-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/libvir-list
> >
> >   
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel at lists.xen.org
> http://lists.xen.org/xen-devel




More information about the libvir-list mailing list