>>>>>>>> [ovs][libvirt] virt-xml ovs-vsctl

时间:2021-03-19 04:18:20

查看可用的参数:

[root@vrouter1 tong]#  virt-xml --add-device --network=? |grep source
source
source_mode
source_path
source_type
[root@vrouter1 tong]#

添加两个vhostuser的网卡

[root@vrouter1 ~]# virt-xml --add-device --network type=vhostuser,model=virtio,source_type=unix,source_mode=server,source_path="/tmp/nlb_vm0.sock" centos7.
Domain 'centos7.0' defined successfully.
[root@vrouter1 ~]# virt-xml --add-device --network type=vhostuser,model=virtio,source_type=unix,source_mode=server,source_path="/tmp/nlb_vm1.sock" centos7.
Domain 'centos7.0' defined successfully.
[root@vrouter1 ~]#

删除所有类型为bridge的网卡

[root@vrouter1 ~]# virt-xml --remove-device --network type=bridge centos7.
Domain 'centos7.0' defined successfully.
[root@vrouter1 ~]#

设置OVS-dpdk

[root@vrouter1 ~]# ovs-vsctl add-br ovs-br0
ovs-vsctl: Error detected while setting up 'ovs-br0'. See ovs-vswitchd log for details.
ovs-vsctl: The default log directory is "/var/log/openvswitch".
[root@vrouter1 ~]# ovs-vsctl set bridge ovs-br0 datapath_type=netdev

设置 vhostuser port

[root@vrouter1 ~]# ovs-vsctl add-port ovs-br0 vhostclient0 -- set Interface vhostclient0 type=dpdkvhostuserclient options:vhost-server-path=/tmp/nlb_vm0.sock

编译qemu

./configure --prefix=/export/Datapath/tong/qemu_home/ --target-list=x86_64-softmmu --disable-gtk 

设置ovs-dpdk port


[root@vrouter1 ~]# dpdk-devbind -b vfio-pci eth0

[root@vrouter1 ~]# ovs-vsctl add-port ovs-br0 pci_port1 -- set Interface pci_port1 type=dpdk options:dpdk-devargs=::00.1

root@vrouter1 ~# ovs-vsctl add-br ovs-phy -- set bridge ovs-phy datapath_type=netdev
[root@vrouter1 ~]# ovs-vsctl add-port ovs-br0 vxlantarget1 -- set interface vxlantarget1 type=vxlan options:remote_ip=192.168.77.200 options:local_ip=10.0.0.161 options:in_key=flow options:out_key=flow
[root@vrouter1 ~]# ovs-vsctl add-port ovs-br0 vxlanclient1 -- set interface vxlanclient1 type=vxlan options:remote_ip=192.168.77.163 options:local_ip=10.0.0.161 options:in_key=flow options:out_key=flow
[root@vrouter1 ~]# ovs-ofctl -O openflow13 del-flows ovs-br0