mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
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.
This commit is contained in:
parent
a4ef805758
commit
c35c2fe78e
@ -278,26 +278,18 @@ virBhyveProcessStop(bhyveConnPtr driver,
|
||||
return -1;
|
||||
}
|
||||
|
||||
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;
|
||||
return -1;
|
||||
|
||||
if (virCommandRun(cmd, NULL) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if ((priv != NULL) && (priv->mon != NULL))
|
||||
bhyveMonitorClose(priv->mon);
|
||||
|
||||
/* Cleanup network interfaces */
|
||||
bhyveNetCleanup(vm);
|
||||
|
||||
ret = 0;
|
||||
|
||||
virCloseCallbacksUnset(driver->closeCallbacks, vm,
|
||||
|
Loading…
x
Reference in New Issue
Block a user