Get unix_sock_group & config_sys as an option
- unix_sock_group: libvirt 3.x from UCA repo by default uses
"libvirt" group for socket ownership, so get the name
of the group from pillar if given.
- config_sys: handle sysconfig file location
defined in parameters.
Change-Id: I06dd3707efc191a81af1cf60d8dbeef4e9ea5964
diff --git a/README.rst b/README.rst
index 7748e87..c94bb69 100644
--- a/README.rst
+++ b/README.rst
@@ -14,6 +14,7 @@
libvirt:
server:
enabled: true
+ unix_sock_group: libvirt
virtualizations:
- kvm
network:
diff --git a/libvirt/files/libvirtd.conf.Debian b/libvirt/files/libvirtd.conf.Debian
index 25814b1..f6b1e67 100644
--- a/libvirt/files/libvirtd.conf.Debian
+++ b/libvirt/files/libvirtd.conf.Debian
@@ -1,3 +1,4 @@
+{%- from "libvirt/map.jinja" import server with context -%}
# Master libvirt daemon configuration file
#
# For further information consult http://libvirt.org/format.html
@@ -81,7 +82,7 @@
# without becoming root.
#
# This is restricted to 'root' by default.
-unix_sock_group = "libvirtd"
+unix_sock_group = "{{ server.get('unix_sock_group', 'libvirtd') }}"
# Set the UNIX socket permissions for the R/O socket. This is used
# for monitoring VM status only
diff --git a/libvirt/server/service.sls b/libvirt/server/service.sls
index aa6fb41..eaa0cd8 100644
--- a/libvirt/server/service.sls
+++ b/libvirt/server/service.sls
@@ -29,19 +29,18 @@
libvirt_sysconfig:
file.managed:
- - name: /etc/sysconfig/libvirtd
+ - name: {{ server.config_sys }}
- contents: 'LIBVIRTD_ARGS="--listen"'
- require:
- pkg: libvirt_packages
- watch_in:
- service: libvirt_service
-{%- endif %}
+{%- elif grains.os_family == 'Debian' %}
-{%- if grains.os_family == 'Debian' %}
-
-/etc/default/libvirt-bin:
+libvirt_sysconfig:
file.managed:
+ - name: {{ server.config_sys }}
- source: salt://libvirt/files/libvirt-bin
- template: jinja
- require:
@@ -54,7 +53,7 @@
module.wait:
- name: service.systemctl_reload
- watch:
- - file: /etc/default/libvirt-bin
+ - file: libvirt_sysconfig
- require_in:
- service: libvirt_service
diff --git a/tests/pillar/simple.sls b/tests/pillar/simple.sls
index 0cb2712..bb70d2a 100644
--- a/tests/pillar/simple.sls
+++ b/tests/pillar/simple.sls
@@ -1,8 +1,9 @@
libvirt:
server:
enabled: true
+ unix_sock_group: libvirtd
virtualizations:
- kvm
network:
default:
- ensure: absent
\ No newline at end of file
+ ensure: absent