2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 05:18:13 +00:00

62 Commits

Author SHA1 Message Date
Frode Nordahl
9990322610 debian: Update packaging source from Debian/Ubuntu.
* Update upstream OVS debian packaging to be on par with package
  source in Debian/Ubuntu:
  - Provide a openvswitch-switch-dpdk package that integrates with
    the dpdk package in the distributions so that end users can opt
    into a DPDK-enabled Open vSwitch binary.
  - Provide systemd service files.
  - Provide openvswitch-source package for reproducible integrated
    build of for example OVN.
  - Stop building shared library and subsequently remove
    libopenvswitch and libopenvswitch-dev binary packages.

Co-authored-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Luca Boccassi <bluca@debian.org>
Co-authored-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Co-authored-by: James Page <james.page@ubuntu.com>
Signed-off-by: James Page <james.page@ubuntu.com>
Co-authored-by: Corey Bryant <corey.bryant@canonical.com>
Signed-off-by: Corey Bryant <corey.bryant@canonical.com>
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-07-15 13:45:55 +02:00
Frode Nordahl
02428f7151 debian: Archive debian packaging source.
The packaging source in the OVS repository has drifted away from
what is currently in Debian and Ubuntu.  This state is problematic
because from time to time someone tries to build packages from the
upstream OVS debian package source and then expect that package to
work with up-/down-grades from-/to/ distro versions.

To support the on-going work to remove the out of tree OVS kernel
driver from the repository [0], an update to the debian packaging
is also required.  On the back of the discussion in [0] we agreed
that replacing the current version with what Debian and Ubuntu
is currently converging on would be preferable.

This commit is a first in a series to update the upstream OVS
debian packaging source to be up to date with what is currently
in Debian and Ubuntu.

0: https://mail.openvswitch.org/pipermail/ovs-dev/2022-June/394634.html

Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-07-15 13:43:39 +02:00
Ben Pfaff
5a0e4aec1a treewide: Convert leading tabs to spaces.
It's always been OVS coding style to use spaces rather than tabs for
indentation, but some tabs have snuck in over time.  This commit converts
them to spaces.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2018-06-11 15:32:00 -07:00
Raymond Burkholder
15af3d44c6 debian: Add SYSTEMCTL_SKIP_REDIRECT to init files
Current versions of systemd in Debian Stretch use
SYSTEMCTL_SKIP_REDIRECT instead of _SYSTEMCTL_SKIP_REDIRECT.
Provide both variables in the .init files.

Signed-off-by: Raymond Burkholder <ray@oneunified.net>
Suggested-by: Guru Shetty <guru@ovn.org>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
2017-05-30 09:17:55 -07:00
Ben Pfaff
87530bc1c1 ovs-ctl: Remove code for upgrading from Open vSwitch 1.6 and earlier.
OVS 1.7 was released in July 2012, so by the time current OVS is released,
it will be almost four years old.  I think that this is long enough to
remove special upgrade code.

It's almost impossible to do this upgrade in any case since there is
no overlap in the base kernel versions supported by the out of tree
modules in the two versions (the only possibility is running the new
version of OVS on the upstream module from Linux 3.3).

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
2016-03-16 20:11:24 -07:00
Gurucharan Shetty
51386ba3c9 openvswitch-switch.init: Redirect error to /dev/null.
The latest Open vSwitch kernel module from Upstream linux does not
list "version". During debian package installation, we would see
a non-harmful error in the log. This patch suppresses it.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-01-05 11:40:57 -08:00
Gurucharan Shetty
873d85653d debian: Skip systemctl redirect.
After some experimentation on Ubuntu15.04, I see the
following behavior.

1. If you install openvswitch-switch with 'apt-get install',
then you automatically get a upstart and systemd config files
for openvswitch. The integration with 'interfaces' fails
because both the upstart and systemd jobs do not have logic
to handle it.

The above behavior will likely get fixed soon in upstream
Ubuntu.

2. If you install openvswitch-switch via the packages
created from the openvswitch repo, there is no systemd or
upstart conf files installed. But systemd notices this
and creates a runtime openvswitch conf file which does
nothing but call back the sysv startup script.

In the above case when you call
"/etc/init.d/openvswitch-switch start", it inturn calls
"/bin/systemctl start openvswitch-switch.service" and
that inturn again calls "/etc/init.d/openvswitch-switch start".
But the above for some reason simply hangs. It looks like a call
to ifup when invoked in this manner does not return.
I am not sure why this is happening.

