From: Michal Privoznik Date: Tue, 9 Sep 2025 11:39:46 +0000 (+0200) Subject: ch: Implement VIR_DOMAIN_DESTROY_GRACEFUL flag support X-Git-Tag: v11.8.0-rc1~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f35a1def9d7543e10f60ba3af847321d2a218b3e;p=thirdparty%2Flibvirt.git ch: Implement VIR_DOMAIN_DESTROY_GRACEFUL flag support The virDomainDestroyFlags() API has several flags, including VIR_DOMAIN_DESTROY_GRACEFUL which is documented to send only SIGTERM to the emulator process. Implement its support into CH driver. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 019994b202..0a516f3384 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -670,9 +670,13 @@ chDomainDestroyFlags(virDomainPtr dom, unsigned int flags) virCHDriver *driver = dom->conn->privateData; virDomainObj *vm; virObjectEvent *event = NULL; + unsigned int stopFlags = 0; int ret = -1; - virCheckFlags(0, -1); + virCheckFlags(VIR_DOMAIN_DESTROY_GRACEFUL, -1); + + if (!(flags & VIR_DOMAIN_DESTROY_GRACEFUL)) + stopFlags |= VIR_CH_PROCESS_STOP_FORCE; if (!(vm = virCHDomainObjFromDomain(dom))) goto cleanup; @@ -687,8 +691,7 @@ chDomainDestroyFlags(virDomainPtr dom, unsigned int flags) goto endjob; if (virCHProcessStop(driver, vm, - VIR_DOMAIN_SHUTOFF_DESTROYED, - VIR_CH_PROCESS_STOP_FORCE) < 0) { + VIR_DOMAIN_SHUTOFF_DESTROYED, stopFlags) < 0) { goto endjob; }