From fdc12c02616ed5b342630cab90d01e85f43cfc1f Mon Sep 17 00:00:00 2001 From: smbaker Date: Mon, 10 Dec 2012 17:51:31 -0800 Subject: [PATCH] fix slices that use vsys not deleted correctly --- sliver_lxc.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sliver_lxc.py b/sliver_lxc.py index d4335c4..d61109b 100644 --- a/sliver_lxc.py +++ b/sliver_lxc.py @@ -4,6 +4,7 @@ import subprocess import sys +import time import os, os.path import grp from pwd import getpwnam @@ -221,9 +222,21 @@ class Sliver_LXC(Sliver_Libvirt, Initscript): command = ['/usr/sbin/userdel', '-f', '-r', name] logger.log_call(command, timeout=15*60) + if os.path.exists(os.path.join(containerDir,"vsys")): + # Slivers with vsys running will fail the subvolume delete. + # A more permanent solution may be to ensure that the vsys module + # is called before the sliver is destroyed. + logger.log("destroying vsys directory and restarting vsys") + logger.log_call(["rm", "-fR", os.path.join(containerDir, "vsys")]) + logger.log_call(["/etc/init.d/vsys", "restart", ]) + # Remove rootfs of destroyed domain command = ['btrfs', 'subvolume', 'delete', containerDir] logger.log_call(command, timeout=60) + if os.path.exists(containerDir): + # oh no, it's still here... + logger.log("WARNING: failed to destroy container %s" % containerDir) + logger.verbose('sliver_libvirt: %s destroyed.'%name) -- 2.43.0