from unittest.mock import call


def get_scratch_lvs(vg_name):
    """
    Return a list of all scratch LVs.
    """

    ret, stdout, _ = call(
            ['/sbin/lvm', 'lvs', '-o', 'name', vg_name], ignoreErrors=True)
    if ret:
        raise RuntimeError("Volume group %s could not be read" % (vg_name,))

    return [x.strip() for x in stdout.splitlines()
            if x.strip().startswith('scratch_')]