Re: [PATCH v3 13/36] conf: introduce virNetworkPortDefPtr struct and XML support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 22, 2019 at 11:28:17AM -0400, Laine Stump wrote:
> On 3/19/19 8:46 AM, Daniel P. Berrangé wrote:
> > Introduce a virNetworkPortDefPtr struct to represent the data associated
> > with a virtual network port. Add APIs for parsing/formatting XML docs
> > with the data.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> > ---
> >   src/conf/Makefile.inc.am                      |   2 +
> >   src/conf/virnetworkportdef.c                  | 514 ++++++++++++++++++
> >   src/conf/virnetworkportdef.h                  | 112 ++++
> >   src/libvirt_private.syms                      |  10 +
> >   tests/Makefile.am                             |   7 +
> >   .../plug-bridge-mactbl.xml                    |   9 +
> >   .../virnetworkportxml2xmldata/plug-bridge.xml |  12 +
> >   .../virnetworkportxml2xmldata/plug-direct.xml |  12 +
> >   .../plug-hostdev-pci.xml                      |  12 +
> >   tests/virnetworkportxml2xmldata/plug-none.xml |   8 +
> >   tests/virnetworkportxml2xmltest.c             | 104 ++++
> >   11 files changed, 802 insertions(+)
> >   create mode 100644 src/conf/virnetworkportdef.c
> >   create mode 100644 src/conf/virnetworkportdef.h
> >   create mode 100644 tests/virnetworkportxml2xmldata/plug-bridge-mactbl.xml
> >   create mode 100644 tests/virnetworkportxml2xmldata/plug-bridge.xml
> >   create mode 100644 tests/virnetworkportxml2xmldata/plug-direct.xml
> >   create mode 100644 tests/virnetworkportxml2xmldata/plug-hostdev-pci.xml
> >   create mode 100644 tests/virnetworkportxml2xmldata/plug-none.xml
> >   create mode 100644 tests/virnetworkportxml2xmltest.c
> > 
> > diff --git a/src/conf/Makefile.inc.am b/src/conf/Makefile.inc.am
> > index 9b4d80485b..388917c5dd 100644
> > --- a/src/conf/Makefile.inc.am
> > +++ b/src/conf/Makefile.inc.am
> > @@ -5,6 +5,8 @@ NETDEV_CONF_SOURCES = \
> >   	conf/netdev_vport_profile_conf.c \
> >   	conf/netdev_vlan_conf.h \
> >   	conf/netdev_vlan_conf.c \
> > +	conf/virnetworkportdef.h \
> > +	conf/virnetworkportdef.c \
> >   	$(NULL)
> >   DOMAIN_CONF_SOURCES = \
> > diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c
> > new file mode 100644
> > index 0000000000..7023d9607e
> > --- /dev/null
> > +++ b/src/conf/virnetworkportdef.c
> > @@ -0,0 +1,514 @@
> > +/*
> > + * virnetworkportdef.c: network port XML processing
> > + *
> > + * Copyright (C) 2018 Red Hat, Inc.
> > + *
> > + * This library is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU Lesser General Public
> > + * License as published by the Free Software Foundation; either
> > + * version 2.1 of the License, or (at your option) any later version.
> > + *
> > + * This library is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > + * Lesser General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU Lesser General Public
> > + * License along with this library.  If not, see
> > + * <http://www.gnu.org/licenses/>.
> > + */
> > +
> > +#include <config.h>
> > +
> > +#include "viralloc.h"
> > +#include "virerror.h"
> > +#include "virstring.h"
> > +#include "virfile.h"
> > +#include "virnetworkportdef.h"
> > +#include "network_conf.h"
> > +
> > +#define VIR_FROM_THIS VIR_FROM_NETWORK
> > +
> > +VIR_ENUM_IMPL(virNetworkPortPlug, VIR_NETWORK_PORT_PLUG_TYPE_LAST,
> > +              "none", "bridge", "direct", "hostdev-pci");
> 
> 
> Are we going to need to differentiate between veth and macvtap later? Having
> the choice implied based on which hypervisor it's coming from seems
> potentially troublesome...

I view those as different axis.

  "bridge" can be implemented with "tap" or "veth"
  "direct" can be implemented with "macvtap" or "macvlan"

IOW, if we did need to distinguish tap & veth later, we can add
them as a separate attribute in the XML


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux