Commit-ID: f184486c0e550c75543537c506a017b7b9cd895f Gitweb: http://git.kernel.org/tip/f184486c0e550c75543537c506a017b7b9cd895f Author: Sasha Levin <levinsasha928@xxxxxxxxx> AuthorDate: Sun, 3 Jul 2011 18:38:10 +0300 Committer: Pekka Enberg <penberg@xxxxxxxxxx> CommitDate: Sun, 3 Jul 2011 21:07:47 +0300 kvm tools: Allow pausing and debugging all running instances Add a 'kvm [debug,pause] all' command to allow pausing or debugging all running guests on a host. Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx> Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx> --- 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 <string.h> #include <signal.h> +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 <kvm/kvm-pause.h> #include <kvm/kvm.h> +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"); -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
![]() |