[libvirt] [RFC PATCHv2 5/5] WIP: smartcard: turn on qemu support

Daniel P. Berrange berrange at redhat.com
Fri Jan 14 13:46:56 UTC 2011


On Fri, Jan 14, 2011 at 12:41:13PM +0000, Daniel P. Berrange wrote:
> On Thu, Jan 13, 2011 at 05:34:37PM -0700, Eric Blake wrote:
> 
> > +            virCommandAddArgBuffer(cmd, &smartcard_buf);
> > +            break;
> > +        case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH:
> > +            virCommandAddArg(cmd, "-chardev");
> > +            if (!(devstr = qemuBuildChrChardevStr(&smartcard->data.passthru,
> > +                                                  smartcard->info.alias)))
> > +                    goto error;
> 
> The 'id' setting for the chardev should really have a prefix
> on it, because we won't want it to be the same as the 'id'
> setting used for the -device option.

This is in fact a pre-existing flaw in our chardev handling
which we need to fix. The 'qemuBuildChrChardevStr' API & its
callers are buggy. They takes the assigned alias from the XML
and use it directly for the chardev. So we end up with

   -chardev pty,id=$alias
   -device isa-serial,chardev=$alias

The serial/parallel/channels -device args are all missing
any 'id' property entirely which is bad, because it means
we won't be able to support hotplug. What we should be
generating is

   -chardev pty,id=cdev$alias
   -device isa-serial,id=$alias,chardev=cdev$alias

So that both parts have a unique identifier assigned,
and the alias from the XML is associated with the
'-device' arg, and the -chardev is a derivative.

Regards,
Daniel




More information about the libvir-list mailing list