- VLOG_INFO("compacting database by user request");
- error = ovsdb_file_compact(file);
- if (!error) {
- unixctl_command_reply(conn, NULL);
+ ds_init(&reply);
+ for (db = dbs; db->filename != NULL; db++) {
+ const char *name = db->db->schema->name;
+
+ if (argc < 2 || !strcmp(argv[1], name)) {
+ struct ovsdb_error *error;
+
+ VLOG_INFO("compacting %s database by user request", name);
+
+ error = ovsdb_file_compact(db->file);
+ if (error) {
+ char *s = ovsdb_error_to_string(error);
+ ds_put_format(&reply, "%s\n", s);
+ free(s);
+ }
+
+ n++;
+ }
+ }
+
+ if (!n) {
+ unixctl_command_reply_error(conn, "no database by that name");
+ } else if (reply.length) {
+ unixctl_command_reply_error(conn, ds_cstr(&reply));