[libvirt] [PATCH 07/10] Support virDomainOpenConsole with QEMU
Eric Blake
eblake at redhat.com
Mon Nov 1 21:39:30 UTC 2010
On 11/01/2010 10:12 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 | 76 +++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 75 insertions(+), 1 deletions(-)
>
> + 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];
> + }
Are we guaranteed that all devices will have a non-NULL and unique
alias, or do we need to do either of these:
1. break on the first hit (rather than favoring the last instance of a
duplicate alias)
2. use STREQ_NULLABLE(devname, ...alias), to be robust against an
unaliased device
> + if (!chr) {
> + qemuReportError(VIR_ERR_INTERNAL_ERROR,
> + _("cannot find character device %s"), devname);
NULLSTR(devname)
> + goto cleanup;
> + }
> +
> + if (chr->type != VIR_DOMAIN_CHR_TYPE_PTY) {
> + qemuReportError(VIR_ERR_INTERNAL_ERROR,
> + _("character device %s is not using a PTY"), devname);
NULLSTR(devname)
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101101/cadca82d/attachment-0001.sig>
More information about the libvir-list
mailing list