]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: only request sound cgroup ACL when required
authorEric Blake <eblake@redhat.com>
Fri, 25 Feb 2011 18:55:44 +0000 (11:55 -0700)
committerEric Blake <eblake@redhat.com>
Mon, 28 Feb 2011 16:42:25 +0000 (09:42 -0700)
When a SPICE or VNC graphics controller is present, and sound is
piggybacked over a channel to the graphics device rather than
directly accessing host hardware, then there is no need to grant
host hardware access to that qemu process.

* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Prevent sound with
spice, and with vnc when vnc_allow_host_audio is 0.
Reported by Daniel Berrange.

src/qemu/qemu_cgroup.c

index b39b5e13bd6fabee03c487ddd01f6b1d39af7870..e71d3fa7fb054a3d2926ad0eaca4f7c47f3fb1ab 100644 (file)
@@ -241,7 +241,11 @@ int qemuSetupCgroup(struct qemud_driver *driver,
             goto cleanup;
         }
 
-        if (vm->def->nsounds) {
+        if (vm->def->nsounds &&
+            (!vm->def->ngraphics ||
+             ((vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+               driver->vncAllowHostAudio) ||
+              (vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL)))) {
             rc = virCgroupAllowDeviceMajor(cgroup, 'c', DEVICE_SND_MAJOR);
             qemuDomainCgroupAudit(vm, cgroup, "allow", "major", "sound",
                                   rc == 0);