]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ch: Implement VIR_DOMAIN_DESTROY_GRACEFUL flag support
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 9 Sep 2025 11:39:46 +0000 (13:39 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Sep 2025 06:35:25 +0000 (08:35 +0200)
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 <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/ch/ch_driver.c

index 019994b202d9c348b29c3d99bd09832876080e6f..0a516f33848a225f447d8ecee354b31ceb3bba01 100644 (file)
@@ -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;
     }