[libvirt] [PATCH] more interface functions; some needed for VEPA

Stefan Berger stefanb at us.ibm.com
Fri May 7 19:32:04 UTC 2010


kashyapv at linux.vnet.ibm.com wrote on 05/07/2010 03:21:53 PM:

> [image removed] 
> 
> Re: [libvirt] [PATCH] more interface functions; some needed for VEPA
> 
> kashyapv 
> 
> to:
> 
> Stefan Berger
> 
> 05/07/2010 03:22 PM
> 
> Cc:
> 
> libvir-list
> 
> On Fri, 7 May 2010, Stefan Berger wrote:
> 
> > Then there is a new function that reads the VLANid of a VLAN interface
> > via an ioctl(). This one will be needed by upcoming VEPA related
> > patches.
> 
> Yes, this is needed by VEPA. With this patch it should be possible to 
> collect all the components required for the VEPA (for VSI discovery 
protocol).
> 
> As per your/David's earlier RFC for sending the netlink message to
> the VSI engine (LLDPAD), the netlink message will need to contain:
> 
> 1. 'Port profile'  comprising of :
>     VSI Manager ID      1 octet
>     VSI Type ID         3 octets
>     VSI Type ID Version 1 octet
>     VSI Instance ID    16 octets
> 
> Therefore need to extend the domain xml to take the above 4 values.
> 
> reference, Pg 50 of the proposal here
>     
http://www.ieee802.org/1/files/public/docs2010/bg-joint-evb-0410v1.pdf

Gerhard and I defined the following XML for the above:

    <interface type='direct'> 
      <source dev='static' mode='vepa'/> 
-->   <vsi managerid='12' typeid='1193046' typeidversion='1' 
instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'/>    <--
    </interface> 

(whether above node is called 'vsi' or 'vdp' -- I don't care either way, 
but 'vsi' for now) 

following this schema and corresponding (self-explanatory) data types: 

+  <define name="vsiProfile"> 
+    <element name="vsi"> 
+      <attribute name="managerid"> 
+        <ref name="uint8range"/> 
+      </attribute> 
+      <attribute name="typeid"> 
+        <ref name="uint24range"/> 
+      </attribute> 
+      <attribute name="typeidversion"> 
+        <ref name="uint8range"/> 
+      </attribute> 
+      <attribute name="instanceid"> 
+        <ref name="UUID"/> 
+      </attribute> 
+    </element> 
+  </define> 

So the previous switchport and profile are gone. 

Regards,
    Stefan


> 
> 2. MAC address (of the virtual interface)
> 
> 3. VLAN tag  (associtaed with the virtual interface)
> 
> thanks
>     Vivek
> 
> 
> 
> >
> > On cygwin for example none of the newly added functions are available.
> > The flags related function could not be exported due to missing
> > PF_PACKET -- or maybe other type of protocol that needs to be used 
when
> > opening the socket for running the ioctl() on.
> >
> > Signed-off-by: Stefan Berger <stefanb at us.ibm.com>
> >
> <..snip>
> > +
> > +#ifdef __linux__
> > +int
> > +ifaceGetVlanID(const char *vlanifname, int *vlanid) {
> > +    struct vlan_ioctl_args vlanargs = {
> > +      .cmd = GET_VLAN_VID_CMD,
> > +    };
> > +    int rc = 0;
> > +    int fd = socket(PF_PACKET, SOCK_DGRAM, 0);
> > +
> > +    if (fd < 0)
> > +        return errno;
> > +
> > +    if (virStrcpyStatic(vlanargs.device1, vlanifname) == NULL) {
> > +        rc = EINVAL;
> > +        goto err_exit;
> > +    }
> > +
> > +    if (ioctl(fd, SIOCGIFVLAN, &vlanargs) != 0) {
> > +        rc = errno;
> > +        goto err_exit;
> > +    }
> > +
> > +    *vlanid = vlanargs.u.VID;
> > +
> > + err_exit:
> > +    close(fd);
> > +
> > +    return rc;
> > +}
> > +
> > +#else
> > +
> > +int
> > +ifaceGetVlanID(const char *vlanifname ATTRIBUTE_UNUSED,
> > +               int *vlanid ATTRIBUTE_UNUSED) {
> > +
> > +    ifaceError(VIR_ERR_INTERNAL_ERROR, "%s",
> > +               _("ifaceGetVlanID is not supported on non-linux 
> platforms"));
> > +
> > +    return ENOSYS;
> > +}
> > +#endif /* __linux__ */
> > Index: libvirt-acl/src/util/interface.h
> > ===================================================================
> > --- libvirt-acl.orig/src/util/interface.h
> > +++ libvirt-acl/src/util/interface.h
> > @@ -12,6 +12,9 @@
> >
> > # include "datatypes.h"
> >
> > +int ifaceGetFlags(const char *name, short *flags);
> > +int ifaceIsUp(const char *name, bool *up);
> > +
> > int ifaceCtrl(const char *name, bool up);
> >
> > static inline int ifaceUp(const char *name) {
> > @@ -27,4 +30,6 @@ int ifaceCheck(bool reportError, const c
> >
> > int ifaceGetIndex(bool reportError, const char *ifname, int *ifindex);
> >
> > +int ifaceGetVlanID(const char *vlanifname, int *vlanid);
> > +
> > #endif /* __VIR_INTERFACE_H__ */
> > Index: libvirt-acl/src/libvirt_private.syms
> > ===================================================================
> > --- libvirt-acl.orig/src/libvirt_private.syms
> > +++ libvirt-acl/src/libvirt_private.syms
> > @@ -685,6 +685,9 @@ virArgvToString;
> > ifaceCtrl;
> > ifaceCheck;
> > ifaceGetIndex;
> > +ifaceGetFlags;
> > +ifaceIsUp;
> > +ifaceGetVlanID;
> >
> > # usb.h
> > usbGetDevice;
> >
> > --
> > libvir-list mailing list
> > libvir-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/libvir-list
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100507/60aa1833/attachment-0001.htm>


More information about the libvir-list mailing list