summaryrefslogtreecommitdiff
path: root/utilities
Commit message (Collapse)AuthorAgeFilesLines
* Eliminate "whitelist" and "blacklist" terms.Ben Pfaff2020-10-161-4/+4
| | | | | | | | There is one remaining use under datapath. That change should happen upstream in Linux first according to our usual policy. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
* Use primary/secondary, not master/slave, as names for OpenFlow roles.Ben Pfaff2020-10-161-4/+4
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
* ovs-lib: Handle daemon segfaults during exit.Gurucharan Shetty2020-09-211-1/+17
| | | | | | | | | | | | | | | | | | | | | | Currently, we terminate a daemon by trying "ovs-appctl exit", "SIGTERM" and finally "SIGKILL". But the logic fails if during "ovs-appctl exit", the daemon crashes (segfaults). The monitor will automatically restart the daemon with a new pid. The current logic of checking the non-existance of old pid succeeds and we proceed with the assumption that the daemon is dead. This is a problem during OVS upgrades as we will continue to run the older version of OVS. With this commit, we take care of this situation. If there is a segfault, the pidfile is not deleted. So, we wait a little to give time for the monitor to restart the daemon (which is usually instantaneous) and then re-read the pidfile. VMware-BZ: #2633995 Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
* ovs-dpctl-top: Skip "eth()" element.Timothy Redaelli2020-08-261-0/+2
| | | | | | | | | | | | | | With commit efde188622ae ("odp-util: Print eth() for Ethernet flows if packet_type is absent.") "eth()" is printed for Ethernet flows if packet_type is absent, but this broke "ovs-dpctl-top" since it expects that every element has a value. This commit skips the parsing of the empty "eth()" element. Fixes: efde188622ae ("odp-util: Print eth() for Ethernet flows if packet_type is absent.") Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* python: Fixup python shebangs to python3.Greg Rose2020-08-262-4/+4
| | | | | | | | | | | | | | | | | | Builds on RHEL 8.2 systems are failing due to this issue. See [1] as to why this is necessary. I used the following command to identify files that need this fix: find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs I also updated the copyright notices as needed. 1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error Fixes: 1ca0323e7c29 ("Require Python 3 and remove support for Python 2.") Signed-off-by: Greg Rose <gvrose8192@gmail.com> Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* checkpatch: Add argument to skip gerrit change id check.Roi Dayan2020-07-171-2/+8
| | | | | | | | This arg can be used internally by groups using gerrit for code reviews. Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ovs-bugtool: Fix Python3 bytes str issue.William Tu2020-07-141-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The patch fixes two errors due to type mismatched, when converting between str and bytes: File "/usr/local/sbin/ovs-bugtool", line 649, in main cmd_output(CAP_NETWORK_STATUS, [OVS_DPCTL, 'dump-flows', '-m', d]) File "/usr/local/sbin/ovs-bugtool", line 278, in cmd_output label = ' '.join(a) TypeError: sequence item 3: expected str instance, bytes found And File "/usr/sbin/ovs-bugtool", line 721, in main collect_data() File "/usr/sbin/ovs-bugtool", line 366, in collect_data run_procs(process_lists.values()) File "/usr/sbin/ovs-bugtool", line 1354, in run_procs p.inst.write("\n** timeout **\n") File "/usr/sbin/ovs-bugtool", line 1403, in write BytesIO.write(self, s) TypeError: a bytes-like object is required, not 'str' VMware-BZ: #2602135 Fixed: 9e6c00bca9af ("bugtool: Fix for Python3.") Acked-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: William Tu <u9012063@gmail.com>
* bridge: Fix null dereference on ct_timeout_policy recordYi-Hung Wei2020-06-271-3/+7
| | | | | | | | | | | | | | Accoridng to vswitch.ovsschema, each CT_Zone record may have zero or one associcated CT_Timeout_policy. Thus, this patch checks if ovsrec_ct_timeout_policy exist before accesses the record. VMWare-BZ: 2585825 Fixes: 45339539f69d ("ovs-vsctl: Add conntrack zone commands.") Fixes: 993cae678bca ("ofproto-dpif: Consume CT_Zone, and CT_Timeout_Policy tables") Reported-by: Yang Song <yangsong@vmware.com> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: William Tu <u9012063@gmail.com>
* ovs-bugtool: Add -m option to dump-flows.William Tu2020-05-201-0/+1
| | | | | | | | | | This patch adds 'ovs-appctl dpctl/dump-flows -m' to bugtool, the output will include wildcarded fields and the miniflow bits, such as 'dp-extra-info:miniflow_bits(4,1)'. Cc: Emma Finn <emma.finn@intel.com> Acked-by: Greg Rose <gvrose8192@gmail.com> Signed-off-by: William Tu <u9012063@gmail.com>
* ovs-bugtool: Add ethtool -l for combined channel.William Tu2020-04-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Users of netdev-afxdp has to setup the combined channel on physical NIC. This helps debugging related issues. Example output: $ ethtool -l enp3s0f0 Channel parameters for enp3s0f0: Pre-set maximums: RX: 0 TX: 0 Other: 1 Combined: 63 Current hardware settings: RX: 0 TX: 0 Other: 1 Combined: 1 Some previous discussion: https://mail.openvswitch.org/pipermail/ovs-dev/2020-January/366631.html Signed-off-by: William Tu <u9012063@gmail.com> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
* bugtool: Add dump-tlv-map.William Tu2020-04-291-0/+1
| | | | | | | This helps debugging the tlv map issues. Signed-off-by: William Tu <u9012063@gmail.com> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
* Utilities: Add the ovs_dump_ofpacts command to gdbEelco Chaudron2020-04-251-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | This adds the ovs_dump_ifpacts command: (gdb) help ovs_dump_ofpacts Dump all actions in an ofpacts set Usage: ovs_dump_ofpacts <struct ofpact *> <ofpacts_len> <struct ofpact *> : Pointer to set of ofpact structures. <ofpacts_len> : Total length of the set. Example dumping all actions when in the clone_xlate_actions() function: (gdb) ovs_dump_ofpacts actions actions_len (struct ofpact *) 0x561c7be487c8: {type = OFPACT_SET_FIELD, raw = 255 '', len = 24} (struct ofpact *) 0x561c7be487e0: {type = OFPACT_SET_FIELD, raw = 255 '', len = 24} (struct ofpact *) 0x561c7be487f8: {type = OFPACT_SET_FIELD, raw = 255 '', len = 24} (struct ofpact *) 0x561c7be48810: {type = OFPACT_SET_FIELD, raw = 255 '', len = 32} (struct ofpact *) 0x561c7be48830: {type = OFPACT_SET_FIELD, raw = 255 '', len = 24} (struct ofpact *) 0x561c7be48848: {type = OFPACT_RESUBMIT, raw = 38 '&', len = 16} Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: William Tu <u9012063@gmail.com>
* Utilities: make print() in gdb script work on all version of PythonEelco Chaudron2020-04-211-0/+1
| | | | | Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: William Tu <u9012063@gmail.com>
* bugtool: Fix for Python3.Timothy Redaelli2020-04-091-23/+25
| | | | | | | | | | | | | | Currently ovs-bugtool tool doesn't start on Python 3. This commit fixes ovs-bugtool to make it works on Python 3. Replaced StringIO.StringIO with io.BytesIO since the script is processing binary data. Reported-at: https://bugzilla.redhat.com/1809241 Reported-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Co-authored-by: William Tu <u9012063@gmail.com> Signed-off-by: William Tu <u9012063@gmail.com>
* ovs-dpctl-top: python3 compatibilityAaron Conole2020-03-051-5/+8
| | | | | | | | | | | | During the transition to python3 support, some syntax errors weren't adequately cleaned. This addresses the various errors, plus one minor issue with string type conversion. Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1809184 Tested-by: Flavio Leitner <fbl@sysclose.org> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-tcpdump: Fallback to read /proc/net/dev on LinuxTimothy Redaelli2020-01-131-3/+17
| | | | | | | | | | | | | Currently, ovs-tcpdump uses python3-netifaces in order to get the list of the network interfaces, but python3-netifaces may not be installed nor available on some distributions (for example on RHEL7). This commit adds, only for Linux, an alternative way (that is only used when netifaces is not available) to read the list of the network interfaces by reading "/proc/net/dev". Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs container build: Make kernel module configurableAliasgar Ginwala2019-12-203-7/+27
| | | | | | | | | --with-linux can be made configurable while building containers for leveraging kernel modules installed on host. KERNEL_VERSION=host should be used in env variable for the same. Signed-off-by: Aliasgar Ginwala <aginwala@ebay.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Remove dependency on python3-sixTimothy Redaelli2019-12-203-41/+27
| | | | | | | | | | | Since Python 2 support was removed in 1ca0323e7c29 ("Require Python 3 and remove support for Python 2."), python3-six is not needed anymore. Moreover python3-six is not available on RHEL/CentOS7 without using EPEL and so this patch is needed in order to release OVS 2.13 on RHEL7. Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* checkpatch: Check spelling in commit messages.Ilya Maximets2019-12-091-11/+22
| | | | | | | | | This seems useful as I'm usually making a lot of typing mistakes. Also, few commonly used words added to the extended dictionary. Signed-off-by: Ilya Maximets <i.maximets@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: William Tu <u9012063@gmail.com>
* checkpatch: Skip words containing numbers.Ilya Maximets2019-12-091-2/+2
| | | | | | | | | | | Words like 'br0' are common and usually references some code or database objects that should not be targets for spell checking. So, it's better to skip all the words that has digits inside instead of ones that starts with numbers. Signed-off-by: Ilya Maximets <i.maximets@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: William Tu <u9012063@gmail.com>
* checkpatch: Allow common abbreviations for spell checking.Ilya Maximets2019-12-091-1/+3
| | | | | | | | | | | | Abbreviations of Latin expressions like 'i.e.' or 'e.g.' are common and known by the dictionary. However, our spell checker is not able to recognize them because it strips dots out of them. To avoid this issue we could pass non-stripped version of the word to the dictionary checker too. Signed-off-by: Ilya Maximets <i.maximets@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: William Tu <u9012063@gmail.com>
* Documentation: Convert multiple manpages to ReST.Ben Pfaff2019-12-028-1298/+0
| | | | | | Tested-by: Numan Siddique <numans@ovn.org> Acked-by: Numan Siddique <numans@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif: Expose datapath capability to ovsdb.William Tu2019-11-212-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch adds support for fetching the datapath's capabilities from the result of 'check_support()', and write the supported capability to a new database column, called 'capabilities' under Datapath table. To see how it works, run: # ovs-vsctl -- add-br br0 -- set Bridge br0 datapath_type=netdev # ovs-vsctl -- --id=@m create Datapath datapath_version=0 \ 'ct_zones={}' 'capabilities={}' \ -- set Open_vSwitch . datapaths:"netdev"=@m # ovs-vsctl list-dp-cap netdev ufid=true sample_nesting=true clone=true tnl_push_pop=true \ ct_orig_tuple=true ct_eventmask=true ct_state=true \ ct_clear=true max_vlan_headers=1 recirc=true ct_label=true \ max_hash_alg=1 ct_state_nat=true ct_timeout=true \ ct_mark=true ct_orig_tuple6=true check_pkt_len=true \ masked_set_action=true max_mpls_depth=3 trunc=true ct_zone=true Signed-off-by: William Tu <u9012063@gmail.com> Tested-by: Greg Rose <gvrose8192@gmail.com> Reviewed-by: Greg Rose <gvrose8192@gmail.com> --- v5: Add improved documentation from Ben and fix checkpatch error (tab and line 79 char) v4: rebase to master v3: fix 32-bit build, reported by Greg travis: https://travis-ci.org/williamtu/ovs-travis/builds/599276267 v2: rebase to master
* ovs-bugtool: Script to collect the port statistics.Sriram Vatala2019-11-113-1/+18
| | | | | | | | | | | | Sometimes, analysing the drop statistics of the ports will be helpful in debugging. This patch adds script to collect all supported port stats which also includes the drop counters in userspace datapath. The output of this script is included in the bugtool output. Acked-by: Kevin Traynor <ktraynor@redhat.com> Signed-off-by: Sriram Vatala <sriram.v@altencalsoftlabs.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ofp-monitor: Fixed the usage of 'usable_protocols' variable in ↵Ashish Varma2019-11-012-1/+10
| | | | | | | | | | | | | | | 'parse_flow_monitor_request' function. 'usable_protocols' is now getting set to OFPUTIL_P_OF10_ANY on return from 'parse_flow_monitor_request' function. The calling function now checks for the value in this variable against the 'allowed_protocols' variable. Also a check is added for a match field which is not supported in OpenFlow 1.0 and return an error. Modified the man page of ovs-ofctl to reflect Flow Monitor support as OpenFlow 1.0 Nicira extension only. Signed-off-by: Ashish Varma <ashishvarma.ovs@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-tcpundump: allow multiple packet lengthsAaron Conole2019-10-231-1/+1
| | | | | | | | | | The tcpundump tool expects all packets to be a length which aligns to exactly a 4-nibble boundary. This means packets like DNS requests will be stripped before being correctly processed. Fix this by allowing at least two nibbles (or one byte) alignment. Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-tcpundump: exit when getting versionAaron Conole2019-10-231-0/+1
| | | | | | | | Running 'ovs-tcpundump -V' will cause ovs-tcpundump to start processing on stdin. Instead, print the version and exit. Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs container build.sh requires python3Aliasgar Ginwala2019-10-151-2/+2
| | | | | | | | | | | | | | | Building ovn/ovs container breaks while configure: checking for Python 3 (version 3.4 or later)... no configure: error: Python 3.4 or later is required but not found in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, please install it or set to point to it As per ovs commit 1ca0323e7c29dc7ef5a615c265df0460208f92de Require Python 3 and remove support for Python 2. Signed-off-by: Aliasgar Ginwala <aginwala@ebay.com> Signed-off-by: Han Zhou <hzhou@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-vlan-bug-workaround: Remove.Ben Pfaff2019-10-145-263/+0
| | | | | | | | | | | This workaround only applied to kernels earlier than 2.6.37, but OVS only supports 3.10 and later. As the original author of this code, I won't miss it. Tested-by: Greg Rose <gvrose8192@gmail.com> Reviewed-by: Greg Rose <gvrose8192@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb-cluster: Use ovs-vsctl instead of ovn-nbctl and ovn-sbctl.Ben Pfaff2019-09-301-1/+26
| | | | | | | | | | | This removes a dependency on OVN from the tests. This adds some options to ovs-vsctl to allow it to be used for testing the clustering feature. The new options are undocumented because they're really just useful for testing clustering. Acked-by: Han Zhou <hzhou8@ebay.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Require Python 3 and remove support for Python 2.Ben Pfaff2019-09-2713-17/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python 2 reaches end-of-life on January 1, 2020, which is only a few months away. This means that OVS needs to stop depending on in the next release that should occur roughly that same time. Therefore, this commit removes all support for Python 2. It also makes Python 3 a mandatory build dependency. Some of the interesting consequences: - HAVE_PYTHON, HAVE_PYTHON2, and HAVE_PYTHON3 conditionals have been removed, since we now know that Python3 is available. - $PYTHON and $PYTHON2 are removed, and $PYTHON3 is always available. - Many tests for Python 2 support have been removed, and the ones that depended on Python 3 now run unconditionally. This allowed several macros in the testsuite to be removed, making the code clearer. This does make some of the changes to the testsuite files large due to indentation level changes. - #! lines for Python now use /usr/bin/python3 instead of /usr/bin/python. - Packaging depends on Python 3 packages. Acked-by: Numan Siddique <nusiddiq@redhat.com> Tested-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-vsctl: Add conntrack zone commands.William Tu2019-09-262-4/+221
| | | | | | | | | The patch adds commands creating/deleting/listing conntrack zone timeout policies: $ ovs-vsctl {add,del,list}-zone-tp dp zone=zone_id ... Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Justin Pettit <jpettit@ovn.org>
* flake8: also check the ovs-check-dead-ifs scriptAaron Conole2019-09-251-0/+1
| | | | | | Acked-by: William Tu <u9012063@gmail.com> Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-check-dead-ifs: unshadow pid variableAaron Conole2019-09-251-1/+1
| | | | | | | | | | The pid variable is being shadowed by the list comprehension in the os.execvp() call. This can generate flakes / warnings in some environments so fix it. Acked-by: William Tu <u9012063@gmail.com> Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-check-dead-ifs: python3 print formatAaron Conole2019-09-251-3/+3
| | | | | | | | The print call changed in python3, so update it. Acked-by: William Tu <u9012063@gmail.com> Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-ofctl: fix memory leak in open_vconn__() functionDamijan Skvarc2019-09-241-0/+2
| | | | | Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-ofctl: Free leaked minimatchYifeng Sun2019-09-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Valgrind reported: 1056: ofproto - bundle with multiple flow mods (OpenFlow 1.4) ==19220== 160 bytes in 2 blocks are definitely lost in loss record 24 of 34 ==19220== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==19220== by 0x4979A4: xmalloc (util.c:138) ==19220== by 0x42407D: miniflow_alloc (flow.c:3340) ==19220== by 0x4296CF: minimatch_init (match.c:1758) ==19220== by 0x46273D: parse_ofp_str__ (ofp-flow.c:1759) ==19220== by 0x465B9E: parse_ofp_str (ofp-flow.c:1790) ==19220== by 0x465CE0: parse_ofp_flow_mod_str (ofp-flow.c:1817) ==19220== by 0x465DF6: parse_ofp_flow_mod_file (ofp-flow.c:1876) ==19220== by 0x410BA3: ofctl_flow_mod_file.isra.19 (ovs-ofctl.c:1773) ==19220== by 0x417933: ovs_cmdl_run_command__ (command-line.c:223) ==19220== by 0x406F68: main (ovs-ofctl.c:179) This patch fixes it. Acked-by: William Tu <u9012063@gmail.com> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-bugtool: Add ip -s -s to get_device_stats.out.William Tu2019-09-181-0/+1
| | | | | | | | | | | The patch adds 'ip -s -s' to file get_device_stats.out to collect device statistics. When debugging tunnel related issues, the command shows much more detailed counters, ex: frame, crc, carrier, helping to understand the root cause when packets are dropped. Reviewed-by: Greg Rose <gvrose8192@gmail.com> Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* checkpatch: Ignore utilities/bugtool.William Tu2019-09-171-0/+2
| | | | | | Reviewed-by: Greg Rose <gvrose8192@gmail.com> Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Remove OVN.Mark Michelson2019-09-062-240/+6
| | | | | | | | | | | | | | | | OVN is separated into its own repo. This commit removes the OVN source, OVN tests, and OVN documentation. It also removes mentions of OVN from most documentation. The only place where OVN has been left is in changelogs/NEWS, since we shouldn't mess with the history of the project. There is an exception here. The ovsdb-cluster tests rely on ovn-nbctl and ovn-sbctl to run. Therefore those ovn utilities, as well as their dependencies remain in the repo with this commit. Acked-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Mark Michelson <mmichels@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Make pid_exists() more robust against empty pid argumentMichele Baldessari2019-08-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some of our destructive testing of ovn-dbs inside containers managed by pacemaker we reached a situation where /var/run/openvswitch had empty .pid files. The current code does not deal well with them and pidfile_is_running() returns true in such a case and this confuses the OCF resource agent. - Before this change: Inside a container run: killall ovsdb-server; echo -n '' > /var/run/openvswitch/ovnnb_db.pid; echo -n '' > /var/run/openvswitch/ovnsb_db.pid We will observe that the cluster is unable to ever recover because it believes the ovn processes to be running when they really aren't and eventually just fails: podman container set: ovn-dbs-bundle [192.168.24.1:8787/rhosp15/openstack-ovn-northd:pcmklatest] ovn-dbs-bundle-0 (ocf::ovn:ovndb-servers): Master controller-0 ovn-dbs-bundle-1 (ocf::ovn:ovndb-servers): Stopped controller-1 ovn-dbs-bundle-2 (ocf::ovn:ovndb-servers): Slave controller-2 Let's make sure pid_exists() returns false when the pid is an empty string. - After this change the cluster is able to recover from this state and correctly start the resource: podman container set: ovn-dbs-bundle [192.168.24.1:8787/rhosp15/openstack-ovn-northd:pcmklatest] ovn-dbs-bundle-0 (ocf::ovn:ovndb-servers): Master controller-0 ovn-dbs-bundle-1 (ocf::ovn:ovndb-servers): Slave controller-1 ovn-dbs-bundle-2 (ocf::ovn:ovndb-servers): Slave controller-2 Fixes: 3028ce2595c8 ("ovs-lib: Allow "status" command to work as non-root.") Signed-off-by: Michele Baldessari <michele@acksyn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* utilities: Improve ovs-dpctl-top flow parsingJaime Caamaño Ruiz2019-08-281-11/+12
| | | | | | | | | | * check that expected bytes and packets stats are correctly read from every flow. * check that the expected elements are read for every field type aggregation. Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-lib: Add timeout at ovs-check-dead-ifs.William Tu2019-08-261-1/+2
| | | | | | | | | | | | | | | At SUSE12 SP3, we hit a case where ovs-check-dead-ifs tries to read an entry in /proc/<pid>/fd/<some fd> but hangs forever. The pid is a qemu-system-x86_64 process and we suspect it's an issue related to qemu, not ovs. As a result, force-reload-kmod hangs and OVS bridge never gets restarted. This patch adds a timeout of 5-seconds to ovs-check-dead-ifs. VMware-BZ: #2408059 Signed-off-by: William Tu <u9012063@gmail.com> Cc: Ashish Varma <ashishvarma.ovs@gmail.com> Cc: Gurucharan Shetty <guru@ovn.org> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* OVS: Containerize componentsAliasgar Ginwala2019-08-227-1/+155
| | | | | | | | | | | | 1. Start OVS components in containers so that building and shipping of OVS components is easy. 2. Load OVS kernel modules on host from container to avoid installing ovs on host. 3. Update documentation about how to build/run ovs in docker. Acked-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: aginwala <aginwala@ebay.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-lib: Fix standalone db migration to raftAliasgar Ginwala2019-08-211-0/+1
| | | | | | | | | | | | | | | | Current code of create-cluster from standalone db takes backup of existing standalone db and then generates a new clustered dbs from backup dbs. Hence, during migration if nb and sb dbs are still present, create-cluster will fail saying file exists and will not really convert dbs to clustered dbs. This patch fixes the same. e.g message that pops up while migration from standalone to raft cluster: * Backing up database to /etc/openvswitch/ovnnb_db.db.backup5.13.0-1278623084 ovsdb-tool: I/O error: /etc/openvswitch/ovnnb_db.db: create failed (File exists) * Creating cluster database /etc/openvswitch/ovnnb_db.db from existing one Signed-off-by: aginwala <aginwala@ebay.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* checkpatch: Fix regexp for if, while, etc inside macros.Ilya Maximets2019-08-121-1/+1
| | | | | | | | | | | | | | | | This allows to use a one-character expression inside the 'if' statement and multiple spaces before the line continuation character. Fixes false positive in case like this: #define MACRO(ARG) \ if (a) { \ do_work(ARG); \ } Fixes: 16770c6d9179 ("checkpatch: support macro continuation") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Aaron Conole <aconole@redhat.com>
* checkpatch: Check FOR_EACH loops with numbers.Ilya Maximets2019-07-121-1/+1
| | | | | | | | | | | | | OVS has defines for loops like 'BITMAP_FOR_EACH_1' or 'ULLONG_FOR_EACH_1', but the regexp in checkpatch doesn't match with numbers and skips these loops while checking. This patch adds numbers into regexp and adds some FER_EACH loops to the unit tests. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* ovs-ofctl: New testing command "parse-group".Ben Pfaff2019-06-091-1/+40
| | | | | | | This will be used in an upcoming test. Acked-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* checkpatch: Ignore "sparse" headers.Ilya Maximets2019-05-291-0/+5
| | | | | Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Aaron Conole <aconole@redhat.com>
* ovs-save: Handle cases of upgrades from very old OVS versions.Gurucharan Shetty2019-05-091-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | We have added code to ovs-save over the last few releases which makes the following bad assumptions. 1. The default OpenFlow version of running daemon is OpenFlow14. Impact: This causes upgrades from older OVS versions to end up with no flows in their bridges (even the default 'NORMAL' ones) causing traffic to stop. 2. That ovs-ofctl commands like dump-groups and dump-tlv-map will just work with old OVS versions. Impact: Does not look like it effects the upgrade in a bad away - except you get some errors. Since OpenFlow14 was enabled by default in OVS 2.8, this commit makes a lazy assumption that any upgrade of OVS from versions before 2.7 will not attempt to save and restore flows. VMware-BZ: #2340482 Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>