Specifically for the case, where we know that a bridge record should exist in xapi, if we don't get any bridge records, log the failure and retry again later.
Signed-off-by: Gurucharan Shetty <gshe...@nicira.com> --- .../usr_share_openvswitch_scripts_ovs-xapi-sync | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync index 0633cbb..1622c18 100755 --- a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync +++ b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync @@ -103,15 +103,21 @@ def get_single_bridge_id(bridge_ids, br_name, default=None): xapi_down = True return default + # By default, the "bridge-id" external id in the Bridge table is the # same as "xs-network-uuids". This may be overridden by defining a # "nicira-bridge-id" key in the "other_config" field of the network # record of XAPI. If nicira-bridge-id is undefined returns default. # On error returns None. def get_bridge_id(br_name, default=None): + global xapi_down + rec = get_network_by_bridge(br_name) if rec: return rec['other_config'].get('nicira-bridge-id', default) + + vlog.warn("Failed to get Xapi record for %s." %(br_name)) + xapi_down = True return None @@ -185,8 +191,12 @@ def set_external_id(row, key, value): # XenServer does not call interface-reconfigure on internal networks, # which is where the fail-mode would normally be set. def update_fail_mode(row): + global xapi_down + rec = get_network_by_bridge(row.name) if not rec: + vlog.warn("Failed to get Xapi record for %s." %(row.name)) + xapi_down = True return fail_mode = rec['other_config'].get('vswitch-controller-fail-mode') @@ -207,8 +217,12 @@ def update_fail_mode(row): def update_in_band_mgmt(row): + global xapi_down + rec = get_network_by_bridge(row.name) if not rec: + vlog.warn("Failed to get Xapi record for %s." %(row.name)) + xapi_down = True return dib = rec['other_config'].get('vswitch-disable-in-band') @@ -299,9 +313,11 @@ def main(): # Configure the new bridge. update_fail_mode(row) update_in_band_mgmt(row) - # Get the correct bridge_id, if we can. bridge_id = get_bridge_id(row.name) + if xapi_down: + # Try again later. + continue if bridge_id is None: xs_network_uuids = row.external_ids.get("xs-network-uuids") if xs_network_uuids: -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev