Browse code

Merge "Fix polkit configuration to allow usage of libvirt on openSUSE"

Jenkins authored on 2012/12/13 03:51:19
Showing 1 changed files
... ...
@@ -229,10 +229,13 @@ EOF
229 229
         if is_ubuntu; then
230 230
             LIBVIRT_DAEMON=libvirt-bin
231 231
         else
232
-            # http://wiki.libvirt.org/page/SSHPolicyKitSetup
233
-            if ! getent group libvirtd >/dev/null; then
234
-                sudo groupadd libvirtd
235
-            fi
232
+            LIBVIRT_DAEMON=libvirtd
233
+        fi
234
+
235
+        # For distributions using polkit to authorize access to libvirt,
236
+        # configure polkit accordingly.
237
+        # Based on http://wiki.libvirt.org/page/SSHPolicyKitSetup
238
+        if is_fedora; then
236 239
             sudo bash -c 'cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
237 240
 [libvirt Management Access]
238 241
 Identity=unix-group:libvirtd
... ...
@@ -241,11 +244,24 @@ ResultAny=yes
241 241
 ResultInactive=yes
242 242
 ResultActive=yes
243 243
 EOF'
244
-            LIBVIRT_DAEMON=libvirtd
244
+        elif is_suse; then
245
+            # Work around the fact that polkit-default-privs overrules pklas
246
+            # with 'unix-group:$group'.
247
+            sudo bash -c "cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
248
+[libvirt Management Access]
249
+Identity=unix-user:$USER
250
+Action=org.libvirt.unix.manage
251
+ResultAny=yes
252
+ResultInactive=yes
253
+ResultActive=yes
254
+EOF"
245 255
         fi
246 256
 
247 257
         # The user that nova runs as needs to be member of **libvirtd** group otherwise
248 258
         # nova-compute will be unable to use libvirt.
259
+        if ! getent group libvirtd >/dev/null; then
260
+            sudo groupadd libvirtd
261
+        fi
249 262
         add_user_to_group `whoami` libvirtd
250 263
 
251 264
         # libvirt detects various settings on startup, as we potentially changed