- set_external_id(row, "bridge-id", id_.split(";")[0])
-
-def keep_table_columns(schema, table_name, columns):
- table = schema.tables.get(table_name)
- if not table:
- raise error.Error("schema has no %s table" % table_name)
-
- new_columns = {}
- for column_name in columns:
- column = table.columns.get(column_name)
- if not column:
- raise error.Error("%s table schema lacks %s column"
- % (table_name, column_name))
- new_columns[column_name] = column
- table.columns = new_columns
- return table
-
-def prune_schema(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 = {}
- new_tables["Bridge"] = keep_table_columns(
- schema, "Bridge", ("name", "external_ids", "other_config",
- "fail_mode"))
- new_tables["Interface"] = keep_table_columns(
- schema, "Interface", ("name", "external_ids"))
- 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, _):
- global force_run
- if (signum == signal.SIGHUP):
- force_run = True
-
-def main(argv):
- global force_run
-
- l_handler = logging.handlers.RotatingFileHandler(
- "/var/log/openvswitch/ovs-xapi-sync.log")
- l_formatter = logging.Formatter('%(filename)s: %(levelname)s: %(message)s')
- l_handler.setFormatter(l_formatter)
- s_log.addHandler(l_handler)
- s_log.setLevel(logging.INFO)