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

Wayne Sun gsun at redhat.com
Wed Aug 7 11:56:05 UTC 2013


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

Signed-off-by: Wayne Sun <gsun at 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




More information about the libvir-list mailing list