From: Roman Bogorodskiy Date: Sun, 21 Sep 2025 18:16:42 +0000 (+0200) Subject: bhyve: hooks: improve process start error handling X-Git-Tag: v11.8.0-rc2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9d57b562bdbf35945d9e9ac3220a27d1989115af;p=thirdparty%2Flibvirt.git bhyve: hooks: improve process start error handling When the virBhyveProcessStart() fails early, make sure to execute the "stopped" and "release" hooks. Spotted while running TCK hooks tests against the bhyve driver. Signed-off-by: Roman Bogorodskiy Reviewed-by: Martin Kletzander --- diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 4bfd511bae..4fb7e642e1 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -413,18 +413,24 @@ virBhyveProcessStart(bhyveConn *driver, { /* Run an early hook to setup missing devices. */ if (bhyveProcessStartHook(driver, vm, VIR_HOOK_BHYVE_OP_PREPARE) < 0) - return -1; + goto cleanup; if (flags & VIR_BHYVE_PROCESS_START_AUTODESTROY) virCloseCallbacksDomainAdd(vm, conn, bhyveProcessAutoDestroy); if (bhyveProcessPrepareDomain(driver, vm, flags) < 0) - return -1; + goto cleanup; if (bhyveProcessPrepareHost(driver, vm->def, flags) < 0) - return -1; + goto cleanup; return virBhyveProcessStartImpl(driver, vm, reason); + + cleanup: + bhyveProcessStopHook(driver, vm, VIR_HOOK_BHYVE_OP_STOPPED); + bhyveProcessStopHook(driver, vm, VIR_HOOK_BHYVE_OP_RELEASE); + + return -1; } static void