提交 c35c2fe7 编写于 作者: R Roman Bogorodskiy

bhyve: drop virProcessKillPainfully() from destroy

Current 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 unwanted 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.
上级 a4ef8057
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册