summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bhyveload
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2014-08-17 01:00:42 +0000
committergrehan <grehan@FreeBSD.org>2014-08-17 01:00:42 +0000
commit7a365d2c053ebcca4ab5c48af1d3e404e5db0159 (patch)
treed0a923d882ace027d5d1341c58694ac5860fc7ff /usr.sbin/bhyveload
parente83027edbbda961289c2ed185571fb6272b4f756 (diff)
downloadFreeBSD-src-7a365d2c053ebcca4ab5c48af1d3e404e5db0159.zip
FreeBSD-src-7a365d2c053ebcca4ab5c48af1d3e404e5db0159.tar.gz
MFC r267216
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.
Diffstat (limited to 'usr.sbin/bhyveload')
-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