[Sheepdog] [PATCH] shepherd: update node list after parsing arguments

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed May 12 03:58:48 CEST 2010


Shepherd should get node list from the specified daemon port, so we
cannot call update_node_list before parsing arguments.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 shepherd/shepherd.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/shepherd/shepherd.c b/shepherd/shepherd.c
index 0faba6f..d3bbc50 100644
--- a/shepherd/shepherd.c
+++ b/shepherd/shepherd.c
@@ -1041,7 +1041,7 @@ static unsigned long setup_command(char *cmd, char *subcmd)
 
 int main(int argc, char **argv)
 {
-	int ch, longindex;
+	int ch, longindex, ret;
 	char termcap_area[1024];
 	unsigned long flags;
 
@@ -1053,9 +1053,6 @@ int main(int argc, char **argv)
 
 	flags = setup_command(argv[1], argv[2]);
 
-	if (flags & SUBCMD_FLAG_NEED_NOEDLIST)
-		update_node_list(SD_MAX_NODES, 0);
-
 	optind = 3;
 
 	while ((ch = getopt_long(argc, argv, short_options, long_options,
@@ -1081,6 +1078,14 @@ int main(int argc, char **argv)
 		}
 	}
 
+	if (flags & SUBCMD_FLAG_NEED_NOEDLIST) {
+		ret = update_node_list(SD_MAX_NODES, 0);
+		if (ret < 0) {
+			fprintf(stderr, "failed to get node list\n");
+			exit(1);
+		}
+	}
+
 	if (flags & SUBCMD_FLAG_NEED_THIRD_ARG && argc == optind) {
 		fprintf(stderr, "'%s %s' needs the third argument\n", argv[1], argv[2]);
 		exit(1);
-- 
1.5.6.5




More information about the sheepdog mailing list