From: Sasha Levin Subject: [PATCH 5/5] kvm tools: Allow pausing and debugging all running instances Date: Sun, 3 Jul 2011 18:38:10 +0300 Message-ID: <1309707490-14946-5-git-send-email-levinsasha928@gmail.com> References: <1309707490-14946-1-git-send-email-levinsasha928@gmail.com> Cc: mingo@elte.hu, asias.hejun@gmail.com, prasadjoshi124@gmail.com, gorcunov@gmail.com, kvm@vger.kernel.org, Sasha Levin To: penberg@kernel.org Return-path: Received: from mail-wy0-f174.google.com ([74.125.82.174]:33773 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755347Ab1GCPin (ORCPT ); Sun, 3 Jul 2011 11:38:43 -0400 Received: by mail-wy0-f174.google.com with SMTP id 8so2989616wyg.19 for ; Sun, 03 Jul 2011 08:38:42 -0700 (PDT) In-Reply-To: <1309707490-14946-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Add a 'kvm [debug,pause] all' command to allow pausing or debugging all running guests on a host. Signed-off-by: Sasha Levin --- tools/kvm/kvm-debug.c | 10 ++++++++++ tools/kvm/kvm-pause.c | 10 ++++++++++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/tools/kvm/kvm-debug.c b/tools/kvm/kvm-debug.c index 432ae84..676f311 100644 --- a/tools/kvm/kvm-debug.c +++ b/tools/kvm/kvm-debug.c @@ -7,6 +7,11 @@ #include #include +static void do_debug(const char *name, int pid) +{ + kill(pid, SIGQUIT); +} + int kvm_cmd_debug(int argc, const char **argv, const char *prefix) { int pid; @@ -14,6 +19,11 @@ int kvm_cmd_debug(int argc, const char **argv, const char *prefix) if (argc != 1) die("Usage: kvm debug [instance name]\n"); + if (strcmp(argv[0], "all") == 0) { + kvm__enumerate_instances(do_debug); + return 0; + } + pid = kvm__get_pid_by_instance(argv[0]); if (pid < 0) die("Failed locating instance name"); diff --git a/tools/kvm/kvm-pause.c b/tools/kvm/kvm-pause.c index 0cb6f29..ea4f95d 100644 --- a/tools/kvm/kvm-pause.c +++ b/tools/kvm/kvm-pause.c @@ -7,6 +7,11 @@ #include #include +static void do_pause(const char *name, int pid) +{ + kill(pid, SIGUSR2); +} + int kvm_cmd_pause(int argc, const char **argv, const char *prefix) { int pid; @@ -14,6 +19,11 @@ int kvm_cmd_pause(int argc, const char **argv, const char *prefix) if (argc != 1) die("Usage: kvm debug [instance name]\n"); + if (strcmp(argv[0], "all") == 0) { + kvm__enumerate_instances(do_pause); + return 0; + } + pid = kvm__get_pid_by_instance(argv[0]); if (pid < 0) die("Failed locating instance name"); -- 1.7.6