Bug 995543 - Add support for using /dev/loop-control for allocating loop devices
Summary: Add support for using /dev/loop-control for allocating loop devices
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ian Main
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-09 16:49 UTC by Daniel Berrangé
Modified: 2015-03-18 12:02 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-03-18 12:02:34 UTC
Embargoed:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.