[sheepdog] [PATCH v2 5/6] sheep: make SD_OP_GET_INFO a cluster operation

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed May 1 10:41:48 CEST 2013


Sheepdog vdi snapshot works as follows:

 1. Update the inode header of the current working vdi.
 2. Create a new working vdi as a child of the previous one.

If QEMU reads the vdi object between 1 and 2, sheep returns
SD_RES_NO_VDI.  To avoid this problem, SD_OP_GET_INFO must be ordered
with other vdi operations.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/ops.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sheep/ops.c b/sheep/ops.c
index 7f27bc3..cff800e 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -196,7 +196,7 @@ static int post_cluster_del_vdi(const struct sd_req *req, struct sd_rsp *rsp,
 	return ret;
 }
 
-static int local_get_vdi_info(struct request *req)
+static int cluster_get_vdi_info(struct request *req)
 {
 	const struct sd_req *hdr = &req->rq;
 	struct sd_rsp *rsp = &req->rp;
@@ -1092,19 +1092,19 @@ static struct sd_op_template sd_ops[] = {
 		.process_main = cluster_recovery_completion,
 	},
 
-	/* local operations */
 	[SD_OP_GET_VDI_INFO] = {
 		.name = "GET_VDI_INFO",
-		.type = SD_OP_TYPE_LOCAL,
-		.process_work = local_get_vdi_info,
+		.type = SD_OP_TYPE_CLUSTER,
+		.process_work = cluster_get_vdi_info,
 	},
 
 	[SD_OP_LOCK_VDI] = {
 		.name = "LOCK_VDI",
-		.type = SD_OP_TYPE_LOCAL,
-		.process_work = local_get_vdi_info,
+		.type = SD_OP_TYPE_CLUSTER,
+		.process_work = cluster_get_vdi_info,
 	},
 
+	/* local operations */
 	[SD_OP_RELEASE_VDI] = {
 		.name = "RELEASE_VDI",
 		.type = SD_OP_TYPE_LOCAL,
-- 
1.8.1.3.566.gaa39828




More information about the sheepdog mailing list