diff mbox series

[5/5] tools/xenstored: remove the "-R" command line option

Message ID 20231113124309.10862-6-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series tools/xenstored: remove some command line options | expand

Commit Message

Jürgen Groß Nov. 13, 2023, 12:43 p.m. UTC
The "-R" (no recovery) command line option enables to omit fixing the
node store in case of detected inconsistencies.

This might have been of interest in the past, when the node data base
was kept in a file, but now the usability of this option is zero.

Remove the "-R" option.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstored/core.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

Comments

Julien Grall Nov. 14, 2023, 9:34 p.m. UTC | #1
Hi Juergen,

On 13/11/2023 12:43, Juergen Gross wrote:
> The "-R" (no recovery) command line option enables to omit fixing the
> node store in case of detected inconsistencies.
> 
> This might have been of interest in the past, when the node data base
> was kept in a file, but now the usability of this option is zero.
> 
> Remove the "-R" option.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Julien Grall <jgrall@amazon.com>

Cheers,
diff mbox series

Patch

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index c3cfef0965..9d6a5684b8 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -78,7 +78,6 @@  char **orig_argv;
 
 LIST_HEAD(connections);
 int tracefd = -1;
-static bool recovery = true;
 bool keep_orphans = false;
 static int reopen_log_pipe[2];
 static int reopen_log_pipe0_pollfd_idx = -1;
@@ -2443,9 +2442,6 @@  int remember_string(struct hashtable *hash, const char *str)
  * have a corresponding child node (and if so, delete them).  Each valid child
  * is then recursively checked.
  *
- * No deleting is performed if the recovery flag is cleared (i.e. -R was
- * passed on the command line).
- *
  * As we go, we record each node in the given reachable hashtable.  These
  * entries will be used later in clean_store.
  */
@@ -2462,8 +2458,7 @@  static int check_store_step(const void *ctx, struct connection *conn,
 
 	if (hashtable_search(data->reachable, (void *)node->name)) {
 		log("check_store: '%s' is duplicated!", node->name);
-		return recovery ? WALK_TREE_RM_CHILDENTRY
-				: WALK_TREE_SKIP_CHILDREN;
+		return WALK_TREE_RM_CHILDENTRY;
 	}
 
 	if (remember_string(data->reachable, node->name))
@@ -2479,7 +2474,7 @@  static int check_store_enoent(const void *ctx, struct connection *conn,
 {
 	log("check_store: node '%s' not found", name);
 
-	return recovery ? WALK_TREE_RM_CHILDENTRY : WALK_TREE_OK;
+	return WALK_TREE_RM_CHILDENTRY;
 }
 
 
@@ -2504,8 +2499,7 @@  static int clean_store_(const void *key, void *val, void *private)
 	}
 	if (!hashtable_search(reachable, name)) {
 		log("clean_store: '%s' is orphaned!", name);
-		if (recovery)
-			db_delete(NULL, name, NULL);
+		db_delete(NULL, name, NULL);
 	}
 
 	talloc_free(name);
@@ -2685,8 +2679,6 @@  static void usage(void)
 "  -w, --timeout <what>=<seconds>   set the timeout in seconds for <what>,\n"
 "                          allowed timeout candidates are:\n"
 "                          watch-event: time a watch-event is kept pending\n"
-"  -R, --no-recovery       to request that no recovery should be attempted when\n"
-"                          the store is corrupted (debug only),\n"
 "  -K, --keep-orphans      don't delete nodes owned by a domain when the\n"
 "                          domain is deleted (this is a security risk!)\n");
 }
@@ -2708,7 +2700,6 @@  static struct option options[] = {
 	{ "quota", 1, NULL, 'Q' },
 	{ "quota-soft", 1, NULL, 'q' },
 	{ "timeout", 1, NULL, 'w' },
-	{ "no-recovery", 0, NULL, 'R' },
 	{ "keep-orphans", 0, NULL, 'K' },
 	{ "watch-nb", 1, NULL, 'W' },
 #ifndef NO_LIVE_UPDATE
@@ -2828,7 +2819,7 @@  int main(int argc, char *argv[])
 	orig_argv = argv;
 
 	while ((opt = getopt_long(argc, argv,
-				  "E:F:H::KS:t:A:M:Q:q:T:RW:w:U",
+				  "E:F:H::KS:t:A:M:Q:q:T:W:w:U",
 				  options, NULL)) != -1) {
 		switch (opt) {
 		case 'E':
@@ -2840,9 +2831,6 @@  int main(int argc, char *argv[])
 		case 'H':
 			usage();
 			return 0;
-		case 'R':
-			recovery = false;
-			break;
 		case 'S':
 			hard_quotas[ACC_NODESZ].val = get_optval_uint(optarg);
 			break;