Currently, domain autodestroy does not work with the bhyve driver.
The bhyveDomainCreateWithFlags() has:

  virCheckFlags(VIR_DOMAIN_START_AUTODESTROY, -1);

And it passes this flag to virBhyveProcessStart() which in its turn
calls bhyveProcessPrepareDomain() and bhyveProcessPrepareHost()
passing these flags.

However, both bhyveProcessPrepareDomain() and bhyveProcessPrepareHost()
call virCheckFlags(0, -1), so the VIR_DOMAIN_START_AUTODESTROY flag
is not accepted, thus autodestroy fails.

Fix by accepting the VIR_DOMAIN_START_AUTODESTROY flag
in both bhyveProcessPrepareDomain() and bhyveProcessPrepareHost().

Signed-off-by: Roman Bogorodskiy <[email protected]>
---
 src/bhyve/bhyve_process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 001ee59130..122dc3de99 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -640,7 +640,7 @@ bhyveProcessPrepareDomain(bhyveConn *driver,
                           virDomainObj *vm,
                           unsigned int flags)
 {
-    virCheckFlags(0, -1);
+    virCheckFlags(VIR_BHYVE_PROCESS_START_AUTODESTROY, -1);
 
     if (bhyveFirmwareFillDomain(driver, vm->def, false) < 0)
         return -1;
@@ -769,7 +769,7 @@ bhyveProcessPrepareHost(bhyveConn *driver,
                         virDomainDef *def,
                         unsigned int flags)
 {
-    virCheckFlags(0, -1);
+    virCheckFlags(VIR_BHYVE_PROCESS_START_AUTODESTROY, -1);
 
     if (bhyvePrepareNVRAM(driver, def) < 0)
         return -1;
-- 
2.56.0

Reply via email to