[sheepdog] [PATCH] dog: print new VID of current VDI when snapshot is created

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Wed Jan 29 08:46:40 CET 2014


Especially new VID of current VDI is useful information. So this patch
lets dog print both of the IDs.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 dog/vdi.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index 1e175b3..9df0985 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -675,7 +675,7 @@ out:
 static int vdi_snapshot(int argc, char **argv)
 {
 	const char *vdiname = argv[optind++];
-	uint32_t vid;
+	uint32_t vid, new_vid;
 	int ret;
 	char buf[SD_INODE_HEADER_SIZE];
 	struct sd_inode *inode = (struct sd_inode *)buf;
@@ -699,15 +699,16 @@ static int vdi_snapshot(int argc, char **argv)
 	if (ret != SD_RES_SUCCESS)
 		return EXIT_FAILURE;
 
-	ret = do_vdi_create(vdiname, inode->vdi_size, vid, NULL, true,
+	ret = do_vdi_create(vdiname, inode->vdi_size, vid, &new_vid, true,
 			    inode->nr_copies, inode->copy_policy,
 			    inode->store_policy);
 
 	if (ret == EXIT_SUCCESS && verbose) {
 		if (raw_output)
-			printf("%x\n", vid);
+			printf("%x %x\n", new_vid, vid);
 		else
-			printf("VDI ID of newly created snapshot: %x\n", vid);
+			printf("new VID of original VDI: %x,"
+			       " VDI ID of newly created snapshot: %x\n", new_vid, vid);
 	}
 
 	return ret;
-- 
1.7.10.4




More information about the sheepdog mailing list