[sheepdog] [PATCH v3 7/7] dog: add a new subcommand "dog vdi lock force-unlock" for unlocking VDI forcibly
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Thu Jul 31 04:51:28 CEST 2014
In a case of sudden death of qemu, tgt, and sheep, admins must unlock
locked VDIs manually. This patch provides a new subcommand "dog vdi
lock force-unlock" for this purpose.
Correct recovery process is like below:
1. unlock locked VDIs
2. repair them with "dog vdi check"
3. launch clients for the VDIs
Cc: Fabian Zimmermann <dev.faz at gmail.com>
Cc: Valerio Pachera <sirio81 at gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
dog/vdi.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/dog/vdi.c b/dog/vdi.c
index 8e962e8..782c4e9 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -2750,8 +2750,32 @@ out:
return ret;
}
+static int lock_force_unlock(int argc, char **argv)
+{
+ struct sd_req hdr;
+ const char *vdiname = argv[optind];
+ struct vdi_tree *vdi;
+
+ init_tree();
+ if (parse_vdi(construct_vdi_tree, SD_INODE_HEADER_SIZE, NULL) < 0)
+ return EXIT_SYSFAIL;
+
+ vdi = find_vdi_from_root_by_name(vdiname);
+ if (!vdi) {
+ sd_err("VDI: %s not found", vdiname);
+ return EXIT_SYSFAIL;
+ }
+
+ sd_init_req(&hdr, SD_OP_RELEASE_VDI);
+ hdr.vdi.base_vdi_id = vdi->vid;
+
+ return dog_exec_req(&sd_nid, &hdr, NULL);
+}
+
static struct subcommand vdi_lock_cmd[] = {
{"list", NULL, NULL, "list locked VDIs", NULL, 0, lock_list},
+ {"force-unlock", "<vdiname>", NULL, "unlock locked VDI forcibly", NULL, 0,
+ lock_force_unlock},
{NULL},
};
--
1.8.3.2
More information about the sheepdog
mailing list