[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] PATCH: User mode linux driver



On Wed, Nov 19, 2008 at 02:49:01PM +0100, Daniel Veillard wrote:
> On Wed, Nov 19, 2008 at 01:12:55PM +0000, Daniel P. Berrange wrote:
> > This patch is an update of
> 
> [...]
> > @@ -2016,32 +2023,30 @@ static virDomainDefPtr virDomainDefParse
> >      }
> >      VIR_FREE(nodes);
> >  
> > -    /*
> > -     * If no serial devices were listed, then look for console
> > -     * devices which is the legacy syntax for the same thing
> > -     */
> > -    if (def->nserials == 0) {
> > -        if ((node = virXPathNode(conn, "./devices/console[1]", ctxt)) != NULL) {
> > -            virDomainChrDefPtr chr = virDomainChrDefParseXML(conn,
> > -                                                             node);
> > -            if (!chr)
> > -                goto error;
> > +    if ((node = virXPathNode(conn, "./devices/console[1]", ctxt)) != NULL) {
> > +        virDomainChrDefPtr chr = virDomainChrDefParseXML(conn,
> > +                                                         node);
> > +        if (!chr)
> > +            goto error;
> >  
> > -            chr->dstPort = 0;
> > -            /*
> > -             * For HVM console actually created a serial device
> > -             * while for non-HVM it was a parvirt console
> > -             */
> > -            if (STREQ(def->os.type, "hvm")) {
> > +        chr->dstPort = 0;
> > +        /*
> > +         * For HVM console actually created a serial device
> > +         * while for non-HVM it was a parvirt console
> > +         */
> > +        if (STREQ(def->os.type, "hvm")) {
> > +            if (def->nserials != 0) {
> > +                virDomainChrDefFree(chr);
> > +            } else {
> >                  if (VIR_ALLOC_N(def->serials, 1) < 0) {
> >                      virDomainChrDefFree(chr);
> >                      goto no_memory;
> >                  }
> >                  def->nserials = 1;
> >                  def->serials[0] = chr;
> > -            } else {
> > -                def->console = chr;
> >              }
> > +        } else {
> > +            def->console = chr;
> >          }
> >      }
> 
>   Hummm, that change to console code parsing seems rather unrelated,
> isn't it ?

It is needed actually - the old logic was subtley flawed. The original
logic was saying if no serial devices were present, and a console
was specified then make that console look like a serial device. This is
compatability for old mistake where we treated Xen HVM serial console
as a paravirt <console/>. This fixup logic was accidentailly being applied
to all types of domain, when it should only have been applied to HVM
guests. This causes problem with User Mode Linux, where you explicitly
have 0 or more paravirt consoles, and 0 or more serial ports. So my
change here, just restricts the fixup to hvm only.

> > +    for (i = 0 ; i < 16 ; i++) {
> > +        char *ret;
> > +        if (i == 0 && vm->def->console)
> > +            ret = umlBuildCommandLineChr(conn, vm->def->console, "con");
> > +        else
> > +            if (asprintf(&ret, "con%d=none", i) < 0)
> > +                goto no_memory;
> > +        ADD_ARG(ret);
> > +    }
> > +
> > +    for (i = 0 ; i < 16 ; i++) {
> > +        virDomainChrDefPtr chr = NULL;
> > +        char *ret;
> > +        for (j = 0 ; j < vm->def->nserials ; j++)
> > +            if (vm->def->serials[j]->dstPort == i)
> > +                chr = vm->def->serials[j];
> > +        if (chr)
> > +            ret = umlBuildCommandLineChr(conn, chr, "ssl");
> > +        else
> > +            if (asprintf(&ret, "ssl%d=none", i) < 0)
> > +                goto no_memory;
> > +        ADD_ARG(ret);
> > +    }
> 
>   I'm a bit puzzled by 16 is that an internal UML limit ?

Yes, thats a hardcoded user mode linux limit.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]