[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [sandbox][PATCH] Fix delete of running containers



The stop function is removed since 0.5.0, update delete function
using virsh destroy to stop container.

Signed-off-by: Wayne Sun <gsun redhat com>
---
 bin/virt-sandbox-service |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index 550d46c..926d1d5 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -254,9 +254,11 @@ class Container:
 
     def delete(self):
         self.connect()
-        # Stop service if it is running
+        # Stop container if it is running
         try:
-            self.stop()
+            p = Popen(["/usr/bin/virsh", "-c", self.uri, "destroy", self.name],
+                      stdout=PIPE, stderr=PIPE)
+            p.communicate()
         except:
             pass
 
-- 
1.7.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]