[sheepdog] [PATCH v3 02/12] collie: remove snapshot from cluster subcommand

Kai Zhang kyle at zelin.io
Tue May 14 09:51:47 CEST 2013


collie is not able to do "collie cluster snapshot".

Signed-off-by: Kai Zhang <kyle at zelin.io>
---
 collie/cluster.c |   90 ------------------------------------------------------
 1 files changed, 0 insertions(+), 90 deletions(-)

diff --git a/collie/cluster.c b/collie/cluster.c
index cb92be9..fa2e131 100644
--- a/collie/cluster.c
+++ b/collie/cluster.c
@@ -223,94 +223,6 @@ static int cluster_shutdown(int argc, char **argv)
 	return EXIT_SUCCESS;
 }
 
-static int restore_snap(uint32_t epoch)
-{
-	int ret;
-	struct sd_req hdr;
-
-	sd_init_req(&hdr, SD_OP_RESTORE);
-	hdr.obj.tgt_epoch = epoch;
-
-	ret = send_light_req(&hdr, sdhost, sdport);
-	if (ret) {
-		fprintf(stderr, "failed to execute request\n");
-		return EXIT_FAILURE;
-	}
-
-	printf("Cluster restore to the snapshot %d\n", epoch);
-	return EXIT_SUCCESS;
-}
-
-static void print_list(void *buf, unsigned len)
-{
-	struct snap_log *log_buf = (struct snap_log *)buf;
-	unsigned nr = len / sizeof(struct snap_log), i;
-
-	printf("Index\t\tSnapshot Time\n");
-	for (i = 0; i < nr; i++, log_buf++) {
-		time_t *t = (time_t *)&log_buf->time;
-		printf("%d\t\t", log_buf->epoch);
-		printf("%s", ctime(t));
-	}
-}
-
-static int list_snap(void)
-{
-	int ret = EXIT_SYSFAIL;
-	struct sd_req hdr;
-	struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
-	void *buf;
-
-	buf = xmalloc(SD_DATA_OBJ_SIZE);
-
-	sd_init_req(&hdr, SD_OP_GET_SNAP_FILE);
-	hdr.data_length = SD_DATA_OBJ_SIZE;
-
-	ret = collie_exec_req(sdhost, sdport, &hdr, buf);
-	if (ret < 0)
-		goto out;
-
-	if (rsp->result != SD_RES_SUCCESS) {
-		fprintf(stderr, "Listing snapshots failed: %s\n",
-				sd_strerror(rsp->result));
-		ret = EXIT_FAILURE;
-		goto out;
-	}
-
-	print_list(buf, rsp->data_length);
-out:
-	free(buf);
-	return EXIT_SUCCESS;
-}
-
-static int do_snapshot(void)
-{
-	int ret;
-	struct sd_req hdr;
-
-	sd_init_req(&hdr, SD_OP_SNAPSHOT);
-
-	ret = send_light_req(&hdr, sdhost, sdport);
-	if (ret) {
-		fprintf(stderr, "failed to execute request\n");
-		return EXIT_FAILURE;
-	}
-
-	return EXIT_SUCCESS;
-}
-
-static int cluster_snapshot(int argc, char **argv)
-{
-	int ret, epoch = cluster_cmd_data.epoch;
-	if (epoch)
-		ret = restore_snap(epoch);
-	else if (cluster_cmd_data.list)
-		ret = list_snap();
-	else
-		ret = do_snapshot();
-	return ret;
-}
-
 #define RECOVER_PRINT \
 	"Caution! Please try starting all the cluster nodes normally before\n" \
 	"running this command.\n\n" \
@@ -410,8 +322,6 @@ static struct subcommand cluster_cmd[] = {
 	 NULL, 0, cluster_format, cluster_options},
 	{"shutdown", NULL, "aph", "stop Sheepdog",
 	 NULL, 0, cluster_shutdown, cluster_options},
-	{"snapshot", NULL, "aRlph", "snapshot/restore the cluster",
-	 NULL, 0, cluster_snapshot, cluster_options},
 	{"recover", NULL, "afph",
 	 "See 'collie cluster recover' for more information\n",
 	 cluster_recover_cmd, SUBCMD_FLAG_NEED_ARG,
-- 
1.7.1




More information about the sheepdog mailing list