Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit 07f205b

Browse files
ssbarneaapatard
andauthored
Enable testing with ubuntu-bionic (#69)
* Enable testing with ubuntu-bionic * tools/test-setup.sh: Fix libvirt access Most distributions relies on unix rights to configure libvirt socket access, so the user has to be added to the 'libvirt' group to use it. The challenge is that it implies login/logout. The workaround to use newgrp is failing since it's spawning a new shell, so the group change is not applied to current shell. As a solution, use policykit to handle the access rights to the unix socket. It's the same thing as for unix rights, except that policykit doesn't rely on the current shell, so no need to login/logout to get the group change applied. Signed-off-by: Arnaud Patard <[email protected]> Co-authored-by: Arnaud Patard <[email protected]>
1 parent 0d7be03 commit 07f205b

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

README.rst

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ multiple platforms but some are disabled due to known bugs.
3737

3838
* ✅ MacOS with VirtualBox - GitHub Actions
3939
* ✅ Fedora 32 with libvirt - Zuul
40+
* ✅ Ubuntu Bionic (18.04) with libvirt - Zuul
4041
* ❌ CentOS 8 with libvirt - Zuul DISABLED due to 1127_ and 11020_
4142

4243
Please **do not file bugs for unsupported platforms**. You are welcomed to

tools/test-setup.sh

+18-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,20 @@ sudo $PYTHON -m pip install -U tox
2222

2323
# === LIBVIRT SETUP ===
2424
sudo systemctl enable --now libvirtd
25+
sudo sed \
26+
-e 's!^[# ]*unix_sock_rw_perms = .*$!unix_sock_rw_perms = "0777"!g' \
27+
-e 's!^[# ]*auth_unix_rw = .*$!auth_unix_rw = "polkit"!g' -i /etc/libvirt/libvirtd.conf
28+
# on fedora, looks like virbr0 iface stays there after a restart of libvirt but the network is not
29+
# started back, leading to network failure when the script tries to start the network
30+
if sudo virsh net-list --name | grep -qw default; then
31+
sudo virsh net-destroy default
32+
fi
33+
sudo systemctl restart libvirtd
2534
sudo usermod --append --groups libvirt "$(whoami)"
35+
# on some dists, it's auto-started, on some others, it's not
36+
if virsh -c qemu:///system net-list --name --inactive | grep -qw default; then
37+
virsh -c qemu:///system net-start default
38+
fi
2639

2740
# only info about the virtualisation is wanted, so no error please.
2841
sudo virt-host-validate qemu || true
@@ -128,8 +141,8 @@ vagrant plugin list | tee >(grep -q "No plugins installed." && {
128141
cd $DIR
129142

130143
# sudo su: dirty hack to make sure that usermod change has been taken into account
131-
sudo su -l "$(whoami)" -c "cd $(pwd) && timeout 300 vagrant up --no-tty --debug"
132-
sudo su -l "$(whoami)" -c "cd $(pwd) && timeout 300 vagrant halt"
133-
sudo su -l "$(whoami)" -c "cd $(pwd) && timeout 300 vagrant package --output testbox.box"
134-
sudo su -l "$(whoami)" -c "cd $(pwd) && vagrant box add testbox.box --name testbox"
135-
sudo su -l "$(whoami)" -c "cd $(pwd) && vagrant destroy -f"
144+
timeout 300 vagrant up --no-tty --debug
145+
timeout 300 vagrant halt
146+
timeout 300 vagrant package --output testbox.box
147+
vagrant box add testbox.box --name testbox
148+
vagrant destroy -f

zuul.d/layout.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@
3333
# tox_envlist: devel
3434
# timeout: 3600
3535

36+
- job:
37+
name: molecule-vagrant-ubuntu-bionic
38+
description: Run py36 tox environment
39+
parent: ansible-tox-py36
40+
nodeset: ubuntu-bionic-1vcpu
41+
attempts: 2
42+
vars:
43+
tox_envlist: py36
44+
timeout: 3600
45+
3646
- project:
3747
check:
3848
jobs: &defaults
@@ -43,5 +53,6 @@
4353
# - molecule-vagrant-centos
4454
- molecule-vagrant-fedora
4555
# - molecule-vagrant-devel-centos
56+
- molecule-vagrant-ubuntu-bionic
4657
gate:
4758
jobs: *defaults

0 commit comments

Comments
 (0)