[PATCH] kvm tools: Improve "kvm list" default output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <asias.hejun@xxxxxxxxx>
Cc: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Sasha Levin <levinsasha928@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/builtin-list.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/tools/kvm/builtin-list.c b/tools/kvm/builtin-list.c
index 12e2537..2ff3472 100644
--- a/tools/kvm/builtin-list.c
+++ b/tools/kvm/builtin-list.c
@@ -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();
-- 
1.7.6.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux