yp-engineering / rbd-docker-plugin

Ceph RBD docker volume driver plugin.
MIT License
102 stars 70 forks source link

Remove size definition in image name #39

Closed ohmystack closed 8 years ago

ohmystack commented 8 years ago

There is one related PR #37 , please review that first.

If we put @<size> at the end of the image name, Docker won't recognize it, and Docker will save <image-name>@<size> as the volume name. However, this image is actually the same one as <image-name>, without suffix. We should make Docker treating them as the same image, instead of two different ones. This is important because Docker caches the volume info, the volume has been referenced by which container, by image name.

see the code of setNamed(v volume.Volume, ref string) in github.com/docker/docker/volume/store/store.go

After this change, when creating images at docker run, plugin will statically use the default value. When creating images by docker volume create, user can pass size in opts to declare a customized value.

porcupie commented 8 years ago

@ohmystack - Thank you! However, you can already use docker volume create with a size option instead of using the name@size syntax, nothing is forcing you to use this syntax, so I think this is moot.

If you require that feature of docker volume, then you should always create your images first using docker volume create and the correct options. The existing code already allows a default size by not specifying any @size decorator if you wanted to autocreate on docker run.

ohmystack commented 8 years ago

@porcupie Maybe we should prohibit doing that wrong action.

ohmystack commented 8 years ago

Oh... I miss the tests.