]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Improve "kvm list" default output
authorPekka Enberg <penberg@kernel.org>
Tue, 25 Oct 2011 12:20:09 +0000 (15:20 +0300)
committerPekka Enberg <penberg@kernel.org>
Tue, 25 Oct 2011 13:22:20 +0000 (16:22 +0300)
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)

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Cc: Asias He <asias.hejun@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/builtin-list.c

index 12e2537b423580a561e56b9bcaa237012f8e808f..2ff347275706490a010252775cd932c1666ebd8d 100644 (file)
@@ -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();