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

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



On 08/07/2013 08:08 PM, Daniel P. Berrange wrote:
On Wed, Aug 07, 2013 at 07:56:05PM +0800, Wayne Sun wrote:
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
Hmm, I'm not convinced that we should allow deletion of sanboxes that
are running at all. IMHO it is better if we just report an error to the
admin if they attempt to delete a running sandbox, since I think that
would commonly be a mistake they should be protected from.

Daniel
Yes, the right logic is not allow it, i'll work on v2 for this.

Thanks!
Wayne Sun


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