Re: [PATCH 5/7] Support virDomainOpenConsole with QEMU

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

 



On Thu, Aug 19, 2010 at 02:44:27PM -0600, Eric Blake wrote:
> On 08/17/2010 11:02 AM, Daniel P. Berrange wrote:
> > This provides an implementation of the virDomainOpenConsole
> > API with the QEMU driver. For the streams code, this reuses
> > most of the code previously added for the tunnelled migration
> > streams since it is generic.
> > 
> > * src/qemu/qemu_driver.c: Support virDomainOpenConsole
> > ---
> >  src/qemu/qemu_driver.c |  267 +++++++++++++++++++++++++++++++++++++----------
> >  1 files changed, 210 insertions(+), 57 deletions(-)
> 
> > 
> > +static int qemuStreamFDRead(virStreamPtr st, char *bytes, size_t nbytes)
> > +{
> ...
> > +        } else {
> > +            ret = -1;
> > +            virReportSystemError(errno, "%s",
> > +                                 _("cannot write to stream"));
> 
> s/write to/read from/
> 
> >  
> > +
> > +static int
> > +qemuDomainOpenConsole(virDomainPtr dom,
> > +                      const char *devname,
> > +                      virStreamPtr st,
> > +                      unsigned int flags ATTRIBUTE_UNUSED)
> 
> Drop the attribute...
> 
> > +{
> > +    struct qemud_driver *driver = dom->conn->privateData;
> > +    virDomainObjPtr vm = NULL;
> > +    char uuidstr[VIR_UUID_STRING_BUFLEN];
> > +    int ret = -1;
> > +    int i;
> > +    virDomainChrDefPtr chr = NULL;
> > +    struct qemuStreamFD *qemust;
> 
> ...and add virCheckFlags(0, -1) here.
> 
> > +    if (devname) {
> > +        if (vm->def->console &&
> > +            STREQ(devname, vm->def->console->info.alias))
> > +            chr = vm->def->console;
> > +        for (i = 0 ; !chr && i < vm->def->nserials ; i++) {
> > +            if (STREQ(devname, vm->def->serials[i]->info.alias))
> > +                chr = vm->def->serials[i];
> > +        }
> > +        for (i = 0 ; !chr && i < vm->def->nparallels ; i++) {
> > +            if (STREQ(devname, vm->def->parallels[i]->info.alias))
> > +                chr = vm->def->parallels[i];
> > +        }
> > +    } else {
> > +        if (vm->def->console)
> > +            chr = vm->def->console;
> > +        else if (vm->def->nserials)
> > +            chr = vm->def->serials[0];
> > +    }
> 
> Missing the check for vm->dev->nparallels when devname is NULL and there
> is no console or serial devices?

The intended semantics are that if no alias is provided, then this will
open the first <console> element. Most of the time this maps to the
first (only) vm->def->console. Due to historic wierdness though, with
a HVM guest this will instead sometimes point to vm->def->serials[0].
When I fix that mess, the 'else if' clause can be dropped here. 

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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]