summaryrefslogtreecommitdiff
path: root/vtep
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2017-01-04 14:29:21 -0800
committerBen Pfaff <blp@ovn.org>2017-01-13 13:14:59 -0800
commit3f5b5f7b411553e0421e37b49dc5deeaede56308 (patch)
tree91e4b8e9a41819e1f61a28bec548cd9e05412dfc /vtep
parent08e790fd69af928a62836110485408cedb0b8b6b (diff)
downloadopenvswitch-3f5b5f7b411553e0421e37b49dc5deeaede56308.tar.gz
db-ctl-base: Always support all tables in schema.
When one adds a new table to a database schema, it's easy to forget to add the table to the list of tables in the *ctl.c program. When this happens, the database commands for that program don't work on that table at all, even for commands like "list" and "create" that don't need any special help. This patch fixes that problem, by making sure that db-ctl-base always has the complete list of tables. Previously, each ctl_table_class pointed directly to the corresponding ovsdb_idl_table_class. With this patch, there are instead two parallel arrays, one of ovsdb_idl_table_classes and the other of ctl_table_classes. This change accounts for the bulk of the change to the db-ctl-base code. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Lance Richardson <lrichard@redhat.com>
Diffstat (limited to 'vtep')
-rw-r--r--vtep/vtep-ctl.c78
1 files changed, 14 insertions, 64 deletions
diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c
index 1d8cbcb09..e23c987da 100644
--- a/vtep/vtep-ctl.c
+++ b/vtep/vtep-ctl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, 2011, 2012, 2014, 2015, 2016 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2014, 2015, 2016, 2017 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -2175,72 +2175,22 @@ cmd_set_manager(struct ctl_context *ctx)
}
/* Parameter commands. */
-static const struct ctl_table_class tables[] = {
- {&vteprec_table_global,
- {{&vteprec_table_global, NULL, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_logical_binding_stats,
- {{NULL, NULL, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_logical_switch,
- {{&vteprec_table_logical_switch, &vteprec_logical_switch_col_name, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_ucast_macs_local,
- {{NULL, NULL, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_ucast_macs_remote,
- {{NULL, NULL, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_mcast_macs_local,
- {{NULL, NULL, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_mcast_macs_remote,
- {{NULL, NULL, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_manager,
- {{&vteprec_table_manager, &vteprec_manager_col_target, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_physical_locator,
- {{NULL, NULL, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_physical_locator_set,
- {{NULL, NULL, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_physical_port,
- {{&vteprec_table_physical_port, &vteprec_physical_port_col_name, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_physical_switch,
- {{&vteprec_table_physical_switch, &vteprec_physical_switch_col_name, NULL},
- {NULL, NULL, NULL}}},
-
- {&vteprec_table_tunnel,
- {{NULL, NULL, NULL},
- {NULL, NULL, NULL}}},
+static const struct ctl_table_class tables[VTEPREC_N_TABLES] = {
+ [VTEPREC_TABLE_LOGICAL_SWITCH].row_ids[0]
+ = {&vteprec_table_logical_switch, &vteprec_logical_switch_col_name, NULL},
- {&vteprec_table_logical_router,
- {{&vteprec_table_logical_router, &vteprec_logical_router_col_name, NULL},
- {NULL, NULL, NULL}}},
+ [VTEPREC_TABLE_MANAGER].row_ids[0]
+ = {&vteprec_table_manager, &vteprec_manager_col_target, NULL},
- {&vteprec_table_arp_sources_local,
- {{NULL, NULL, NULL},
- {NULL, NULL, NULL}}},
+ [VTEPREC_TABLE_PHYSICAL_PORT].row_ids[0]
+ = {&vteprec_table_physical_port, &vteprec_physical_port_col_name, NULL},
- {&vteprec_table_arp_sources_remote,
- {{NULL, NULL, NULL},
- {NULL, NULL, NULL}}},
+ [VTEPREC_TABLE_PHYSICAL_SWITCH].row_ids[0]
+ = {&vteprec_table_physical_switch, &vteprec_physical_switch_col_name,
+ NULL},
- {NULL, {{NULL, NULL, NULL}, {NULL, NULL, NULL}}}
+ [VTEPREC_TABLE_LOGICAL_ROUTER].row_ids[0]
+ = {&vteprec_table_logical_router, &vteprec_logical_router_col_name, NULL},
};
@@ -2545,6 +2495,6 @@ static const struct ctl_command_syntax vtep_commands[] = {
static void
vtep_ctl_cmd_init(void)
{
- ctl_init(tables, cmd_show_tables, vtep_ctl_exit);
+ ctl_init(vteprec_table_classes, tables, cmd_show_tables, vtep_ctl_exit);
ctl_register_commands(vtep_commands);
}