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

Re: [libvirt] [PATCH 1/3] libxl: support openvswitch interfaces



On 12/6/18 12:44 AM, Michal Privoznik wrote:
On 11/16/18 11:26 PM, Jim Fehlig wrote:
It is currently possible to use <interface>s of type openvswitch
with the libxl driver in a non-standard way, e.g.

   <interface type='bridge'>
     <source bridge='ovsbr0'/>
     <mac address='00:16:3e:7a:35:ce'/>
     <script path='vif-openvswitch'/>
   </interface>

This patch adds support for openvswitch <interface>s specified
in typical libvirt config

   <interface type='bridge'>
     <source bridge='ovsbr0'/>
     <mac address='00:16:3e:7a:35:ce'/>
     <virtualport type='openvswitch'/>
   </interface>

VLAN tags and trunking are also supported using the extended
syntax for specifying an openvswitch bridge in libxl

    BRIDGE_NAME[.VLAN][:TRUNK:TRUNK]

See Xen's networking wiki for more details on openvswitch support

https://wiki.xenproject.org/wiki/Xen_Networking#Open_vSwitch

Signed-off-by: Jim Fehlig <jfehlig suse com>
---
  src/libxl/libxl_conf.c | 47 ++++++++++++++++++++++++++++++++++++++++--
  1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index e2bfa2f5c3..39c969e482 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -51,6 +51,7 @@
  #include "cpu/cpu.h"
  #include "xen_common.h"
  #include "xen_xl.h"
+#include "virnetdevvportprofile.h"
#define VIR_FROM_THIS VIR_FROM_LIBXL
@@ -1190,6 +1191,11 @@ libxlMakeNic(virDomainDefPtr def,
      virNetworkPtr network = NULL;
      virConnectPtr conn = NULL;
      virNetDevBandwidthPtr actual_bw;
+    virNetDevVPortProfilePtr port_profile;
+    virNetDevVlanPtr virt_vlan;
+    virBuffer buf = VIR_BUFFER_INITIALIZER;
+    size_t i;
+    const char *script = NULL;
      int ret = -1;
/* TODO: Where is mtu stored?
@@ -1247,14 +1253,50 @@ libxlMakeNic(virDomainDefPtr def,
      if (VIR_STRDUP(x_nic->ifname, l_nic->ifname) < 0)
          goto cleanup;
+ port_profile = virDomainNetGetActualVirtPortProfile(l_nic);
+    virt_vlan = virDomainNetGetActualVlan(l_nic);
+    script = l_nic->script;
      switch (actual_type) {
          case VIR_DOMAIN_NET_TYPE_BRIDGE:
+            virBufferAsprintf(&buf, "%s", virDomainNetGetActualBridgeName(l_nic));

Or virBufferAddStr() or virBufferAdd(,,-1);

I recall liking virBufferAddStr() that last time it was recommended :-).

Regards,
Jim


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