vmware-archive / vsphere-storage-for-docker

vSphere Storage for Docker
https://vmware.github.io/vsphere-storage-for-docker
Apache License 2.0
251 stars 95 forks source link

Volumes cannot be mounted after vDVS/vFile plugin is re-installed #1972

Closed luomiao closed 6 years ago

luomiao commented 6 years ago

Steps to reproduce:

  1. Create a volume with vDVS plugin:
    docker volume create --driver=vsphere testvs111
  2. Remove the vDVS plugin:
    docker plugin rm -f vsphere
  3. Install the plugin back:
    docker plugin install --grant-all-permissions --alias vsphere vmware/docker-volume-vsphere:latest
  4. Try to use the volume that I created before deleting the plugin:
    docker run -dit -v testvs111:/mnt busybox sh

This will fail with error:

docker: Error response from daemon: error while mounting volume '/var/lib/docker/plugins/4f581e3ecbfc34f94eabd9c69057a8d3ae939a98608cd688b5d6736405fbb2c9/rootfs/mnt/vmdk/testvs111': Post http://%2Frun%2Fdocker%2Fplugins%2F4f581e3ecbfc34f94eabd9c69057a8d3ae939a98608cd688b5d6736405fbb2c9%2Fvsphere.sock/VolumeDriver.Mount: dial unix /run/docker/plugins/4f581e3ecbfc34f94eabd9c69057a8d3ae939a98608cd688b5d6736405fbb2c9/vsphere.sock: connect: no such file or directory.

Before and after the plugin re-installation, the ID of vsphere has changed: Before:

vmware@ubuntu16:~$ docker plugin ls
ID                  NAME                DESCRIPTION                           ENABLED
4f581e3ecbfc        vsphere:latest      VMWare vSphere Docker Volume plugin   true

After:

vmware@ubuntu16:~$ docker plugin ls
ID                  NAME                DESCRIPTION                           ENABLED
c1e76d7a5f2d        vsphere:latest      VMWare vSphere Docker Volume plugin   true

Apparently, the mount point returned by the plugin is with the old ID instead of the new one. This path should be updated if the plugin is changed.

The same thing happens with vFile, might be due to the same reason.

govint commented 6 years ago

Not sure this is a bug, because this is how docker maps volumes to a plugin. Rather than delete and re-install a plugin, it can be upgraded via docker plugin upgrade instead. Its surely not a VDVS plugin. Could check with the Moby project and open an issue there.