Description of problem: Currently virFileLoopDeviceOpen iterates over /dev identifying loop devices and then checking if they are in use or not. There is a fairly new /dev/loop-control device that avoids this insanity and also lets you dynamically create new loop devices as needed https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=770fe30a46a12b6fb6b63fbe1737654d28e84844 Libvirt should use this code and only fallback to its existing impl, if /dev/loop-control does not exist Version-Release number of selected component (if applicable): 1.1.1 How reproducible: Always Steps to Reproduce: 1. Attempt to start more than 8 LXC guests whcih use loop devices (ie type=file) <filesystem type='file' accessmode='passthrough'> <source file='/var/lib/libvirt/images/demoNNNN.img'/> <target dir='/mnt'/> </filesystem> Actual results: Failed to start 9th guest due to non-existant loop8 device. Expected results: Can start many more guests Additional info:
Posted patch to resolve this bug. https://www.redhat.com/archives/libvir-list/2013-August/msg01320.html
commit 9ba230d4f2f031e2fda2b6aa98a290394c2ddaaf Author: Ian Main <imain> AuthorDate: 2013-09-05 12:04:33 +0100 Commit: Daniel P. Berrange <berrange> CommitDate: 2013-09-05 12:31:08 +0100 Use loop-control to allocate loop device. This patch changes virFileLoopDeviceOpen() to use the new loop-control device to allocate a new loop device. If this behavior is unsupported we fall back to the previous method of searching /dev for a free device. With this patch you can start as many image based LXC domains as you like (well almost). Fixes bug https://bugzilla.redhat.com/show_bug.cgi?id=995543 git describe: v1.1.2-67-g9ba230d contains: v1.1.3-rc1~210