summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2014-06-07 21:36:52 +0000
committerneel <neel@FreeBSD.org>2014-06-07 21:36:52 +0000
commit80a67d54c42b7f1e683d37864b9634e252d32ef1 (patch)
tree87873f56f85dfd15e0b36f4a2e884ae8dbcb74b3 /usr.sbin
parent39548e640ff6f29c6f53200627311914539728c3 (diff)
downloadFreeBSD-src-80a67d54c42b7f1e683d37864b9634e252d32ef1.zip
FreeBSD-src-80a67d54c42b7f1e683d37864b9634e252d32ef1.tar.gz
Add ioctl(VM_REINIT) to reinitialize the virtual machine state maintained
by vmm.ko. This allows the virtual machine to be restarted without having to destroy it first. Reviewed by: grehan
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bhyveload/bhyveload.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/usr.sbin/bhyveload/bhyveload.c b/usr.sbin/bhyveload/bhyveload.c
index c1a5432..4442496 100644
--- a/usr.sbin/bhyveload/bhyveload.c
+++ b/usr.sbin/bhyveload/bhyveload.c
@@ -642,7 +642,7 @@ main(int argc, char** argv)
void *h;
void (*func)(struct loader_callbacks *, void *, int, int);
uint64_t mem_size;
- int opt, error;
+ int opt, error, need_reinit;
progname = basename(argv[0]);
@@ -691,11 +691,14 @@ main(int argc, char** argv)
vmname = argv[0];
+ need_reinit = 0;
error = vm_create(vmname);
- if (error != 0 && errno != EEXIST) {
- perror("vm_create");
- exit(1);
-
+ if (error) {
+ if (errno != EEXIST) {
+ perror("vm_create");
+ exit(1);
+ }
+ need_reinit = 1;
}
ctx = vm_open(vmname);
@@ -704,6 +707,14 @@ main(int argc, char** argv)
exit(1);
}
+ if (need_reinit) {
+ error = vm_reinit(ctx);
+ if (error) {
+ perror("vm_reinit");
+ exit(1);
+ }
+ }
+
error = vm_setup_memory(ctx, mem_size, VM_MMAP_ALL);
if (error) {
perror("vm_setup_memory");
OpenPOWER on IntegriCloud