Bug 995543

Summary: Add support for using /dev/loop-control for allocating loop devices
Product: [Community] Virtualization Tools Reporter: Daniel Berrangé <berrange>
Component: libvirtAssignee: Ian Main <imain>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: imain, jtomko, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-18 12:02:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Daniel Berrangé 2013-08-09 16:49:15 UTC
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:

Comment 1 Ian Main 2013-08-26 19:54:06 UTC
Posted patch to resolve this bug.

https://www.redhat.com/archives/libvir-list/2013-August/msg01320.html

Comment 2 Ján Tomko 2015-03-18 12:02:34 UTC
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