[libvirt] [PATCH 1/6] Allow network model to contain "-"

Michael Ellerman michael at ellerman.id.au
Fri Dec 9 00:46:38 UTC 2011


On Thu, 2011-12-08 at 17:38 -0700, Eric Blake wrote:
> On 12/07/2011 11:41 PM, Michael Ellerman wrote:
> > From: Michael Ellerman <michael at ellerman.id.au>
> > 
> > In QEMU PPC64 we have a network device called "spapr-vlan". We can specify
> > this using the existing syntax for network devices, however libvirt
> > currently rejects "spapr-vlan" in virDomainNetDefParseXML() because of
> > the "-". Fix the code to accept "-".
> 
> Thanks for contributing!  I ran out of time to fully review this today,
> but at least this one looks promising.

No worries.

> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index 75e51a0..5de33b9 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> > @@ -3703,8 +3703,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
> >      if (model != NULL) {
> >          int i;
> >          for (i = 0 ; i < strlen(model) ; i++) {
> > -            int char_ok = c_isalnum(model[i]) || model[i] == '_';
> > -            if (!char_ok) {
> > +            if (!c_isalnum(model[i]) && model[i] != '_' && model[i] != '-') {
> 
> I'm not sure if we need to tweak our RNG grammar to also allow this in
> the XML validation.  I'll check that out tomorrow, when I get around to
> applying this one and reviewing the rest of the series.

OK. It looks to me like we don't, but I don't know much about RNG so
I'll defer to you.

cheers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111209/16b0a18f/attachment-0001.sig>


More information about the libvir-list mailing list