We can avoid the above behavior completely by skipping the
systemctl redirect as done in this commit. This should fix
both 1. and 2. above.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2015-12-02 10:00:46 -08:00
Jan Vansteenkiste
2e601425c6 debian: Use ifquery for finding the interfaces in init script.
When using interfaces.d/<foobar>, interfaces are not picked up.
Let ifquery figure out the format of the interfaces files for us.

Signed-off-by: Jan Vansteenkiste <jan@vstone.eu>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-12-11 17:36:24 -08:00
Gurucharan Shetty
81e3044c10 debian: Don't depened on $RUNLEVEL at startup to create bridges.
Commit b2a0daa5bd (debian: Don't recreate bridges during manual restart.)
added a check on $RUNLEVEL to only create bridges and ports when the
system starts up. This fix does not work with systemd.

This commit uses a different approach to solve the same problem.

Reported-at: https://bugs.debian.org/686518
Reported-by: Philipp S. Schmidt <phils@in-panik.de>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Tested-by: Philipp S. Schmidt <phils@in-panik.de>
2014-09-12 09:18:06 -07:00
Gurucharan Shetty
b2a0daa5bd debian: Don't recreate bridges during manual restart.
Open vSwitch bridges and ports can be configured through
the /etc/network/interfaces script. During system startup,
Open vSwitch startup script reads the interfaces file
and creates the bridges and ports. During system shutdown,
the bridges and ports are removed.

The same behavior also can occur with a manual 'restart' of
Open vswitch (ex: service openvswitch-switch restart).
This behavior has come across as undesirable in some cases.
ex: When some one manually creates interfaces through ovs-vsctl
and then restarts Open vSwitch, that interface is lost.

This commit changes the startup script such that, interfaces
are created and deleted through the startup script only when
RUNLEVEL environment variable is set. This behavior will be
consistent with the OVS RHEL ifcfg-* scripts too.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2013-11-22 08:07:18 -08:00
Gurucharan Shetty
19cbf2b8a4 debian: force-reload-kmod while package upgrading.
Currently, when we upgrade openvswitch packages, we do a restart
of userspace daemons automatically. This does not replace the
kernel module.

But almost everytime, we want to use the new kernel module
that comes with the new version. This means that we need to
manually do a "force-reload-kmod". This step, reloads the
kernel module and also restarts the userspace daemons. This gives
us a total of two restarts of userspace daemons. This is quite
expensive in a hypervisor with hundreds of VMs sending real traffic.
This also hurts the controller as it gets two reconnections in a short
amount of time.

With this patch, during a package upgrade, if the kernel module
on disk is different than the one that is loaded, we will
automatically do a force-reload-kmod while openvswitch-switch
is installed. If not, we will just do a "restart" like before.

One can install the kernel package first and then install the userspace
packages in 2 separate steps to enforce a single 'force-reload-kmod'.

If anyone wants to just restart the userspace package instead of
force-reload-kmod, they can set the value of OVS_FORCE_RELOAD_KMOD=no
while installing the package.
Ex: OVS_FORCE_RELOAD_KMOD=no dpkg -i openvswitch-switch*

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
2013-04-23 09:00:13 -07:00
Gurucharan Shetty
46528f78e5 debian, rhel, xenserver: Ability to collect ovs-ctl logs.
We use ovs-ctl from startup scripts to start, stop, restart,
force-reload-kmod OVS daemons. ovs-ctl gives quite a descriptive
o/p while running the above commands. But the o/p goes to stdout.
Sometimes, this output is quite useful to debug issues.

With this patch, we store the o/p of ovs-ctl when called from
startup scripts in /var/log/openvswitch/ovs-ctl.log

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
2013-03-15 09:16:13 -07:00
Pravin B Shelar
5ca1ba484b openvswitch: Remove Linux bridge compatibility.
Currently brcompat does not work on master due to recent
datapath changes. We have decided to remove it as it is
not used very widely.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2012-12-27 13:48:51 -08:00
Gurucharan Shetty
1d63efc45b debian: Integrate interfaces config with OVS startup script.
Currently, there is an option to use the /etc/network/interfaces
file to configure Open vSwitch bridges and ports. To create and
destroy bridges, one has to manually run the following commands.

ifup --allow=ovs $list_of_bridges
ifdown --allow=ovs $list_of_bridges

This commit will automatically run the above two commands when
the system boots up and shuts down respectively through the
OVS startup script.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
2012-12-27 09:53:20 -08:00
Gurucharan Shetty
aad12c5f8f xenserver, rhel, debian: Use ovs-ctl restart.
ovs-ctl has a new command called "restart" which
saves and restores the openflow flows on bridges.
Use that command from the init scripts when doing
a "restart --save-flows=yes".

Also, the debian package postinst script can
set the variable OVS_RESTART_SAVE_FLOWS to "yes"
to ask for save and restore of flows.

Feature #13555.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
2012-10-24 16:43:38 -07:00
Ben Pfaff
c50c79431e debian: Do not change iptables rules by default.
Debian kernel maintainer Bastian Blank writes, at
http://bugs.debian.org/680537:

   The netfilter rules are a shared resource. There is no synchronization,
   so the admin have the last word. As kernel maintainer, I see it similar
   to a configuration file, so §10.7 policy applies.

   The purpose of openvswitch is to provide support for switching, not to
   setup filter rules. This means it violates the principle of least
   surprise.

I believe that the argument by analogy to configuration files is weak,
given that the Debian policy section in question is very specifically about
files, not about general principles.  On the other hand, Debian does not
install any firewall by default, so the presence of a rule that blocks GRE
traffic is a sign that the administrator has taken an explicit action to
install a firewall that blocks GRE, and therefore it is rather rude to
override this.  Therefore, this patch simply turns off this behavior on
Debian, given that in ordinary Debian installations it will have no
adverse effect on Open vSwitch.

Debian bug #680537.
CC: 680537@bugs.debian.org
Reported-by: Bastian Blank <waldi@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
2012-07-18 10:23:32 -07:00
Ben Pfaff
f4d458c550 debian: Enable passing extra options to ovs-ctl from init scripts.
This is useful for passing wrapper script options and possibly for other
purposes.

Bug #11889.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-06-15 09:36:20 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc.

Feature #10593
Signed-off-by: Raju Subramanian <rsubramanian@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-02 17:08:02 -07:00
Ben Pfaff
8a5b3cfd91 debian: Use a different way to avoid failing install without kernel module.
The dh_installinit --error-handler option makes a lot of sense, but after
playing with it for a while I could not figure out a nice way to use it
only for openvswitch-switch without either duplicating the dh_installinit
fragments in postinst and prerm (the actual bug that was reported) or
omitting them for some package.

Also, we forgot to write the error handler function for the prerm.

This commit switches to a different way to avoid failing the install when
the kernel module is not available, without using --error-handler.

CC: 663051@bugs.debian.org
Reported-by: Thomas Goirand <zigo@debian.org>
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-16 14:18:05 -07:00
Thomas Goirand
1db6b18507 debian: Add long descriptions for init scripts.
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-12 09:50:23 -07:00
Ben Pfaff
5e0c05bc05 debian: Fix exit status of openvswitch-switch init script "status" command.
The init script ends with an explicit "exit 0" so nonzero exit codes from
"ovs-ctl status" were being lost.

Bug #9714.
Reported-by: Paul Ingram <paul@nicira.com>
CC: Sujatha Shetty <sshetty@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-28 17:10:08 -08:00
Chris Wright
d422c11899 utilites: rename ovs-lib.sh to ovs-lib
Rename this helper script to simply ovs-lib, since it's primarily
a library of helper functions.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-12-09 09:32:06 -08:00
Simon Horman
64624b3cf4 Debian: fail gracefully if modules can't be loaded on install
By registering an error-handler for the init script used
in openvswitch-switch.postinst and detecting if module insertion fails,
it is possible to avoid failure to install in the case where the
openvswitch_mod module is not available.

This is done without altering the behaviour that the start target
of the openvswitch-switch init script will fail if module insertion fails.

This patch also adds a friendly hint as as to why starting
openvswitch-switch has failed if it is due to failure to insert
the openvswtich_mod. This message is displayed as necessary both
on package install and other calls to the start target of the
init script.

[Ben Pfaff fixed up == to = in postinst]
2011-09-12 09:31:18 -07:00
Justin Pettit
733a287e17 debian: Fix path for ovsdb-server in init script.
Reported-by: Brad Hall <brad@nicira.com>
2011-08-01 10:44:41 -07:00
Ben Pfaff
9fc47ed759 debian: Add support for bridge compatibility.
This adds support for bridge compatibility to the generic Open vSwitch
init scripts and to the Debian packaging.

See https://bugs.launchpad.net/ubuntu/+source/openvswitch/+bug/808224.
2011-07-26 10:37:28 -07:00
Ben Pfaff
b3a375f242 Avoid inserting duplicate iptables rules when restarting vswitch.
On startup, some OVS initscripts insert an iptables rule to allow GRE
traffic (because GRE support is an important OVS feature).  I noticed that,
each time I restarted OVS, this added another GRE-related rule to the
iptables chain.  This is wasteful, because each additional rule increases
the time it takes to process a packet in the IP stack.

This commit avoids the problem by inserting an iptables rule when there
isn't already an appropriate rule.  It also avoids inserting an iptables
rule if the iptables policy is ACCEPT, meaning that packets are accepted
by default; in such a case, if the GRE packet would be dropped, it is
because the system administrator made that decision explicitly.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-06-21 16:40:44 -07:00
Ben Pfaff
5ae616d638 Fix force-reload-kmod initscript command implementations.
I screwed this up in the recent conversion.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-06-20 11:46:52 -07:00
Ben Pfaff
5e77fcd36b Fix typo in "--force-corefiles" and "force-reload-kmod".
Reported-by: Andrew Evans <aevans@nicira.com>
2011-06-17 13:51:51 -07:00
Ben Pfaff
43bb5f82ec Refactor initscripts into distro-independent and distro-specific pieces.
This should make it easier to add OVS support to new distributions.
2011-06-17 12:53:52 -07:00
Ben Pfaff
c5f341ab19 ovsdb: Implement garbage collection. 2011-03-10 11:24:00 -08:00
Andrew Evans
289df16d29 ovsdb: Remove 'managers' column from 'Open vSwitch' table.
We had retained but deprecated the use of the older 'managers' column in the
'Open vSwitch' table for compatibility with applications that might still use
it, but that created more problems than it solved. This commit removes the
'managers' column from the schema, and removes all references to it from the
code, init scripts, documentation, and tests.
2011-02-18 11:09:29 -08:00
Ben Pfaff
f8186f2c81 Avoid unneeded database compaction at startup, and improve backups.
Until now, Open vSwitch "start" has always converted the database to the
current database schema.  This compacts the database, which as a side
effect throws away useful information about the transactions that were
executed to bring the database into its current state.  This can make
debugging database-related problems more difficult.

This commit changes the "start" command to only convert the database if
the database schema has changed.  It also adds the database checksum to
the backup file name, to avoid overwriting backups in the case where the
checksum changed but the developer neglected to update the version number.

I tested an earlier version of the xenserver changes but not any version
of the Debian changes.
2011-02-15 12:24:29 -08:00
Justin Pettit
78a04c9fc2 debian: Store more system information in OVSDB.
Store the OVS version in OVSDB.  Additionally, if the "lsb_release"
command is available, store information about the system type and
version.

Bug #4576
2011-02-07 13:43:42 -08:00
Justin Pettit
00a42f740f debian: Backup OVSDB db file before converting it.
The XenServer init script makes a backup before converting the OVSDB
database file.  This may be useful for debugging, so do the same on
Debian.  Also, store the schema version in the database.
2011-02-06 16:50:18 -08:00
Andrew Evans
bfd0c03968 Debian: Make ovsdb-server use manager_options column to find managers. 2011-02-02 10:30:09 -08:00
Justin Pettit
e39da21033 debian: Remove extra space in switch init script. 2011-01-28 18:51:31 -08:00
Sajjad Lateef
5f906046c2 Create /etc/openvswitch dir when package is installed.
Earlier, the /etc/openvswitch directory would get installed as part of
the init script's start sequence. However, as newer packages are added,
including some that create files in this directory during their init
script sequences, a race condition may occur.

This change ensures that the directory /etc/openvswitch is created even
before the init scripts execute. Thus, the race condition is avoided.
2010-10-15 13:41:46 -07:00
Simon Horman
f3c51ad9cc debian: Make the init script's start command idempotent
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2010-10-13 15:22:13 -07:00
Justin Pettit
9704460403 debian: Use DODTIME instead of DIETIME in init scripts
Brad pointed out that openvswitch-ipsec init script defined the variable
DIETIME but attempted to use it as DODTIME.  This commit uses DODTIME,
since it's the name used by the openvswitch-switch init script.  The
openvswitch-controller init script had the same issue.

As suggested by Ben, the "s" suffixes are removed from sleep commands,
since they are a GNU extension.

Reported-by: Brad Hall <brad@nicira.com>
2010-09-23 18:21:31 -07:00
Simon Horman
b9ddc6aaae debian: Dont fail init if module cant be inserted
The problem here is that the daemon is started/restarted on
package installation, but the module may not be present at that
time and (as far as I know) its bad form to fail the package installation
in that circumstance.

In keeping with the way ipvsadm handles a similar problem,
exit with a non-error exit status if the module can't be inserted.
The loud error message is still displayed.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2010-09-21 10:39:31 -07:00
Ben Pfaff
6b7b9d34c0 ovs-vsctl: Remove default timeout.
On overloaded XenServers the current default timeout of 5 seconds can
occasionally be reached, which causes VM startup to fail.  This commit
fixes the problem by removing the default timeout and changing each
invocation of ovs-vsctl within the tree to specify its own timeout,
if appropriate.

Bug #3573.
2010-09-17 14:37:51 -07:00
Ethan Jackson
7ac60147cd debian: Init script should put core dumps in an appropriate place
Before this commit the init script did not change the cwd of
openvswitch processes it started.  Thus, core files were created in
root directory.  This patch changes the cwd of openvswitch to
a more reasonable location.
2010-09-15 04:51:40 -07:00
Ben Pfaff
2cc906419f Wait for daemons to die in init.d script "stop" commands.
Sometimes it takes a moment for the OVS daemons to die.  When that happens,
the "start" half of "openvswitch restart" can fail when ovsdb-tool
runs, because ovsdb-server will still have the lock on the database if it
has not exited yet.  So this commit just makes the "stop" half wait for
the daemons to really die.

Bug #3369.
2010-08-12 11:15:20 -07:00
Justin Pettit
366d78fd92 debian: Correct naming in init scripts
A number of the init scripts assumed that the package name was the same
as the binary, which is not always true.  This fixes those issues as
well as some incorrect names in usage messages.

Reported-by: Ram Jothikumar <rjothikumar@nicira.com>
2010-06-28 14:14:08 -07:00
Jesse Gross
6f643e4946 tunneling: Remove old GRE implementation.
The new GRE implementation provides a complete drop in replacement
for the old Linux based implementation.  Therefore, remove the
old implementation and rename "grenew" to "gre".
2010-04-19 09:11:58 -04:00
Justin Pettit
9b094b09bd debian: Add $remote_fs to Required-Start/-Stop field in init scripts
Init scripts that depend on items in /usr must have $remote_fs defined
in their Required-Start and Required-Stop fields.  This will ensure that
/usr is mounted before a start or stop call is made.

Found by Lintian.
2010-03-31 23:14:04 -07:00
Justin Pettit
24e81092a1 debian: Bring Debian packaging in-line with new file locations
This commit brings the Debian packaging in-line with the similar changes
that were made to XenServer in commit bc39196.
2010-03-31 23:14:00 -07:00
Justin Pettit
bc39196036 Cleanup default file locations and XenServer packaging
This commit cleans up the locations of a number of files and directories
used.  These include:

    - Config file lives in /etc/openvswitch/conf.db
    - Logs go into /var/log/openvswitch
    - ovsdb-server socket is /var/run/openvswitch/db.sock
    - Schema goes into /usr/share/openvswitch/vswitch.ovsschema
    - PID files go in /var/run/openvswitch

For XenServer, these additional changes are made:

    - Cores go in /var/xen/openvswitch
    - OVS binaries run in /var/xen/openvswitch

In addition, it attempts to cleanup the XenServer packaging.  This
includes referring to the project as "openvswitch" as opposed to the
somewhat presumptuous "vswitch".

Note: Changes to the Debian packaging will be forthcoming.
2010-03-26 14:40:31 -07:00
Ben Pfaff
78876719e0 ovsdb-server: Obtain SSL configuration from database.
ovsdb-server should be able to obtain its SSL configuration from the
database that it is serving out, instead of having to specify it on the
command line.  This commit makes it so.
2010-03-19 16:47:11 -07:00
Ben Pfaff
f479c2f42b debian: Upgrade database before starting ovsdb-server.
The XenServer init script has been upgrading the database before starting
ovsdb-server for some time now, but the corresponding change was never
made to the Debian init script.  This commit fixes that.
2010-03-17 11:02:41 -07:00