<br><tt><font size=2>"Daniel P. Berrange" <berrange@redhat.com>
wrote on 05/11/2010 06:25:05 AM:<br>
<br>
</font></tt>
<br><tt><font size=2>> <br>
> On Mon, May 10, 2010 at 07:57:37PM -0400, Stefan Berger wrote:<br>
> > Below is David Alan's original patch with lots of changes. <br>
> > <br>
> > In particular, it now parses the following XML and stored the
data<br>
> > internally. No sending of netlink messages has been implemented
here.<br>
> > <br>
> >    <interface type='direct'><br>
> >       <source dev='static' mode='vepa'/><br>
> >       <model type='virtio'/><br>
> >       <vsi managerid='12' typeid='0x123456'
typeidversion='1'<br>
> >            instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'
/><br>
> >       <filterref filter='clean-traffic'/><br>
> >     </interface><br>
> > <br>
> >     <interface type='direct'><br>
> >       <source dev='static' mode='vepa'/><br>
> >       <model type='virtio'/><br>
> >       <vsi profileid='my_profile'/><br>
> >     </interface><br>
> <br>
> Could we have an explanation of what these attributes all mean in<br>
> the commit message. </font></tt>
<br>
<br>
<br><tt><font size=2>To summarize here for now:</font></tt>
<br><tt><font size=2>The 1st provides parameters necessary to run a protocol
between the </font></tt>
<br><tt><font size=2>host and the switch to setup switch parameters for
a VM's</font></tt>
<br><tt><font size=2>traffic (for example). The protocol will be run by
LLDPAD (daemon) </font></tt>
<br><tt><font size=2>getting the parameters passed via netlink messages
where libvirt </font></tt>
<br><tt><font size=2>will (likely) send the message in form of a (netlink)
multicast to</font></tt>
<br><tt><font size=2>be ignored by the kernel and handled by LLDPAD. The
1st is to</font></tt>
<br><tt><font size=2>support the (pre-)standard 802.1Qbg.</font></tt>
<br>
<br><tt><font size=2>The 2nd one provides a similar parameter necessary
also for</font></tt>
<br><tt><font size=2>running a protocol between the host and the switch.
In this case</font></tt>
<br><tt><font size=2>there will be support by the Ethernet adapter's firmware
to run the</font></tt>
<br><tt><font size=2>protocol and libvirt will trigger it via a netlink
message digested</font></tt>
<br><tt><font size=2>by the kernel + driver. This is to support the (pre-)standard
802.1Qbh.</font></tt>
<br><tt><font size=2><br>
> <br>
> Also, when we have 2 different sets of attributes, we normally use<br>
> a type attribute on the element to tell the parser what set of<br>
> data to expect. So I think this should gain a 'type' attribute here.<br>
> <br>
> > @@ -1873,6 +1879,20 @@ virDomainNetDefParseXML(virCapsPtr caps,<br>
> >                  
      xmlStrEqual(cur->name, BAD_CAST "source"))
{<br>
> >                  dev
 = virXMLPropString(cur, "dev");<br>
> >                  mode
= virXMLPropString(cur, "mode");<br>
> > +            } else if ((vsiManagerID
== NULL) &&<br>
> > +                  
    (vsiTypeID == NULL) &&<br>
> > +                  
    (vsiTypeIDVersion == NULL) &&<br>
> > +                  
    (vsiInstanceID == NULL) &&<br>
> > +                  
    (vsiProfileID == NULL) &&<br>
> > +                  
    (def->type == VIR_DOMAIN_NET_TYPE_DIRECT) &&<br>
> > +                  
    xmlStrEqual(cur->name, BAD_CAST "vsi")) {<br>
> > +                vsiManagerID
= virXMLPropString(cur, "managerid");<br>
> > +                vsiTypeID
= virXMLPropString(cur, "typeid");<br>
> > +                vsiTypeIDVersion
= virXMLPropString(cur,<br>
> > "typeidversion");<br>
> > +                vsiInstanceID
= virXMLPropString(cur, "instanceid");<br>
> > +#ifdef IFLA_VF_PORT_PROFILE_MAX<br>
> > +                vsiProfileID
= virXMLPropString(cur, "profileid");<br>
> > +#endif<br>
> <br>
> XML parsing routines should not be #ifdefd. The XML format is formally<br>
> defined by the schema and must never change based on compile time
options.<br>
> </font></tt>
<br>
<br><tt><font size=2>Ok. I'll do away with this then.</font></tt>
<br><tt><font size=2><br>
> >              } else if ((network
== NULL) &&<br>
> >                  
      ((def->type == VIR_DOMAIN_NET_TYPE_SERVER) ||<br>
> >                  
       (def->type == VIR_DOMAIN_NET_TYPE_CLIENT)
||<br>
> > @@ -2049,6 +2069,51 @@ virDomainNetDefParseXML(virCapsPtr caps,<br>
> >          } else<br>
> >              def->data.direct.mode
=<br>
> > VIR_DOMAIN_NETDEV_MACVTAP_MODE_VEPA;<br>
> >  <br>
> > +        vsi = &def->data.direct.vsiProfile;<br>
> > +<br>
> > +#ifdef IFLA_VF_PORT_PROFILE_MAX<br>
> > +        if (vsiProfileID != NULL) {<br>
> > +            if (virStrcpyStatic(vsi->u.vsi8021Qbh.profileID,<br>
> > +                  
             vsiProfileID) != NULL)
{<br>
> > +                vsi->vsiType
= VIR_VSI_8021QBH;<br>
> > +                break;<br>
> > +            }<br>
> > +        }<br>
> > +#endif<br>
> <br>
> Likewise here</font></tt>
<br>
<br><tt><font size=2>Ok.</font></tt>
<br>
<br><tt><font size=2>> >  <br>
> >  <br>
> > +#define IFLA_VF_PORT_PROFILE_MAX 40<br>
> > +enum virVSIType {<br>
> > +    VIR_VSI_INVALID,<br>
> <br>
> This isn't really 'INVALID' - this is better named 'NONE'<br>
> since its simply an indication that this interface does not<br>
> have any VSI info defined</font></tt>
<br>
<br>
<br><tt><font size=2>Will change it.</font></tt>
<br><tt><font size=2><br>
> <br>
> > +    VIR_VSI_8021QBG,<br>
> > +#ifdef IFLA_VF_PORT_PROFILE_MAX<br>
> > +    VIR_VSI_8021QBH,<br>
> > +#endif<br>
> <br>
> And here, etc</font></tt>
<br>
<br><tt><font size=2>Ok.</font></tt>
<br><tt><font size=2><br>
> <br>
> > +};<br>
> > +<br>
> > +/* profile data for macvtap (VEPA) */<br>
> > +typedef struct _virVSIProfileDef virVSIProfileDef;<br>
> > +typedef virVSIProfileDef *virVSIProfileDefPtr;<br>
> > +struct _virVSIProfileDef {<br>
> > +    enum virVSIType   vsiType;<br>
> > +    union {<br>
> > +        struct {<br>
> > +            uint8_t    
  managerID;<br>
> > +            uint32_t    
 typeID; // 24 bit valid<br>
> > +            uint8_t    
  typeIDVersion;<br>
> > +            unsigned char instanceID[VIR_UUID_BUFLEN];<br>
> > +        } vsi8021Qbg;<br>
> > +#ifdef IFLA_VF_PORT_PROFILE_MAX<br>
> > +        struct {<br>
> > +            char    
     profileID[IFLA_VF_PORT_PROFILE_MAX];<br>
> > +        } vsi8021Qbh;<br>
> > +#endif</font></tt>
<br>
<br><tt><font size=2>The size of this character array is supposed to be
40 chars as per a kernel #define that will become available</font></tt>
<br><tt><font size=2>through some future kernel include and #define. I'd
like to restrict the size of the profile id somewhere</font></tt>
<br><tt><font size=2>when parsing it... What's the best way to do that?
Introduce a constant that also has 40 as value ?</font></tt>
<br>
<br><tt><font size=2>   Stefan</font></tt>
<br>