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@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Sasha Levin
2015-06-01 16:39:45 +01:00
committed by Will Deacon
parent 9dba6721a9
commit 24e7dbbaf2
2 changed files with 20 additions and 0 deletions
+10
View File
@@ -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");
+10
View File
@@ -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");