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

Vivek Kashyap kashyapv at us.ibm.com
Fri May 7 19:47:59 UTC 2010


> >
> > 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)

yes, vsi is fine.

> 
> 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.

yes, nice.

thanks!

Vivek
> 
> 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
> > >
> 
>


More information about the libvir-list mailing list