From: Justin Pettit Date: Fri, 10 Sep 2010 21:20:49 +0000 (-0700) Subject: xenserver: Don't monitor external-ids until XAPI is up X-Git-Tag: v1.0.2~21 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=c22f712bb99bdcdd042ce0ffbf4f31fc5016109a xenserver: Don't monitor external-ids until XAPI is up monitor-external-ids can't complete all its tasks until XAPI is up. The daemon is usually started before XAPI, so it can miss events. This commit causes the daemon to block until XAPI is finished initializing. --- diff --git a/xenserver/usr_share_openvswitch_scripts_monitor-external-ids b/xenserver/usr_share_openvswitch_scripts_monitor-external-ids index c87171f06..f91801d22 100755 --- a/xenserver/usr_share_openvswitch_scripts_monitor-external-ids +++ b/xenserver/usr_share_openvswitch_scripts_monitor-external-ids @@ -21,9 +21,11 @@ # Bridge table and duplicates its value to the preferred "xs-network-uuids". import getopt +import os import subprocess import sys import syslog +import time import XenAPI @@ -189,6 +191,11 @@ def main(argv): idl = ovs.db.idl.Idl(remote, "Open_vSwitch", monitor_uuid_schema_cb) ovs.daemon.daemonize() + + # This daemon is usually started before XAPI, but to complete our + # tasks, we need it. Wait here until it's up. + while not os.path.exists("/var/run/xapi_init_complete.cookie"): + time.sleep(1) bridges = {} interfaces = {}