ansible-community / molecule-libvirt

Molecule LibVirt Provider
https://github.com/ansible-community/molecule-libvirt/issues/13#issuecomment-1372615418
MIT License
35 stars 19 forks source link

Failed on allow qemu process read qcow2 images in home directory #44

Open alexanderbazhenoff opened 2 years ago

alexanderbazhenoff commented 2 years ago
$ molecule test -s kvm

TASK [Allow qemu process read qcow2 images in home directory] ******************
failed: [localhost -> localhost] (item=centos7-instance) => {"ansible_loop_var": "item", "changed": false, "cmd": "/usr/bin/setfacl --test -m user:qemu:x /home/user", "item": {"image_url": "https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2", "name": "centos7-instance"}, "msg": "setfacl: 
Option -m: Invalid argument near character 6", "rc": 2, "stderr": "setfacl: Option -m: Invalid argument near character 6\n", "stderr_lines": ["setfacl: Option -m: Invalid argument near character 6"], "stdout": "", "stdout_lines": []}

from running molecule.yml with a minimum of params:

cat molecule/kvm/molecule.yml

---

dependency:
  name: galaxy
  options:
    ignore-certs: True
    ignore-errors: True
driver:
  name: libvirt
platforms:
  - name: centos7-instance
    image_url: "https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2"
  ... 

Other infro:

$ ansible --version

ansible 2.10.17
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.8/site-packages/ansible
  executable location = /home/user/.local/bin//ansible
  python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]

 $ ls -lh /var/lib | grep libvirt
drwxr-xr-x 1 root          root            56 апр 28 16:45 libvirt
$ ls -lh /var/lib/libvirt | grep images
drwx--x--x 1 root         root  0 сен 27  2020 images

# Well, I have changed permissions of the folders, but it didn't helped. Still failed on -m option
$ sudo chmod 755 /var/lib/libvirt
$ sudo chmod 755 /var/lib/libvirt/images

$ cat /etc/group | grep qemu
libvirt-qemu:x:64055:libvirt-qemu
$ cat /etc/group | grep user | grep qemu
libvirt-qemu:x:64055:libvirt-qemu,user

$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:        20.04
Codename:       focal

Everything works fine from virt-manager, but molecule-libvirt not. May be I'll check this later, but at first here is a bug report.

heldner commented 2 years ago

It seems to be you don't have qemu user in system. Set qemu_user var to libvirt-qemu.