Closed angermueller closed 5 years ago
@angermueller
I tried this on Ubuntu 16.04. I am able to create a volume of size 13M. However when I try to create a volume of size 12M I run into your described issue.
To cover all supported distributions (Ubuntu, Fedora, CentOS), I think 16M of threshold seems fine. We can throw an error somewhere here: https://github.com/projectatomic/docker-lvm-plugin/blob/master/driver.go#L85
Saying "Error creating LVM volume, minimum expected size is 16M" Let me know if this works for you.
The solution fits perfect for me, thanks for the reply!
I made some experiments with Ubuntu 16.04. Formatting a xfs volume under 16M does not work for me there either.
Error message for a volume with exact size of 15M:
$> dd if=/dev/zero of=mytest bs=1048576 count=15
$> mkfs.xfs mytest
agsize (3840 blocks) too small, need at least 4096 blocks
On the other hand I would suggest to implement also a cleanup procedure in case the formatting fails. I think the lines around https://github.com/projectatomic/docker-lvm-plugin/blob/master/driver.go#L116 seem to be a good way to use them again in the same file around line 149 or 157. What do you think?
Edit: I'm not into go, otherwise I would provide a merge request.
Description
If you choose a volume size below 16M formatting with xfs will fail. Unfortunately the created logical volume is not removed.
docker volume ls
shows no volumes but creating it again will fail, even with a valid size, because the LV still exists.Steps to reproduce
Try to create a volume below 16M (expecting an error):
docker volume create --driver lvm --name example1 --opt size=8M --opt thinpool=volumes
It fails withError partitioning volume
. Try to create a valid volume with same name (should work):docker volume create --driver lvm --name example1 --opt size=100M --opt thinpool=volumes
This fails againError creating volume
.Workaround
Remove the logical volume manually:
sudo lvremove docker/example1
Additional Information
Docker Version: 18.06.1-ce Golang Version: go version go1.8.1 linux/amd64 Operating System: Linux node-1 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u4 (2018-08-21) x86_64 GNU/Linux XFS Version: xfsprogs/stable,stable,now 4.9.0+nmu1 amd64 LVM Version: lvm2/stable,stable,now 2.02.168-2 amd64
Syslog
docker-lvm-plugin[15210]: 2018/11/06 13:04:31 Entering go-plugins-helpers getPath
docker-lvm-plugin[15210]: 2018/11/06 13:04:31 Entering go-plugins-helpers createPath
docker-lvm-plugin[15210]: Create: lvcreate error: exit status 5 output Using default stripesize 64.00 KiB.#012 Logical Volume "example1" already exists in volume group "docker"
dockerd[15225]: time="2018-11-06T13:04:31.182414415+01:00" level=error msg="Handler for POST /v1.38/volumes/create returned error: create example1: VolumeDriver.Create: Error creating volume"