]> xenbits.xensource.com Git - libvirt.git/commitdiff
Teach virt-aa-helper to use TEMPLATE.qemu if the domain is kvm or kqemu
authorCédric Bosdonnat <cbosdonnat@suse.com>
Tue, 28 Oct 2014 20:42:34 +0000 (14:42 -0600)
committerCédric Bosdonnat <cbosdonnat@suse.com>
Wed, 29 Oct 2014 21:11:59 +0000 (15:11 -0600)
src/security/virt-aa-helper.c

index 9afc8db15c1aa429341c0ec8f0ab73f50e408a79..1f299a056d848cb8c498590218e2822f091c91a4 100644 (file)
@@ -341,15 +341,25 @@ create_profile(const char *profile, const char *profile_name,
     int tlen, plen;
     int fd;
     int rc = -1;
+    const char *driver_name = NULL;
 
     if (virFileExists(profile)) {
         vah_error(NULL, 0, _("profile exists"));
         goto end;
     }
 
+    switch (virtType) {
+    case VIR_DOMAIN_VIRT_QEMU:
+    case VIR_DOMAIN_VIRT_KQEMU:
+    case VIR_DOMAIN_VIRT_KVM:
+        driver_name = "qemu";
+        break;
+    default:
+        driver_name = virDomainVirtTypeToString(virtType);
+    }
 
     if (virAsprintfQuiet(&template, "%s/TEMPLATE.%s", APPARMOR_DIR "/libvirt",
-                         virDomainVirtTypeToString(virtType)) < 0) {
+                         driver_name) < 0) {
         vah_error(NULL, 0, _("template name exceeds maximum length"));
         goto end;
     }