Page MenuHomeFreeBSD

D61266.1795026818.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D61266.1795026818.diff

diff --git a/usr.sbin/bhyve/ipc.c b/usr.sbin/bhyve/ipc.c
--- a/usr.sbin/bhyve/ipc.c
+++ b/usr.sbin/bhyve/ipc.c
@@ -97,6 +97,8 @@
pthread_set_name_np(pthread_self(), "IPC thread");
ctx = (struct ipc_thread_ctx *)param;
while ((fd = accept(ctx->sockfd, NULL, NULL)) != -1) {
+ bool suspended = false;
+
nvl = nvlist_recv(fd, 0);
if (nvl == NULL) {
EPRINTLN("%s: nvlist_recv() failed: %s", __func__,
@@ -119,12 +121,21 @@
nvlist_add_stringf(reply, "error", "command '%s' not found",
cmdname);
}
+ if (nvlist_exists_string(reply, "status") &&
+ strcmp(nvlist_get_string(reply, "status"), "suspended") == 0)
+ suspended = true;
+
/* The handler should set the error message if need be. */
nvlist_send(fd, reply);
nvlist_destroy(nvl);
nvlist_destroy(reply);
close(fd);
+
+ if (suspended) {
+ vm_destroy(ctx->vmctx);
+ exit(BHYVE_EXIT_SUSPEND);
+ }
}
return (NULL);
diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c
--- a/usr.sbin/bhyve/snapshot.c
+++ b/usr.sbin/bhyve/snapshot.c
@@ -1308,16 +1308,15 @@
xo_finish_h(xop);
- if (stop_vm) {
- vm_destroy(ctx);
- exit(BHYVE_EXIT_SUSPEND);
- }
+ if (stop_vm)
+ goto out;
done:
ret = vm_resume_devices();
if (ret != 0)
fprintf(stderr, "Could not resume devices\r\n");
vm_vcpu_resume(ctx);
+out:
if (fd_checkpoint > 0)
close(fd_checkpoint);
if (meta_filename != NULL)
@@ -1338,19 +1337,24 @@
{
int error;
nvlist_t *reply;
+ bool suspend = false;
reply = nvlist_create(0);
if (!nvlist_exists_string(nvl, "filename") ||
!nvlist_exists_bool(nvl, "suspend") ||
!nvlist_exists_descriptor(nvl, "fddir"))
error = EINVAL;
- else
+ else {
+ suspend = nvlist_get_bool(nvl, "suspend");
error = vm_checkpoint(ctx,
nvlist_get_descriptor(nvl, "fddir"),
nvlist_get_string(nvl, "filename"),
- nvlist_get_bool(nvl, "suspend"));
+ suspend);
+ }
if (error != 0)
nvlist_add_string(reply, "error", strerror(error));
+ else if (suspend)
+ nvlist_add_string(reply, "status", "suspended");
return (reply);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 18, 6:33 PM (9 m, 6 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41826969
Default Alt Text
D61266.1795026818.diff (2 KB)

Event Timeline