[Sheepdog] [PATCH 4/6] merge dog port and sheep port

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Tue Dec 1 19:35:21 CET 2009


We have only one sheepdog daemon now, so we don't need
more than one port.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 include/sheepdog_proto.h |    3 +--
 shepherd/shepherd.c      |   20 ++++++++++----------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
index cbf91c4..40370b6 100644
--- a/include/sheepdog_proto.h
+++ b/include/sheepdog_proto.h
@@ -15,8 +15,7 @@
 #include <openssl/sha.h>
 #include "util.h"
 
-#define SHEEP_LISTEN_PORT 10095
-#define DOG_LISTEN_PORT 7000
+#define SD_LISTEN_PORT 7000
 
 #define SD_MAX_NODES 1024
 #define SD_MAX_VMS   4096
diff --git a/shepherd/shepherd.c b/shepherd/shepherd.c
index 91bd2d9..4ac7e4a 100644
--- a/shepherd/shepherd.c
+++ b/shepherd/shepherd.c
@@ -34,11 +34,11 @@
 #include "treeview.h"
 
 static char program_name[] = "shepherd";
-static int dogport = DOG_LISTEN_PORT;
+static int sdport = SD_LISTEN_PORT;
 
 static struct option const long_options[] =
 {
-	{"dport", required_argument, 0, 'D'},
+	{"port", required_argument, 0, 'p'},
 	{"copies", required_argument, 0, 'c'},
 	{"epoch", required_argument, 0, 'e'},
 	{"index", required_argument, 0, 'i'},
@@ -51,7 +51,7 @@ static struct option const long_options[] =
 	{0, 0, 0, 0},
 };
 
-static char *short_options = "D:f:rR:t:H:o:i:e:h";
+static char *short_options = "p:f:rR:t:H:o:i:e:h";
 
 enum info_type {
 	INFO_VDI,
@@ -109,7 +109,7 @@ static int update_node_list(int max_nodes, int epoch)
 	struct sd_node_req hdr;
 	struct sd_node_rsp *rsp = (struct sd_node_rsp *)&hdr;
 
-	fd = connect_to("localhost", dogport);
+	fd = connect_to("localhost", sdport);
 	if (fd < 0)
 		return -1;
 
@@ -186,7 +186,7 @@ static int mkfs(int copies)
 	struct sd_obj_rsp *rsp = (struct sd_obj_rsp *)&hdr;
 	unsigned rlen, wlen;
 
-	fd = connect_to("localhost", dogport);
+	fd = connect_to("localhost", sdport);
 	if (fd < 0)
 		return -1;
 
@@ -286,7 +286,7 @@ static int debug(char *op, char *arg)
 		return 1;
 
 	strcpy(name, "localhost");
-	fd = connect_to(name, dogport);
+	fd = connect_to(name, sdport);
 	if (fd < 0)
 		return -1;
 
@@ -341,7 +341,7 @@ static int shutdown_sheepdog(void)
 	struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
 	unsigned rlen, wlen;
 
-	fd = connect_to("localhost", dogport);
+	fd = connect_to("localhost", sdport);
 	if (fd < 0)
 		return -1;
 
@@ -936,7 +936,7 @@ rerun:
 		char *data;
 		struct vm_list_info vli;
 
-		fd = connect_to("localhost", dogport);
+		fd = connect_to("localhost", sdport);
 		if (fd < 0)
 			break;
 
@@ -998,8 +998,8 @@ int main(int argc, char **argv)
 	while ((ch = getopt_long(argc, argv, short_options, long_options,
 				 &longindex)) >= 0) {
 		switch (ch) {
-		case 'D':
-			dogport = atoi(optarg);
+		case 'p':
+			sdport = atoi(optarg);
 			break;
 		case 'c':
 			copies = atoi(optarg);
-- 
1.5.6.5




More information about the sheepdog mailing list