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? ACK with those nits fixed. -- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list