yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #46079
[Bug 1543181] Re: Raw and qcow2 disks are never preallocated on systems with newer util-linux
Reviewed: https://review.openstack.org/277402
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=33749d2875b4e63ad8f663a734cd087980489b6e
Submitter: Jenkins
Branch: master
commit 33749d2875b4e63ad8f663a734cd087980489b6e
Author: Matthew Booth <mbooth@xxxxxxxxxx>
Date: Mon Feb 8 12:41:06 2016 +0000
Fix fallocate test on newer util-linux
Newer util-linux raises an error when calling fallocate with the -n
option if the target file does not already exist. This is because the
-n option directs it to retain the file's existing size. A
non-existent file does not have an existing size. fallocate in older
releases of util-linux creates a zero-sized file in this case. This
results in _can_fallocate() always returning false, and therefore
never preallocating.
While this may reasonably be argued to be a regression in util-linux,
the -n option doesn't make sense here anyway, so we remove it.
Closes-Bug: #1543181
Change-Id: Ie96fa71e7d2641d30572b8eda5609dd3ca5b6708
** Changed in: nova
Status: In Progress => Fix Released
--
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):
Fix Released
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
References