def _libvirt_creds():
    '''
    Returns the user and group that the disk images should be owned by
    '''
    g_cmd = 'grep ^\\s*group /etc/libvirt/qemu.conf'
    u_cmd = 'grep ^\\s*user /etc/libvirt/qemu.conf'
    try:
        stdout = subprocess.Popen(g_cmd,
                    shell=True,
                    stdout=subprocess.PIPE).communicate()[0]
        group = salt.utils.to_str(stdout).split('"')[1]
    except __HOLE__:
        group = 'root'
    try:
        stdout = subprocess.Popen(u_cmd,
                    shell=True,
                    stdout=subprocess.PIPE).communicate()[0]
        user = salt.utils.to_str(stdout).split('"')[1]
    except IndexError:
        user = 'root'
    return {'user': user, 'group': group}
dataset/ETHPy150Open saltstack/salt/salt/modules/virt.py/_libvirt_creds