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> --- 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"); -- 1.7.6 -- 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