[sandbox][PATCH] Fix delete of running containers

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

 



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

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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]