~james-page/ubuntu/saucy/openvswitch/1.12-snapshot

« back to all changes in this revision

Viewing changes to xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync

  • Committer: James Page
  • Date: 2013-08-21 10:16:57 UTC
  • mfrom: (1.1.20)
  • Revision ID: james.page@canonical.com-20130821101657-3o0z0qeiv5zkwlzi
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
 
# Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
 
2
# Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
3
3
#
4
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
5
# you may not use this file except in compliance with the License.
294
294
 
295
295
        new_bridges = {}
296
296
        for row in idl.tables["Bridge"].rows.itervalues():
297
 
            if row.name in bridges:
298
 
                bridge_id_cache = bridges[row.name]
299
 
            else:
300
 
                # New bridge.
 
297
            bridge_id = bridges.get(row.name)
 
298
            if bridge_id is None:
 
299
                # Configure the new bridge.
301
300
                update_fail_mode(row)
302
301
                update_in_band_mgmt(row)
303
 
                bridge_id_cache = get_bridge_id(row.name)
304
302
 
305
 
            bridge_id = bridge_id_cache
306
 
            if bridge_id is None:
307
 
                bridge_id = row.external_ids.get("xs-network-uuids")
308
 
                if bridge_id and len(bridge_id.split(";")) > 1:
309
 
                    bridge_ids = bridge_id.split(";")
310
 
                    bridge_id = get_single_bridge_id(bridge_ids, row.name, "")
311
 
                if bridge_id:
312
 
                    bridge_id_cache = bridge_id
 
303
                # Get the correct bridge_id, if we can.
 
304
                bridge_id = get_bridge_id(row.name)
 
305
                if bridge_id is None:
 
306
                    xs_network_uuids = row.external_ids.get("xs-network-uuids")
 
307
                    if xs_network_uuids:
 
308
                        bridge_ids = xs_network_uuids.split(";")
 
309
                        if len(bridge_ids) == 1:
 
310
                            bridge_id = bridge_ids[0]
 
311
                        else:
 
312
                            bridge_id = get_single_bridge_id(bridge_ids,
 
313
                                                             row.name)
 
314
            set_external_id(row, "bridge-id", bridge_id)
313
315
 
314
316
            if bridge_id is not None:
315
 
                set_external_id(row, "bridge-id", bridge_id.split(";")[0])
316
 
 
317
 
            new_bridges[row.name] = bridge_id_cache
 
317
                new_bridges[row.name] = bridge_id
318
318
        bridges = new_bridges
319
319
 
320
320
        iface_by_name = {}