aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/bhyvectl
diff options
context:
space:
mode:
authorNeel Natu <neel@FreeBSD.org>2014-04-28 22:06:40 +0000
committerNeel Natu <neel@FreeBSD.org>2014-04-28 22:06:40 +0000
commitf0fdcfe247c3927f40b1612388f9a35973d56728 (patch)
tree2a5755c72feac26b7524cca10dc7e5475e332ee8 /usr.sbin/bhyvectl
parent70b7e330c6da51d24f6719e06bec3c5cee4f8f25 (diff)
downloadsrc-f0fdcfe247c3927f40b1612388f9a35973d56728.tar.gz
src-f0fdcfe247c3927f40b1612388f9a35973d56728.zip
Notes
Diffstat (limited to 'usr.sbin/bhyvectl')
-rw-r--r--usr.sbin/bhyvectl/bhyvectl.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c
index 2e732b512595..ceee33a2aeeb 100644
--- a/usr.sbin/bhyvectl/bhyvectl.c
+++ b/usr.sbin/bhyvectl/bhyvectl.c
@@ -191,13 +191,16 @@ usage(void)
" [--get-highmem]\n"
" [--get-gpa-pmap]\n"
" [--assert-lapic-lvt=<pin>]\n"
- " [--inject-nmi]\n",
+ " [--inject-nmi]\n"
+ " [--force-reset]\n"
+ " [--force-poweroff]\n",
progname);
exit(1);
}
static int get_stats, getcap, setcap, capval, get_gpa_pmap;
static int inject_nmi, assert_lapic_lvt;
+static int force_reset, force_poweroff;
static const char *capname;
static int create, destroy, get_lowmem, get_highmem;
static uint64_t memsize;
@@ -565,6 +568,8 @@ main(int argc, char *argv[])
{ "create", NO_ARG, &create, 1 },
{ "destroy", NO_ARG, &destroy, 1 },
{ "inject-nmi", NO_ARG, &inject_nmi, 1 },
+ { "force-reset", NO_ARG, &force_reset, 1 },
+ { "force-poweroff", NO_ARG, &force_poweroff, 1 },
{ NULL, 0, NULL, 0 }
};
@@ -1535,6 +1540,12 @@ main(int argc, char *argv[])
printf("vm_run error %d\n", error);
}
+ if (!error && force_reset)
+ error = vm_suspend(ctx, VM_SUSPEND_RESET);
+
+ if (!error && force_poweroff)
+ error = vm_suspend(ctx, VM_SUSPEND_POWEROFF);
+
if (error)
printf("errno = %d\n", errno);