'Determine which VG to examine according to the pool name. Return: size vgs reports.
Pool name is the only indicator currently available from the Docker API driver info.
We assume a name that looks like "vg--name-docker--pool";
vg and lv names with inner hyphens doubled, joined by a hyphen.'

def get_vg_free(self, pool):

    match = re.match('((?:[^-]|--)+)-(?!-)', pool)
    if (not match):
        raise OpenShiftCheckException("This    host's    Docker    reports    it    is    using    a    storage    pool    named    '{}'.\nHowever    this    name    does    not    have    the    expected    format    of    'vgname-lvname'\nso    the    available    storage    in    the    VG    cannot    be    determined.".format(pool))
    vg_name = match.groups()[0].replace('--', '-')
    vgs_cmd = ('/sbin/vgs    --noheadings    -o    vg_free    --units    g    --select    vg_name=' + vg_name)
    ret = self.execute_module('command', {'_raw_params': vgs_cmd})
    if (ret.get('failed') or (ret.get('rc', 0) != 0)):
        raise OpenShiftCheckException(('Is    LVM    installed?    Failed    to    run    /sbin/vgs    to    determine    docker    storage    usage:\n' + ret.get('msg', '')))
    size = ret.get('stdout', '').strip()
    if (not size):
        raise OpenShiftCheckException("This    host's    Docker    reports    it    is    using    a    storage    pool    named    '{pool}'.\nwhich    we    expect    to    come    from    local    VG    '{vg}'.\nHowever,    /sbin/vgs    did    not    find    this    VG.    Is    Docker    for    this    hostrunning    and    using    the    storage    on    the    host?".format(pool=pool, vg=vg_name))
    return size
