def get_docker_storage_driver():
    driver = None

    # Step 1.a, get it from /proc/mounts

    try:
        for l in open('/proc/mounts', 'r'):
            (
                _,
                mnt,
                fstype,
                options,
                _,
                _,
            ) = l.split(' ')
            if mnt == '/var/lib/docker/devicemapper':
                driver = 'devicemapper'
                break
            elif mnt == '/var/lib/docker/btrfs':
                driver = 'btrfs'
                break
            elif mnt == '/var/lib/docker/aufs':
                driver = 'aufs'
                break
    except Exception:
        logger.debug('Could not read /proc/mounts')
    if driver in ('btrfs', 'devicemapper', 'aufs'):
        return driver

    # Step 1.b, get it from /proc/mounts but allow
    # some more freedom in the mount point.

    try:
        for l in open('/proc/mounts', 'r'):
            (
                _,
                mnt,
                fstype,
                options,
                _,
                _,
            ) = l.split(' ')
            if 'docker' in mnt and 'devicemapper' in mnt:
                driver = 'devicemapper'
                break
            elif 'docker' in mnt and 'btrfs' in mnt:
                driver = 'btrfs'
                break
            elif 'docker' in mnt and 'aufs' in mnt:
                driver = 'aufs'
                break
    except Exception:
        logger.debug('Could not read /proc/mounts')
    if driver in ('btrfs', 'devicemapper', 'aufs'):
        return driver

    # Step 2, get it from "docker info"

    try:
        proc = subprocess.Popen(
            "docker info | grep 'Storage Driver' | awk -F: '{print $2}'",
            shell=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE)
        driver = proc.stdout.read().strip()
    except Exception:
        logger.debug('Could not run docker info')

    # Step 3, we default to "devicemapper" (last resort)

    if driver not in ('btrfs', 'devicemapper', 'aufs'):

        # We will take our risk and default to devicemapper

        driver = 'devicemapper'
    return driver
Return array of random doubles in the half-open interval [0.0, 1.0).
dataset/ETHPy150Open cloudviz/agentless-system-crawler/crawler/dockerutils.py/get_docker_storage_driver--crossover with--dataset/ETHPy150Open IEEERobotics/bot/bot/hardware/complex_hardware/transformations.py/random_vector