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

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Apr 28 06:31:15 CEST 2014


From: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>

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>
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

Conflicts:
	dog/vdi.c

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

diff --git a/dog/vdi.c b/dog/vdi.c
index 06342c3..b8c3c29 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -566,7 +566,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;
@@ -588,14 +588,14 @@ 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);
-
 	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.8.1.2




More information about the sheepdog mailing list