2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-29 15:28:56 +00:00
Commit Graph

283 Commits

Author SHA1 Message Date
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
Ben Pfaff
210374eb3d xenserver: Add "reload" and "force-reload" support to init script.
I can't easily find anything that documents what commands Fedora init
scripts should support, but many of them support "reload" and
"force-reload". This commit adds support for them to the XenServer init
scripts.  (The Debian init scripts already had support.)

Debian does document that reload and force-reload should be supported:
http://www.debian.org/doc/debian-policy/ch-opersys.html#s-writing-init

Reported-by: Reid Price <reid@nicira.com>
Bug #3266.
2010-08-02 15:21:27 -07:00
Ben Pfaff
f51c1d9890 xenserver: Kill bond slaves' dhclients when bringing up bond master.
This fixes the converse of the problem addressed by commit fe19e820
"xenserver: Kill bond master's dhclient when bringing up bond slave".  In
that commit's log message, I claimed that the converse was not a problem,
but I was wrong.  I must have screwed up in testing, because it really is
a problem.  This commit fixes it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Dominic Curran <dominic.curran@citrix.com>
Reported-by: Michael Mao <mmao@nicira.com>
Bug #2668.
2010-07-16 09:22:28 -07:00
Ben Pfaff
ab32de001f xenserver: Avoid errors from ovs-vsctl at system shutdown.
Commit 823c5699 "interface-reconfigure: callout to datapath backend class
method on rewrite" changed "interface-reconfigure rewrite" to update
bridge external-ids in the vswitch database.  But this had the side effect
of causing errors at system shutdown, since ovsdb-server gets shut down
before the rewrite action is called.  This commit fixes the problem by
skipping the update if the database socket does not exist.  (It's just
fine to skip the update, since the external-ids will be re-set the next
time the system boots anyhow.)

This commit fixed the problem on 5.6.810-34773p for me.  I don't see the
problem at all on 5.5.0.  Presumably system shutdown order has changed.

NIC-136.

CC: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2010-06-28 10:59:25 -07:00
Ben Pfaff
fe19e820e4 xenserver: Kill bond master's dhclient when bringing up bond slave.
interface-reconfigure is never explicitly called to down a bond master.
However, when it is called to up a slave it is implicit that we are
destroying the master.  The "bridge" version of interface-reconfigure
always "ifdown"s the bond master in such a case, but until now the
"vswitch" version has not done so.  Usually, it doesn't matter, because
the bond master network device disappears when the slave is brought up,
but one case was missed: for a bond master with an IP address obtained
via DHCP, the dhclient process needs to be killed, and we were not doing
it.  This commit starts doing it (by invoking ifdown on the bond master).

The dhclient process that hangs around doesn't cause problems until the
bond master is brought back up, at which point "ifup" fails because it
refuses to start another dhclient for the same interface.

The converse behavior is also important; that is, when a bond PIF is
brought up, interface-reconfigure is expected to implicitly take down its
slave PIFs.  My testing (on 5.5.0) shows that this behavior is already
correct.  At any rate, this commit does not change that behavior.

Bug #2668.
Bug #2734.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2010-06-28 10:39:03 -07:00
Ian Campbell
a361c3a86a xenserver: Largely untested patch for 5.5 and 5.6 CHIN compatibility 2010-06-23 12:34:05 -07:00
Ian Campbell
92e906e484 interface-reconfigure: Handle CHIN Tunnel objects
Only the vswitch backend is able to implement CHIN.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-06-23 12:32:08 -07:00
Ben Pfaff
4959755dc8 xenserver: Delete network.conf on package removal on XenServer 5.5.0.
The previous commit "xenserver: Create network.conf before running
interface-reconfigure" fixed a problem that was not noticed earlier only
because we had not tested very often on pristine XenServer 5.5.0 systems,
instead mostly on systems that had had Open vSwitch installed before and
thus already had a network.conf file.  This commit should help to avoiding
future regressions in this area, by removing network.conf when the
openvswitch package is removed on XenServer 5.5.0.
2010-06-15 10:47:57 -07:00
Ben Pfaff
79c2379bf4 xenserver: Create network.conf before running interface-reconfigure.
XenServer 5.5.0 doesn't have /etc/xensource/network.conf, but the
interface-reconfigure that OVS installs issues an error and aborts if it
does not exist, so create network.conf before trying to run it.

CC: Paul Ingram <paul@nicira.com>
2010-06-15 10:47:57 -07:00
Ben Pfaff
5535f0bdf7 xenserver: Remove some ovs-xenserverd support that I missed.
Oops.  Must have been too giddy to look carefully the first time.

