def detach(dev=None):
    if dev is None:
        res = {}
        for dev, data in status(alldevs=True).items():
            if 'cache' in data:
                res[dev] = detach(dev)

        if len(res):
            return res
        else:
            return None

    log.debug('Detaching {0}'.format(dev))
    if not _bcsys(dev, 'detach', 'goaway', 'error', 'Error detaching {0}'.format(dev)):
        return False
    return _wait(lambda: uuid(dev) is False, 'error', '{0} received detach, but did not comply'.format(dev), 300)
Detach a backing device(s) from a cache set
dataset/ETHPy150Open saltstack/salt/salt/modules/bcache.py/detach