From patchwork Wed Aug 10 18:21:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pekka Enberg X-Patchwork-Id: 1054592 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7AIVapk023769 for ; Wed, 10 Aug 2011 18:31:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753755Ab1HJSVz (ORCPT ); Wed, 10 Aug 2011 14:21:55 -0400 Received: from filtteri6.pp.htv.fi ([213.243.153.189]:39088 "EHLO filtteri6.pp.htv.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753738Ab1HJSVy (ORCPT ); Wed, 10 Aug 2011 14:21:54 -0400 Received: from localhost (localhost [127.0.0.1]) by filtteri6.pp.htv.fi (Postfix) with ESMTP id 7466D56E27C; Wed, 10 Aug 2011 21:21:53 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at pp.htv.fi Received: from smtp5.welho.com ([213.243.153.39]) by localhost (filtteri6.pp.htv.fi [213.243.153.189]) (amavisd-new, port 10024) with ESMTP id mP3xYyjsw4VN; Wed, 10 Aug 2011 21:21:53 +0300 (EEST) Received: from localhost.localdomain (cs181136138.pp.htv.fi [82.181.136.138]) by smtp5.welho.com (Postfix) with ESMTP id B2E3B5BC002; Wed, 10 Aug 2011 21:21:52 +0300 (EEST) From: Pekka Enberg To: kvm@vger.kernel.org Cc: Pekka Enberg , Ingo Molnar , Sasha Levin Subject: [PATCH] kvm tools: Improve 'kvm list' output Date: Wed, 10 Aug 2011 21:21:51 +0300 Message-Id: <1313000511-3046-1-git-send-email-penberg@kernel.org> X-Mailer: git-send-email 1.7.0.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 10 Aug 2011 18:31:37 +0000 (UTC) This patch improves 'kvm list' output to look more like 'ps': $ ./kvm list PID GUEST 2820 guest-2820 Cc: Ingo Molnar Cc: Sasha Levin Signed-off-by: Pekka Enberg --- tools/kvm/builtin-list.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/tools/kvm/builtin-list.c b/tools/kvm/builtin-list.c index 43f37f2..34cc03b 100644 --- a/tools/kvm/builtin-list.c +++ b/tools/kvm/builtin-list.c @@ -25,7 +25,7 @@ static int print_guest(const char *name, int pid) if (strncmp(comm, PROCESS_NAME, strlen(PROCESS_NAME))) goto cleanup; - printf("%s (PID: %d)\n", name, pid); + printf("%5d %s\n", pid, name); free(comm); @@ -45,5 +45,7 @@ cleanup: int kvm_cmd_list(int argc, const char **argv, const char *prefix) { + printf(" PID GUEST\n"); + return kvm__enumerate_instances(print_guest); }