This time I'll test it before I push.
2010-06-09 10:16:39 -07:00
Justin Pettit
c6f196a050 xenserver: Don't complain for "bridge" network.conf value
Just silently don't start OVS daemons if /etc/xensource/network.conf
contains a value of "bridge".  This allows the init script to be called
regardless of whether OVS or bridge is configured.
2010-06-08 12:53:46 -07:00
Justin Pettit
697e8aa22f xenserver: Don't start OVS if network.conf isn't "openvswitch"
The OVS processes would start as long as "/etc/xensource/network.conf"
didn't contain "bridge".  The other OVS scripts, however, would complain
(and not run) if it wasn't "vswitch" or "openvswitch".  This commit will
only start the OVS processes if a value of "vswitch" or "openvswitch" is
present, so some consistency is provided.

(If "/etc/xensource/network.conf" is not "bridge", "vswitch", or
"openvswitch", then XAPI will refuse to run anyway, so not much is going
to happen on the system.)
2010-06-08 10:55:07 -07:00
Ben Pfaff
05a35b5749 xenserver: Get rid of ovs-xenserverd.
This is no longer used.  Good riddance.
2010-06-08 10:31:37 -07:00
Ben Pfaff
bacd209169 xenserver: Ditch ovs-xenserverd even on XenServer 5.5.0.
Examining the XAPI source code shows that at startup it invokes a script
named /opt/xensource/libexec/xapi-startup-script, if one exists.  Testing
shows that this was also true in XenServer 5.5.0.  No such script is
installed by default.  Searching for "xapi-startup-script" on Google (with
the quotes) has only one hit, which is documentation on XAPI startup.  So
it seems that we're pretty safe in taking advantage of this hook ourselves.

This commit changes the RPM scripts to install refresh-network-uuids as
the XAPI startup hook on XenServer 5.5.0.

CC: Rob Hoes <rob.hoes@citrix.com>
2010-06-08 10:31:37 -07:00
Ben Pfaff
22f7fdb621 xenserver: Make refresh-network-uuids use "interface-reconfigure rewrite".
Commit 823c5699 "interface-reconfigure: callout to datapath backend class
method on rewrite" changed "interface-reconfigure write" to do what
refresh-network-uuids does.  We can't entirely get rid of
refresh-network-uuids, so this commit rewrites it as a trivial wrapper
around interface-reconfigure.
2010-06-08 10:31:37 -07:00
Ian Campbell
9575eae372 xenserver: call "interface-reconfigure rewrite" instead of refresh-network-uuids
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-06-04 10:21:27 -07:00
Ian Campbell
823c5699d4 interface-reconfigure: callout to datapath backend class method on rewrite
Use this mechanism to allow the vswitch backend to update the vswitch
configuration's mapping from datapath to XenAPI datamodel Network
UUIDs. The vswitch needs a mechanism to update these when they change
(i.e. on pool join and eject).

Refactor the DatapathFactory method to return the class which the
caller can instantiate or not as the require.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-06-04 10:20:36 -07:00
Ben Pfaff
169e3808f7 ovs-xenserverd: Fix time-delay logic.
network_uuid_refresh_run() needs to update pool_conf_mtime as soon as it
notices a change.  Otherwise it thinks that the mtime has changed every
time it is called and therefore never actually runs the refresh script.

Bug #2097.
2010-06-04 10:10:03 -07:00
Ben Pfaff
bc31db1fef xenserver: Update network UUIDs whenever XAPI restarts.
XAPI calls the "update" method of the vswitch-cfg-update plugin whenever it
starts or restarts.  Thus, this is a good place to trigger updating network
UUIDs.  This commit implements that behavior.  This should fix the problem
of network UUIDs not being updated on pool join, since XAPI restarts when
it joins a pool.

When XenServer 5.5 support is no longer interesting, we should integrate
the refresh-network-uuids script into the XAPI plugin.

Lightly tested, works for me on 5.6.810-31078p.

See-also: http://openvswitch.org/pipermail/dev_openvswitch.org/2010-June/002216.html
Suggested-by: Rob Hoes <rob.hoes@citrix.com>
Bug #2097.
2010-06-04 10:02:15 -07:00
Ian Campbell
b33c0ddb28 xenserver: make ovs-xenserverd startup configurable and disable it for 5.6.0 onwards.
In my testing with XenServer 5.6.810 without ovs-xenserverd the
vswitch bridge external-id network-uuid field was always kept up to
date over both pool join and pool eject. I believe this is because
xapi is restarted on both pool join and pool eject and on restart all
PIFs are plugged again. This causes the vswitch field to be updated,
either via a call to interface reconfigure or via an explicit
ovs-vsctl call in the case of internal networks.

