Bug 995543 - Add support for using /dev/loop-control for allocating loop devices
Add support for using /dev/loop-control for allocating loop devices
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ian Main
Depends On:
  Show dependency treegraph
Reported: 2013-08-09 12:49 EDT by Daniel Berrange
Modified: 2015-03-18 08:02 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-03-18 08:02:34 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Daniel Berrange 2013-08-09 12:49:15 EDT
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


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):

How reproducible:

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'/>

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 15:54:06 EDT
Posted patch to resolve this bug.

Comment 2 Ján Tomko 2015-03-18 08:02:34 EDT
commit 9ba230d4f2f031e2fda2b6aa98a290394c2ddaaf
Author:     Ian Main <imain@redhat.com>
AuthorDate: 2013-09-05 12:04:33 +0100
Commit:     Daniel P. Berrange <berrange@redhat.com>
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.