← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1543181] [NEW] Raw and qcow2 disks are never preallocated on systems with newer util-linux

 

Public bug reported:

imagebackend.Image._can_fallocate tests if fallocate works by running
the following command:

  fallocate -n -l 1 <image path>.fallocate_test

where <image path> exists, but <image path>.fallocate_test does not.
This command line is copied from the code which actually fallocates a
disk. However, while this works on systems with an older version of
util-linux, such as RHEL 7, it does not work on systems with a newer
version of util-linux, such as Fedora 23. The result of this is that
this test will always fail, and preallocation with fallocate will be
erroneously disabled.

On RHEL 7, which has util-linux-2.23.2-26.el7.x86_64 on my system:

$ fallocate -n -l 1 foo
$ ls -lh foo
-rw-r--r--. 1 mbooth mbooth 0 Feb  8 15:33 foo
$ du -sh foo
4.0K	foo

On Fedora 23, which has util-linux-2.27.1-2.fc23.x86_64 on my system:

$ fallocate -n -l 1 foo
fallocate: cannot open foo: No such file or directory

The F23 behaviour actually makes sense. From the fallocate man page:

      -n, --keep-size
              Do  not modify the apparent length of the file.

This doesn't make any sense if the file doesn't exist. That is, the -n
option makes sense when preallocating an existing disk image, but not
when testing if fallocate works on a given filesystem and the test file
doesn't already exist.

You could also reasonably argue that util-linux probably should be
breaking an interface like this, even when misused. However, that's a
separate discussion. We shouldn't be misusing it.

** Affects: nova
     Importance: Undecided
     Assignee: Matthew Booth (mbooth-9)
         Status: In Progress

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1543181

Title:
  Raw and qcow2 disks are never preallocated on systems with newer util-
  linux

Status in OpenStack Compute (nova):
  In Progress

Bug description:
  imagebackend.Image._can_fallocate tests if fallocate works by running
  the following command:

    fallocate -n -l 1 <image path>.fallocate_test

  where <image path> exists, but <image path>.fallocate_test does not.
  This command line is copied from the code which actually fallocates a
  disk. However, while this works on systems with an older version of
  util-linux, such as RHEL 7, it does not work on systems with a newer
  version of util-linux, such as Fedora 23. The result of this is that
  this test will always fail, and preallocation with fallocate will be
  erroneously disabled.

  On RHEL 7, which has util-linux-2.23.2-26.el7.x86_64 on my system:

  $ fallocate -n -l 1 foo
  $ ls -lh foo
  -rw-r--r--. 1 mbooth mbooth 0 Feb  8 15:33 foo
  $ du -sh foo
  4.0K	foo

  On Fedora 23, which has util-linux-2.27.1-2.fc23.x86_64 on my system:

  $ fallocate -n -l 1 foo
  fallocate: cannot open foo: No such file or directory

  The F23 behaviour actually makes sense. From the fallocate man page:

        -n, --keep-size
                Do  not modify the apparent length of the file.

  This doesn't make any sense if the file doesn't exist. That is, the -n
  option makes sense when preallocating an existing disk image, but not
  when testing if fallocate works on a given filesystem and the test
  file doesn't already exist.

  You could also reasonably argue that util-linux probably should be
  breaking an interface like this, even when misused. However, that's a
  separate discussion. We shouldn't be misusing it.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1543181/+subscriptions


Follow ups