I think the only reason this daemon would still be required with
XenServer 5.5 is that the explicit call to ovs-vsctl for internl
networks is not present there.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-06-03 09:45:11 -07:00
Ben Pfaff
7cf8b2660f poll-loop: New function poll_timer_wait_until().
Many of poll_timer_wait()'s callers actually want to wait until a specific
time, so it's convenient for them to offer a function that does this.
2010-05-26 11:46:59 -07:00
Jesse Gross
2158888d8d patch: Remove veth driver.
Now that we have a new patch implementation, remove the veth driver
and its userspace components.  Then rename 'patchnew' to 'patch'.
The new implementation is a drop-in replacement for the old one.
2010-05-18 12:57:25 -07:00
Ben Pfaff
0313fb2e2f xenserver: Make Open vSwitch disable itself in "bridge" mode.
When /etc/xensource/network.conf contains the word "bridge", the system
is supposed to use the Linux bridge, not Open vSwitch.  This commit makes
OVS honor this setting, which until now it has mainly ignored.

Reported-by: Reid Price <reid@nicira.com>
2010-05-04 10:20:58 -07:00
Ben Pfaff
3bcf3e33e9 xenserverd: Give XAPI a grace period before refreshing network UUIDs.
XAPI updates the pool.conf file before it actually refreshes its database
from the new pool, so we need to wait for that to happen.  Hard-coded
delays aren't a good idea, but in the long term XAPI will probably be
adding a hook script for us to use, so this may be an OK stopgap measure.

Bug #2756.
2010-05-01 14:27:53 -07:00
Justin Pettit
59a81d8290 xenserver: Wire up emergency reset plug-in and call it on manager change
Add code to "emergency_reset" plug-in method to actually do its work.
Also, when the manager is changed, call the emergency reset command to
clear out any configuration that may have been done by a previous
controller.
2010-04-30 16:53:29 -07:00
Ben Pfaff
1f256c11cd xenserver: Use start_daemon for xenserverd also in /etc/init.d/openvswitch.
Reported-by: Justin Pettit <jpettit@nicira.com>
2010-04-27 09:37:06 -07:00
Ben Pfaff
b1cd4308bc xenserver: Report correct daemon names at startup in /etc/init.d/openvswitch.
Reported-by: Justin Pettit <jpettit@nicira.com>
2010-04-27 09:36:30 -07:00
Ben Pfaff
9cad684489 xenserver: Use daemon-specific dir for pidfile in /etc/init.d/openvswitch.
Reported-by: Justin Pettit <jpettit@nicira.com>
2010-04-27 09:35:45 -07:00
Ben Pfaff
e7eacf16f5 xenserver: Avoid using unset $nice variable in /etc/init.d/openvswitch.
Reported-by: Justin Pettit <jpettit@nicira.com>
2010-04-27 09:35:03 -07:00
Justin Pettit
070644563c xenserver: Fix typo in prompt 2010-04-26 16:42:05 -07:00
Ben Pfaff
55e1991904 xenserver: Factor redundancy out of /etc/init.d/openvswitch.
We probably have too many configuration variables in any case, but at least
we can use just one shell function to deal with them.
2010-04-26 16:41:35 -07:00
Ben Pfaff
2e8a4c31ab xenserver: Gracefully refresh network UUIDs on pool join or leave.
The vswitch database is supposed to maintain an up-to-date UUID for the
system's networks in the Bridge table as external-ids:network-uuids.  On
XenServer systems, /opt/xensource/libexec/interface-reconfigure updates
these fields as bridges are brought up and down.  Most of the time, that is
sufficient.  However, this is one exception: when a XenServer host enters
or leaves a pool, interface-reconfigure is not invoked, and neither is any
other script.  So this commit introduces a new, XenServer-specific daemon
that monitors the XenServer's pool membership status and refreshes the
network UUIDs (by invoking the refresh-network-uuids script) if it changes.

Bug #2097.
2010-04-26 16:41:35 -07:00
Ben Pfaff
d799ae067f xenserver: Fix sense of -d test in /etc/init.d/openvswitch.
It doesn't make sense to create a directory if it already exists.
2010-04-26 13:12:35 -07:00
Ben Pfaff
3b3289fcb9 xenserver: Rewrite refresh-network-uuids script for decent performance.
Calling "interface-reconfigure up" can take a couple of seconds, but all
we have to do here, really, is fetch the network UUIDs and invoke
ovs-vsctl, which is much faster.  So rewrite this script in Python and make
it do just that.
2010-04-26 11:29:32 -07:00
Justin Pettit
291a0f6b6e xenserver: Clean-up space/tabs issues in vif script
Our vif script had a mishmash of tab and space indentations.  The
original vif script only uses spaces, so I went with that style.
2010-04-21 04:08:23 -07:00
Justin Pettit
79eb8b002c xenserver: Set internal network-uuids in Bridge table on XS5.5
On XenServer 5.5, interface-reconfigure is not called when creating
internal bridges, so we jump through extra hoops to determine the
network UUIDs.  The code that handled this was not properly retrieving
the UUIDs from XAPI, so the field would never be set.  This commit
corrects that.

