Skip to contentSkip to conversation

kvm tools: Improve "kvm list" default output

PATCH New Pekka Enberg 1 participant 1 message Oct 25, 2011 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm tools: Improve "kvm list" default output

This patch changes 'kvm list' default output to look as follows:

[penberg@tux kvm]$ ./kvm list
PID GUEST
8156 guest-8156
default (not running) test-box (not running)

Cc Asias He <[email protected]>
Cc Cyrill Gorcunov <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Sasha Levin <[email protected]>
---
 tools/kvm/builtin-list.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
tools/kvm/builtin-list.c +4 -6
index 12e2537..2ff3472 100644
@@ -91,8 +91,6 @@ cleanup:
 
 static int kvm_list_running_instances(void)
 {
-	printf("  PID GUEST\n");
-
 	return kvm__enumerate_instances(print_guest);
 }
 
@@ -107,13 +105,11 @@ static int kvm_list_rootfs(void)
 	if (dir == NULL)
 		return -1;
 
-	printf("  ROOTFS\n");
-
 	while ((dirent = readdir(dir))) {
 		if (dirent->d_type == DT_DIR &&
 			strcmp(dirent->d_name, ".") &&
 			strcmp(dirent->d_name, ".."))
-			printf("%s\n", dirent->d_name);
+			printf("      %s (not running)\n", dirent->d_name);
 	}
 
 	return 0;
@@ -136,7 +132,9 @@ int kvm_cmd_list(int argc, const char **argv, const char *prefix)
 	parse_setup_options(argc, argv);
 
 	if (!run && !rootfs)
-		kvm_list_help();
+		run = rootfs = true;
+
+	printf("  PID GUEST\n");
 
 	if (run) {
 		r = kvm_list_running_instances();
Signature · 1 line
1.7.6.4