From: Michal Privoznik <mpriv...@redhat.com>

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 <mpriv...@redhat.com>
---
 src/ch/ch_driver.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

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;
     }
 
-- 
2.49.1

Reply via email to