- if not id:
- return
-
- primary_id = id.split(";")[0]
-
- if ids.get("bridge-id") != primary_id:
- set_external_id("Bridge", name, "bridge-id", primary_id)
- ids["bridge-id"] = primary_id
-
-def update_iface_id(name, ids):
- id = get_iface_id(name, ids.get("xs-vif-uuid"))
- if ids.get("iface-id") != id and id:
- set_external_id("Interface", name, "iface-id", id)
- ids["iface-id"] = id
-
-def keep_table_columns(schema, table_name, column_types):
- table = schema.tables.get(table_name)
- if not table:
- raise error.Error("schema has no %s table" % table_name)
-
- new_columns = {}
- for column_name, column_type in column_types.iteritems():
- column = table.columns.get(column_name)
- if not column:
- raise error.Error("%s table schema lacks %s column"
- % (table_name, column_name))
- if column.type != column_type:
- raise error.Error("%s column in %s table has type \"%s\", "
- "expected type \"%s\""
- % (column_name, table_name,
- column.type.toEnglish(),
- column_type.toEnglish()))
- new_columns[column_name] = column
- table.columns = new_columns
- return table
-
-def monitor_uuid_schema_cb(schema):
- string_type = types.Type(types.BaseType(types.StringType))
- string_map_type = types.Type(types.BaseType(types.StringType),
- types.BaseType(types.StringType),
- 0, sys.maxint)
-
- new_tables = {}
- for table_name in ("Bridge", "Interface"):
- new_tables[table_name] = keep_table_columns(
- schema, table_name, {"name": string_type,
- "external_ids": string_map_type})
- schema.tables = new_tables
-
-def usage():
- print "usage: %s [OPTIONS] DATABASE" % sys.argv[0]
- print "where DATABASE is a socket on which ovsdb-server is listening."
- ovs.daemon.usage()
- print "Other options:"
- print " -h, --help display this help message"
- sys.exit(0)
-
-def handler(signum, frame):
- global force_run
- if (signum == signal.SIGHUP):
- force_run = True
-
-def main(argv):
- global force_run
-
- try:
- options, args = getopt.gnu_getopt(
- argv[1:], 'h', ['help'] + ovs.daemon.LONG_OPTIONS)
- except getopt.GetoptError, geo:
- sys.stderr.write("%s: %s\n" % (ovs.util.PROGRAM_NAME, geo.msg))
- sys.exit(1)
-
- for key, value in options:
- if key in ['-h', '--help']:
- usage()
- elif not ovs.daemon.parse_opt(key, value):
- sys.stderr.write("%s: unhandled option %s\n"
- % (ovs.util.PROGRAM_NAME, key))
- sys.exit(1)
-
- if len(args) != 1:
- sys.stderr.write("%s: exactly one nonoption argument is required "
- "(use --help for help)\n" % ovs.util.PROGRAM_NAME)
- sys.exit(1)
-
- remote = args[0]
- idl = ovs.db.idl.Idl(remote, "Open_vSwitch", monitor_uuid_schema_cb)
+ row.verify("other_config")
+ other_config = row.other_config
+ if dib and dib not in ['true', 'false']:
+ vlog.warn('"%s" isn\'t a valid setting for '
+ "other_config:disable-in-band on %s" % (dib, row.name))
+ elif set_or_delete(other_config, 'disable-in-band', dib):
+ row.other_config = other_config
+
+
+def main():
+ global flush_cache, xapi_down
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument("database", metavar="DATABASE",
+ help="A socket on which ovsdb-server is listening.")
+ parser.add_argument("--root-prefix", metavar="DIR", default='',
+ help="Use DIR as alternate root directory"
+ " (for testing).")
+
+ ovs.vlog.add_args(parser)
+ ovs.daemon.add_args(parser)
+ args = parser.parse_args()
+ ovs.vlog.handle_args(args)
+ ovs.daemon.handle_args(args)
+
+ remote = args.database
+ schema_helper = ovs.db.idl.SchemaHelper()
+ schema_helper.register_columns("Bridge", ["name", "external_ids",
+ "other_config", "fail_mode"])
+ schema_helper.register_columns("Interface", ["name", "external_ids"])
+ idl = ovs.db.idl.Idl(remote, schema_helper)