Rockstable Wiki:

openvswitch

Create a vSwitch

   1 ovs-vsctl add-br ovs-iso

Integration into libvirt

   1 <network connections='1'>
   2   <name>ovs-iso</name>
   3   <forward mode='bridge'/>
   4   <bridge name='ovs-iso'/>
   5   <virtualport type='openvswitch'/>
   6 </network>

temporary creation

   1 root@infinitas ~ # virsh net-create net_ovs-iso.xml
   2 Network ovs-iso created from net_ovs-iso.xml
   3 root@infinitas ~ # virsh 
   4 Welcome to virsh, the virtualization interactive terminal.
   5 
   6 Type:  'help' for help with commands
   7        'quit' to quit
   8 
   9 virsh # net-list --all
  10  Name                 State      Autostart     Persistent
  11 ----------------------------------------------------------
  12  default              inactive   no            yes
  13  ovs-iso              active     no            no

persistent creation

   1 root@infinitas ~ # virsh
   2 Welcome to virsh, the virtualization interactive terminal.
   3 
   4 Type:  'help' for help with commands
   5        'quit' to quit
   6 
   7 virsh # net-list --all
   8  Name                 State      Autostart     Persistent
   9 ----------------------------------------------------------
  10  default              inactive   no            yes
  11 
  12 virsh # net-define /root/net_ovs-iso.xml 
  13 Network ovs-iso defined from /root/net_ovs-iso.xml
  14 
  15 virsh # net-list --all
  16  Name                 State      Autostart     Persistent
  17 ----------------------------------------------------------
  18  default              inactive   no            yes
  19  ovs-iso              inactive   no            yes
  20 
  21 virsh # net-autostart ovs-iso
  22 Network ovs-iso marked as autostarted
  23 
  24 virsh # net-list --all
  25  Name                 State      Autostart     Persistent
  26 ----------------------------------------------------------
  27  default              inactive   no            yes
  28  ovs-iso              inactive   yes           yes
  29 
  30 virsh # net-start ovs-iso
  31 Network ovs-iso started
  32 
  33 virsh # net-list --all
  34  Name                 State      Autostart     Persistent
  35 ----------------------------------------------------------
  36  default              inactive   no            yes
  37  ovs-iso              active     yes           yes
  38 
  39 virsh # 
  40 

deleting a network

   1 virsh # net-list --all
   2  Name                 State      Autostart     Persistent
   3 ----------------------------------------------------------
   4  default              inactive   no            yes
   5  ovs-iso              inactive   yes           yes
   6 
   7 virsh # net-start ovs-iso
   8 Network ovs-iso started
   9 
  10 virsh # net-undefine ovs-iso
  11 Network ovs-iso has been undefined
  12 
  13 virsh # net-list --all
  14  Name                 State      Autostart     Persistent
  15 ----------------------------------------------------------
  16  default              inactive   no            yes
  17  ovs-iso              active     no            no
  18 
  19 virsh # net-destroy ovs-iso
  20 Network ovs-iso destroyed
  21 
  22 virsh # net-list --all
  23  Name                 State      Autostart     Persistent
  24 ----------------------------------------------------------
  25  default              inactive   no            yes
  26 
  27 virsh # 
  28 

Show Switch

   1 ...
   2     <interface type='network'>
   3       <mac address='52:54:00:49:35:80'/>
   4       <source network='ovs-iso'/>
   5       <model type='virtio'/>
   6       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
   7     </interface>
   8 ...

   1 root@infinitas ~ # ovs-vsctl show
   2 88df2bfb-34e7-4251-b6f8-e7aa38761e43
   3     Bridge ovs-iso
   4         Port "vnet0"
   5             Interface "vnet0"
   6         Port ovs-iso
   7             Interface ovs-iso
   8                 type: internal
   9     ovs_version: "2.3.0"

   1 

Rockstable Wiki: openvswitch (last edited 2019-06-24 13:17:59 by anonymous)