-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))
- optional_ssl_type = types.Type(types.BaseType(types.UuidType,
- ref_table='SSL'), None, 0, 1)
- string_map_type = types.Type(types.BaseType(types.StringType),
- types.BaseType(types.StringType),
- 0, sys.maxint)
-
- new_tables = {}
- new_tables["Interface"] = keep_table_columns(
- schema, "Interface", {"name": string_type,
- "type": string_type,
- "options": string_map_type})
- new_tables["Open_vSwitch"] = keep_table_columns(
- schema, "Open_vSwitch", {"ssl": optional_ssl_type})
- new_tables["SSL"] = keep_table_columns(
- schema, "SSL", {"certificate": string_type,
- "private_key": string_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)
-