[ovs-dev] [ovsdb monitors 6/8] ovsdb-client: Fix "selects" argument to "monitor" command.
Ben Pfaff
blp at nicira.com
Wed Jun 30 23:49:25 UTC 2010
This code assumed that the types of operations that were selected were
default-off, so it only added JSON to the query to turn on the ones that
were wanted, but in fact they are default-on, so this commit changes it
to add JSON for each possible operation type.
---
ovsdb/ovsdb-client.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c
index 7177b26..0199b0e 100644
--- a/ovsdb/ovsdb-client.c
+++ b/ovsdb/ovsdb-client.c
@@ -936,14 +936,30 @@ do_monitor(int argc, char *argv[])
}
if (argc >= 6 && *argv[5] != '\0') {
+ bool initial, insert, delete, modify;
char *save_ptr = NULL;
char *token;
- select = json_object_create();
+ initial = insert = delete = modify = false;
+
for (token = strtok_r(argv[5], ",", &save_ptr); token != NULL;
token = strtok_r(NULL, ",", &save_ptr)) {
- json_object_put(select, token, json_boolean_create(true));
+ if (!strcmp(token, "initial")) {
+ initial = true;
+ } else if (!strcmp(token, "insert")) {
+ insert = true;
+ } else if (!strcmp(token, "delete")) {
+ delete = true;
+ } else if (!strcmp(token, "modify")) {
+ modify = true;
+ }
}
+
+ select = json_object_create();
+ json_object_put(select, "initial", json_boolean_create(initial));
+ json_object_put(select, "insert", json_boolean_create(insert));
+ json_object_put(select, "delete", json_boolean_create(delete));
+ json_object_put(select, "modify", json_boolean_create(modify));
} else {
select = NULL;
}
--
1.7.1
More information about the dev
mailing list