Bug #2666
2010-04-21 04:08:23 -07:00
Ben Pfaff
b9e09a071d xenserver: Restore original InterfaceReconfigure*.py on uninstall.
The %post script fragment in the RPM spec was moving aside the original
InterfaceReconfigure{,Bridge,Vswitch}.py scripts, but the %postun was
not restoring them.  This commit restores them in %postun.

Without this change, installing the openvswitch RPM on a stock XenServer
and then uninstalling it breaks XenServer networking.

Bug #2624.
Reported-by: Ram Jothikumar <rjothikumar@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2010-04-19 11:40:32 -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
50b2ad57cb xenserver: Fix name of veth module so it can be loaded on startup 2010-04-15 07:39:02 -07:00
Justin Pettit
4dcf0d73c2 xenserver: Load veth driver on 2.6.18 systems
In a future commit, the "patch" netdev type will be introduced.  The
initial implementation will be based on veth, for which we have a kernel
module on 2.6.18.  A more general solution will be used in the future,
at which time, this loading of the veth module can be removed.
2010-04-14 20:53:16 -07:00
Justin Pettit
9888b1b43b xenserver: Fix ip_gre_mod modprobe issue in init script
The OVS kernel modules were moved to kernel/extra/openvswitch, but the
init script wasn't updated to look for the ip_gre_mod kernel module
there.  This commit fixes that.

CC: Paul Ingram <paul@nicira.com>
2010-04-12 13:12:34 -07:00
Justin Pettit
8085488086 xenserver: Allow use first class datamodel field for controller IP
Starting in XenServer 5.6.0, a "vswitch_controller" key is available to
store the controller's IP address in the "pool" table of XAPI.  Older
versions must still use the "vSwitchController" key in "other_config".

Based on commits 37fee7 and 0ebd737 from the xs5.7 branch written by
Ian Campbell.
2010-04-12 12:39:45 -07:00
Justin Pettit
a7de953d18 xenserver: Only register xsconsole plugin if OVS is running
The 5.6.0 XenServer release will include OVS but not have it enabled by
default.  By only registering the xsconsole plugin on systems running OVS,
this plugin can be included in the main distribution.

Based on commit 0ebd737 from the xs5.7 branch written by Ian Campbell.
2010-04-12 12:39:45 -07:00
Justin Pettit
9d73e170da xenserver: Do not raise XenAPIPlugin.Failure in xsconsole plugin
Do not raise XenAPIPlugin.Failure, it is not an exception xsconsole will
handle.

Based on commit fcc495 from the xs5.7 branch written by Ian Campbell.
2010-04-12 12:39:45 -07:00
Justin Pettit
cf624c5f09 xenserver: Put kernel modules in "extra" directory
This change cleans up a couple of items.  First, it makes sure that our
newly installed kernel modules are picked up instead of any ones that
shipped with XenServer.  Second, it prevents having to do the install
with "--nodeps".
2010-04-08 09:51:44 -07:00
Ian Campbell
aeb2b7a166 interface-reconfigure+vif: accept openvswitch in /etc/xensource/network.conf
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-04-08 09:39:36 -07:00
Justin Pettit
1981102e61 xenserver: Remove stray "\" in spec file 2010-04-06 13:46:27 -07:00
Justin Pettit
b31ac77a39 xenserver: Don't install xsconsole plugin as symlink
The OVS xsconsole plugin used to be installed in
/usr/share/openvswitch/scripts directory and then a symlink was created
to the /usr/lib/xsconsole/plugins-base directory.  The Citrix packaging of
OVS just placed it directly into the xsconsole plugin directory.  This
worked fine until we renamed our package "openvswitch", which is the
same as Citrix uses.

On an upgrade, the default package handler would attempt to clean up files
that were in the Cirix packaging, but not in the upgraded package.  Since
it didn't know that we had replaced their plugin with our symlink, it would
destroy our symlink.

This commit just places the plugin directly into the
/usr/lib/xsconsole/plugins-base directory, which allows us to seamlessly
upgrade to newer Open vSwitch versions.

Bug #2608
2010-04-05 21:26:55 -07:00
Justin Pettit
4e39950c21 xenserver: Minor spec file cleanups
Remove compiled InterfaceReconfigure byte code on uninstall.  Also, fix
minor typo in error message.
2010-04-05 18:20:15 -07:00
Justin Pettit
22342ac881 xenserver: Only rotate files that end in .log 2010-04-05 18:19:33 -07:00