File 6b3fb86b-increase-libvirtd-task-limit.patch of Package libvirt.6159

commit 6b3fb86b391da731d1a0667c35a8e9f8b5c1d6c5
Author: Jim Fehlig <jfehlig@suse.com>
Date:   Wed Apr 19 12:54:33 2017 -0600

    Increase default task limit for libvirtd
    
    libvirtd can spawn threads/tasks when creating new domains for
    some hypervisors such as Xen's libxl driver, quickly reaching
    the cgroups pids controller default TasksMax setting of 512. When
    the limit is reached, attempting to create additional domains
    results in an error from the cgroups pids controller, e.g.
    
    kernel: [71282.213347] cgroup: fork rejected by pids controller in
    /system.slice/libvirtd.service
    
    Depending on domain type and configuration, anywhere from 4-7
    threads/tasks may be created by libxl when starting a domain.
    In order to support 4096 domains, similar to commit 27cd763500,
    increase the TasksMax setting in libvirtd.service to
    4096 * 8 = 32768 tasks.

Index: libvirt-2.0.0/daemon/libvirtd.service.in
===================================================================
--- libvirt-2.0.0.orig/daemon/libvirtd.service.in
+++ libvirt-2.0.0/daemon/libvirtd.service.in
@@ -28,6 +28,11 @@ Restart=on-failure
 # If changing this, also consider virtlogd.service & virtlockd.service
 # limits which are also related to number of guests
 LimitNOFILE=8192
+# The cgroups pids controller can limit the number of tasks started by
+# the daemon, which can limit the number of domains for some hypervisors.
+# A conservative default of 8 tasks per guest results in a TasksMax of
+# 32k to support 4096 guests.
+TasksMax=32768
 
 [Install]
 WantedBy=multi-user.target