[sheepdog] [PATCH] sheep, dog: detect a cluster is formatted or not with cinfo.ctime

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Fri Jan 9 09:18:01 CET 2015


The commit 289b7f4bcdd changed a behavior of SD_OP_CLUSTER_INFO. The
changed op returns SD_RES_WAIT_FOR_FORMAT if the cluster is not
formatted yet. But this behavior conflicts with ongoing fixed vnode
feature. This patch resolves the conflict by changing a way of
detecting cluster format in dog command.

Cc: Masaki Saeki <saeki.masaki at po.ntts.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 dog/vdi.c   | 4 ++--
 sheep/ops.c | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index effed17..6b6465a 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -479,9 +479,9 @@ static int vdi_create(int argc, char **argv)
 			goto out;
 		}
 
-		if (rsp->result == SD_RES_WAIT_FOR_FORMAT) {
+		if (!cinfo.ctime) {
 			sd_err("Failed to create VDI %s: %s", vdiname,
-			       sd_strerror(rsp->result));
+			       sd_strerror(SD_RES_WAIT_FOR_FORMAT));
 			return EXIT_FAILURE;
 		}
 
diff --git a/sheep/ops.c b/sheep/ops.c
index b0aee58..5d71dde 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -1125,9 +1125,6 @@ static int local_oids_exist(const struct sd_req *req, struct sd_rsp *rsp,
 static int local_cluster_info(const struct sd_req *req, struct sd_rsp *rsp,
 			      void *data, const struct sd_node *sender)
 {
-	if (sys->cinfo.ctime == 0)
-		return SD_RES_WAIT_FOR_FORMAT;
-
 	memcpy(data, &sys->cinfo, sizeof(sys->cinfo));
 	rsp->data_length = sizeof(sys->cinfo);
 	return SD_RES_SUCCESS;
-- 
1.9.1




More information about the sheepdog mailing list