-#!/usr/bin/python
+#! /usr/bin/env python
# Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
import XenAPI
import ovs.dirs
-from ovs.db import error
-from ovs.db import types
import ovs.daemon
import ovs.db.idl
import ovs.unixctl
try:
session = XenAPI.xapi_local()
session.xenapi.login_with_password("", "")
- except XenAPI.Failure, e:
+ except XenAPI.Failure as e:
session = None
vlog.warn("Couldn't login to XAPI (%s)" % e)
return False
" XAPI session could not be initialized" % br_name)
return None
- recs = session.xenapi.network.get_all_records_where('field "bridge"="%s"' % br_name)
+ recs = session.xenapi.network.get_all_records_where(
+ 'field "bridge"="%s"' % br_name)
if len(recs) > 0:
return recs.values()[0]
return None
+
# There are possibilities when multiple xs-network-uuids are set for a bridge.
# In cases like that, we should choose the bridge-id associated with the bridge
# name.
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
while True:
unixctl_server.run()
if exiting:
- break;
+ break
idl.run()
if not xapi_down and not flush_cache and seqno == idl.change_seqno: