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

Add config option to specify group ID of socket file. #1927

Closed govint closed 6 years ago

govint commented 6 years ago

Made specifying the group ID as an option for the plugin socket file. The default is root and can be set to docker for those OSes that fail to create the socket file with a root group ID. Option can be given on command line or via config file.

Usage of /var/lib/docker/plugins/ba9a53987fe59174b88697e18ccef31ac9b5eba69fbba95aea5ff343846c4422/rootfs/usr/bin/docker-volume-vsphere: -config string Configuration file path (default "/etc/docker-volume-vsphere.conf") -driver string Volume driver -group string Plugin socket group id (default "root")

Use a plugin config like this, cat /etc/docker-volume-vsphere.conf { "Driver": "vsphere", "GroupID": "docker" }

Create a volume,

2017-10-09 06:39:26.824248006 +0000 UTC [INFO] Starting plugin log_level=info config="/etc/docker-volume-vsphere.conf" group=docker driver=vsphere <-----------------

2017-10-09 06:39:26.824370237 +0000 UTC [INFO] Getting volume data from unix:///var/run/docker.sock 2017-10-09 06:39:26.844579494 +0000 UTC [INFO] Found 0 running or paused containers 2017-10-09 06:39:26.845221587 +0000 UTC [INFO] Discovered 0 volumes that may be in use. 2017-10-09 06:39:26.845500092 +0000 UTC [INFO] Refcounting successfully completed 2017-10-09 06:39:26.845541166 +0000 UTC [INFO] Docker VMDK plugin started version="vSphere Volume Driver v0.5" port=1019 mock_esx=false 2017-10-09 06:39:26.846297413 +0000 UTC [INFO] Going into ServeUnix - Listening on Unix socket address="/run/docker/plugins/vsphere.sock" 2017-10-09 06:39:34.880402931 +0000 UTC [ERROR] Failed to get volume meta-data name=sock2 error="Volume sock2 not found (file: /vmfs/volumes/vsandatastore/dockvols/11111111-1111-1111-1111-111111111111/sock2.vmdk)" 2017-10-09 06:39:35.606978625 +0000 UTC [INFO] Attaching volume and creating filesystem name=sock2 fstype=ext4 2017-10-09 06:39:36.272455571 +0000 UTC [INFO] Device file found. device="/dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:1:0" 2017-10-09 06:39:37.07519057 +0000 UTC [INFO] Volume and filesystem created name=sock2 fstype=ext4

Without the option the default was always root and results in the below behavior on coreOS,

2017-10-09 06:50:44.076279131 +0000 UTC [INFO] No config file found. Using defaults. 2017-10-09 06:50:44.076609079 +0000 UTC [INFO] Starting plugin log_level=info config="/etc/docker-volume-vsphere.conf" group=root driver=vsphere 2017-10-09 06:50:44.076846535 +0000 UTC [INFO] Getting volume data from unix:///var/run/docker.sock 2017-10-09 06:50:44.096112465 +0000 UTC [INFO] Found 0 running or paused containers 2017-10-09 06:50:44.096706319 +0000 UTC [INFO] Discovered 0 volumes that may be in use. 2017-10-09 06:50:44.096970083 +0000 UTC [INFO] Refcounting successfully completed 2017-10-09 06:50:44.097188878 +0000 UTC [INFO] Docker VMDK plugin started version="vSphere Volume Driver v0.5" port=1019 mock_esx=false 2017-10-09 06:50:44.097667446 +0000 UTC [INFO] Going into ServeUnix - Listening on Unix socket address="/run/docker/plugins/vsphere.sock" 2017-10-09 06:50:44.097841545 +0000 UTC [INFO] Group root not found 2017-10-09 06:50:44.232592273 +0000 UTC [INFO] No config file found. Using defaults. 2017-10-09 06:50:44.233093921 +0000 UTC [INFO] Starting plugin group=root driver=vsphere log_level=info config="/etc/docker-volume-vsphere.conf" 2017-10-09 06:50:44.233163452 +0000 UTC [INFO] Getting volume data from unix:///var/run/docker.sock 2017-10-09 06:50:44.246448234 +0000 UTC [INFO] Found 0 running or paused containers 2017-10-09 06:50:44.247010358 +0000 UTC [INFO] Discovered 0 volumes that may be in use. 2017-10-09 06:50:44.247047164 +0000 UTC [INFO] Refcounting successfully completed 2017-10-09 06:50:44.247057403 +0000 UTC [INFO] Docker VMDK plugin started version="vSphere Volume Driver v0.5" port=1019 mock_esx=false 2017-10-09 06:50:44.24755406 +0000 UTC [INFO] Going into ServeUnix - Listening on Unix socket address="/run/docker/plugins/vsphere.sock" 2017-10-09 06:50:44.247843701 +0000 UTC [INFO] Group root not found

govint commented 6 years ago

This issue needs to be release noted so users on coreOS will know that they need to actually have a configuration to change the group ID to say docker. Documentation mentions it, but release note is needed.

govint commented 6 years ago

Any reason why the CI failed, the admin CLI has returned 4 fields as expected.

2017/10/10 10:16:49 Confirming attached status for volume [BasicTestSuite.TestVolumeLifecycle_volume_747242] 2017/10/10 10:16:49 Fetching full name for volume [BasicTestSuite.TestVolumeLifecycle_volume_747242] from VM [192.168.31.81] 2017/10/10 10:16:49 Full volume name: ['BasicTestSuite.TestVolumeLifecycle_volume_747242@Datastore1'] 2017/10/10 10:17:02 Admin cli volume shortls output is expected to consist of four elements onlyActual output BasicTestSuite.TestVolumeLifecycle_volume_747242 100MB thin photon.vmfs Connection to 192.168.31.62 closed by remote host. exit status 1 FAIL github.com/vmware/docker-volume-vsphere/tests/e2e 94.508s make[1]: [test-e2e-runalways] Error 1 make: [test-e2e-runalways] Error 2