def force_clean(cid, client, emu): """ force unmounts and removes any block devices to prevent memory corruption """ driver = client.info()['Driver'] emu.unmount(force=True) # unmount path Mount.unmount_path(emu.tmp_image_dir,force=True) # if device mapper, do second unmount and remove device if driver == 'devicemapper': Mount.unmount_path(emu.tmp_image_dir,force=True) device = client.inspect_container(cid)['GraphDriver']['Data']['DeviceName'] Mount.remove_thin_device(device,force=True)