;;
reload|force-reload)
# The main OVS daemons keep up-to-date, but ovs-xapi-sync needs help.
- pidfile=/var/run/openvswitch/ovs-xapi-sync.pid
- if test -e "$pidfile"; then
- pid=`cat "$pidfile"`
- action "Configuring Open vSwitch external IDs" kill -HUP $pid
+ if daemon_is_running ovs-xapi-sync; then
+ action "Configuring Open vSwitch external IDs" \
+ ovs-appctl -t ovs-xapi-sync flush-cache
fi
;;
status)
import argparse
import os
-import signal
import sys
import time
vlog = ovs.vlog.Vlog("ovs-xapi-sync")
session = None
-force_run = False
+flush_cache = False
exiting = False
conn.reply(None)
+def unixctl_flush_cache(conn, unused_argv, unused_aux):
+ global flush_cache
+ flush_cache = True
+ conn.reply(None)
+
+
# Set up a session to interact with XAPI.
#
# On system start-up, OVS comes up before XAPI, so we can't log into the
schema.tables = new_tables
-def handler(signum, _):
- global force_run
- if (signum == signal.SIGHUP):
- force_run = True
-
-
def main():
- global force_run
+ global flush_cache
parser = argparse.ArgumentParser()
parser.add_argument("database", metavar="DATABASE",
ovs.daemon.daemonize()
ovs.unixctl.command_register("exit", "", 0, 0, unixctl_exit, None)
+ ovs.unixctl.command_register("flush-cache", "", 0, 0, unixctl_flush_cache,
+ None)
error, unixctl_server = ovs.unixctl.UnixctlServer.create(None)
if error:
ovs.util.ovs_fatal(error, "could not create unixctl server", vlog)
while not os.path.exists(cookie_file):
time.sleep(1)
- signal.signal(signal.SIGHUP, handler)
-
bridges = {} # Map from bridge name to nicira-bridge-id
iface_ids = {} # Map from xs-vif-uuid to iface-id
vm_ids = {} # Map from xs-vm-uuid to vm-id
break;
idl.run()
- if not force_run and seqno == idl.change_seqno:
+ if not flush_cache and seqno == idl.change_seqno:
poller = ovs.poller.Poller()
unixctl_server.wait(poller)
idl.wait(poller)
poller.block()
continue
- if force_run:
- vlog.info("Forced to re-run as the result of a SIGHUP")
+ if flush_cache:
+ vlog.info("Flushing cache as the result of unixctl.")
bridges = {}
iface_ids = {}
vm_ids = {}
- force_run = False
+ flush_cache = False
seqno = idl.change_seqno
txn = ovs.db.idl.Transaction(idl)