- 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)
-
-
+ # this is more of a way to try and understand what is going on here
+ # than a real solution to anything
+ pass_no=1
+ max_passes=2
+ while pass_no <= max_passes:
+ command = ['rm', '-rf', containerDir]
+ logger.log("sliver_lxc.destroy: cleanup pass %d - command %s"%(pass_no,command))
+ logger.log_call(command, timeout=5)
+ command = ['btrfs', 'subvolume', 'delete', containerDir]
+ logger.log("sliver_lxc.destroy: cleanup pass %d - command %s"%(pass_no,command))
+ logger.log_call(command, timeout=5)
+ import time
+ time.sleep(1)
+ pass_no += 1
+ if os.path.exists(containerDir):
+ logger.log('sliver_lxc.destroy: could not cleanly destroy %s - giving up'%name)
+
+ if vsys_stopped: vsysStartService()