Currentt implementation of domainDestroy for bhyve calls virProcessKillPainfully() for the bhyve process and then executes "bhyvectl --destroy". This is wrong for two reasons: * bhyvectl --destroy alone is sufficient because it terminates the process * virProcessKillPainfully() first sends SIGTERM and after few attempts sends SIGKILL. As SIGTERM triggers ACPI shutdown that we're not interested in, it creates an unwatned side effect in domainDestroy. Also, destroy monitor only after "bhyvectl --destroy" command succeeded to avoid a case when the command fails and domain remains running, but not being monitored anymore. --- src/bhyve/bhyve_process.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 14588a9..fe61a9a 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -278,26 +278,18 @@ virBhyveProcessStop(bhyveConnPtr driver, return -1; } + if (!(cmd = virBhyveProcessBuildDestroyCmd(driver, vm->def))) + return -1; + + if (virCommandRun(cmd, NULL) < 0) + goto cleanup; + if ((priv != NULL) && (priv->mon != NULL)) bhyveMonitorClose(priv->mon); - /* First, try to kill 'bhyve' process */ - if (virProcessKillPainfully(vm->pid, true) != 0) - VIR_WARN("Failed to gracefully stop bhyve VM '%s' (pid: %d)", - vm->def->name, - (int)vm->pid); - /* Cleanup network interfaces */ bhyveNetCleanup(vm); - /* No matter if shutdown was successful or not, we - * need to unload the VM */ - if (!(cmd = virBhyveProcessBuildDestroyCmd(driver, vm->def))) - goto cleanup; - - if (virCommandRun(cmd, NULL) < 0) - goto cleanup; - ret = 0; virCloseCallbacksUnset(driver->closeCallbacks, vm, -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list