!15 Fix ovs-tcpdump import error
From: @luosu-wang Reviewed-by: @lilijun606 Signed-off-by: @lilijun606
This commit is contained in:
commit
80969c46dd
41
0003-Fallback-to-read-proc-net-dev-on-linux.patch
Normal file
41
0003-Fallback-to-read-proc-net-dev-on-linux.patch
Normal file
@ -0,0 +1,41 @@
|
||||
diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
|
||||
index 11624c5..cdba1d5 100755
|
||||
--- a/utilities/ovs-tcpdump.in
|
||||
+++ b/utilities/ovs-tcpdump.in
|
||||
@@ -24,7 +24,21 @@ import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
-import netifaces
|
||||
+try:
|
||||
+ from netifaces import interfaces
|
||||
+except ImportError:
|
||||
+ if sys.platform in ['linux', 'linux2']:
|
||||
+ def interfaces():
|
||||
+ devices = []
|
||||
+ with open("/proc/net/dev", "r") as f_netdev:
|
||||
+ for line in f_netdev:
|
||||
+ if ":" not in line:
|
||||
+ continue
|
||||
+ devices.append(line.split(":")[0].strip())
|
||||
+ return devices
|
||||
+ else:
|
||||
+ print("ERROR: Please install netifaces Python library.")
|
||||
+ sys.exit(1)
|
||||
|
||||
try:
|
||||
from ovs.db import idl
|
||||
@@ -438,11 +452,11 @@ def main():
|
||||
mirror_interface = _make_mirror_name[sys.platform](interface)
|
||||
|
||||
if sys.platform in _make_taps and \
|
||||
- mirror_interface not in netifaces.interfaces():
|
||||
+ mirror_interface not in interfaces():
|
||||
_make_taps[sys.platform](mirror_interface,
|
||||
ovsdb.interface_mtu(interface))
|
||||
|
||||
- if mirror_interface not in netifaces.interfaces():
|
||||
+ if mirror_interface not in interfaces():
|
||||
print("ERROR: Please create an interface called `%s`" %
|
||||
mirror_interface)
|
||||
print("See your OS guide for how to do this.")
|
||||
@ -3,12 +3,13 @@ Summary: Production Quality, Multilayer Open Virtual Switch
|
||||
URL: http://www.openvswitch.org/
|
||||
Version: 2.12.0
|
||||
License: ASL 2.0
|
||||
Release: 9
|
||||
Release: 10
|
||||
Source: https://www.openvswitch.org/releases/openvswitch-%{version}.tar.gz
|
||||
Buildroot: /tmp/openvswitch-rpm
|
||||
Patch0000: 0000-openvswitch-add-stack-protector-strong.patch
|
||||
Patch0001: 0001-fix-dict-change-during-iteration.patch
|
||||
Patch0002: 0002-Remove-unsupported-permission-names.patch
|
||||
Patch0003: 0003-Fallback-to-read-proc-net-dev-on-linux.patch
|
||||
Requires: logrotate hostname python >= 3.8 python3-six selinux-policy-targeted
|
||||
BuildRequires: python3-six, openssl-devel checkpolicy selinux-policy-devel autoconf automake libtool python-sphinx unbound-devel
|
||||
Provides: openvswitch-selinux-policy = %{version}-%{release}
|
||||
@ -93,6 +94,12 @@ install -m 0644 lib/*.h $RPM_BUILD_ROOT/%{_includedir}/openvs
|
||||
install -D -m 0644 lib/.libs/libopenvswitch.a \
|
||||
$RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a
|
||||
|
||||
install -d -m 0755 $RPM_BUILD_ROOT%{python3_sitelib}
|
||||
cp -a $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* \
|
||||
$RPM_BUILD_ROOT%{python3_sitelib}
|
||||
|
||||
rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
@ -164,7 +171,8 @@ exit 0
|
||||
%{_libdir}/lib*.so.*
|
||||
/usr/sbin/ovs-vswitchd
|
||||
/usr/sbin/ovsdb-server
|
||||
/usr/share/openvswitch/python/
|
||||
%{python3_sitelib}/ovs
|
||||
%{python3_sitelib}/ovstest
|
||||
/usr/share/openvswitch/scripts/ovs-check-dead-ifs
|
||||
/usr/share/openvswitch/scripts/ovs-ctl
|
||||
/usr/share/openvswitch/scripts/ovs-kmod-ctl
|
||||
@ -196,6 +204,9 @@ exit 0
|
||||
%doc README.rst NEWS rhel/README.RHEL.rst
|
||||
|
||||
%changelog
|
||||
* Tue Sep 24 2020 luosuwang <oenetdev@huawei.com> - 2.12.0-10
|
||||
- Fix ovs-tcpdump import error
|
||||
|
||||
* Tue Sep 22 2020 luosuwang <oenetdev@huawei.com> - 2.12.0-9
|
||||
- Remove openvswitch-kmod package
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user