- if os.path.exists(containerDir):
- # oh no, it's still here...
- logger.log("WARNING: failed to destroy container %s" % containerDir)
+ if not os.path.exists(containerDir):
+ logger.log('sliver_lxc.destroy: %s cleanly destroyed.'%name)
+ else:
+ # oh no, it's still here...
+ logger.log("sliver_lxc.destroy: 1st warning: could not delete %s" % containerDir)
+ # this is for debugging but does not seem to be of much use
+ logger.log_call (['lsof'])
+ # what I can see on running nodes is that a second subvolume delete seems to do the trick here
+ # so let's check if that could be a workaround
+ logger.log("sliver_lxc.destroy: 2nd attempt at btrfs subvolume delete %s" % containerDir)
+ command = ['btrfs', 'subvolume', 'delete', containerDir]
+ logger.log_call(command, timeout=60)
+ if not os.path.exists(containerDir):
+ logger.log("sliver_lxc.destroy: WARNING: failed to delete %s after 2 attempts"%containerDir)