[Sheepdog] [PATCH] sheep: add tag field when display vdi list

yaohaiting.wujue at gmail.com yaohaiting.wujue at gmail.com
Tue Mar 27 07:53:06 CEST 2012


From: HaiTing Yao <wujue.yht at taobao.com>

User can not get tag information from collie tool now, so add it

Signed-off-by: HaiTing Yao <wujue.yht at taobao.com>
---
 collie/vdi.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/collie/vdi.c b/collie/vdi.c
index 8260eba..e0678a6 100644
--- a/collie/vdi.c
+++ b/collie/vdi.c
@@ -107,12 +107,18 @@ static void print_vdi_list(uint32_t vid, char *name, char *tag, uint32_t snapid,
 				putchar('\\');
 			putchar(*name++);
 		}
-		printf(" %d %s %s %s %s %" PRIx32 "\n", snapid,
+		printf(" %d %s %s %s %s %" PRIx32 "   ", snapid,
 				vdi_size_str, my_objs_str, cow_objs_str, dbuf, vid);
+		while (*tag) {
+			if (isspace(*tag) || *tag == '\\')
+				putchar('\\');
+			putchar(*tag++);
+		}
+		printf("\n");
 	} else {
-		printf("%c %-8s %5d %7s %7s %7s %s  %7" PRIx32 "\n",
+		printf("%c %-8s %5d %7s %7s %7s %s  %7" PRIx32 "   %s\n",
 				is_current(i) ? ' ' : 's', name, snapid,
-				vdi_size_str, my_objs_str, cow_objs_str, dbuf, vid);
+				vdi_size_str, my_objs_str, cow_objs_str, dbuf, vid, tag);
 	}
 }
 
@@ -297,7 +303,7 @@ static int vdi_list(int argc, char **argv)
 	char *vdiname = argv[optind];
 
 	if (!raw_output)
-		printf("  Name        Id    Size    Used  Shared    Creation time   VDI id\n");
+		printf("  Name        Id    Size    Used  Shared    Creation time   VDI id   Tag\n");
 
 	if (vdiname) {
 		struct get_vdi_info info;
-- 
1.7.1




More information about the sheepdog mailing list