Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker 3.1: Volume does not delete if its mounting fails #513

Closed
sonawane-shashikant opened this issue Mar 20, 2019 · 2 comments
Closed
Assignees
Labels

Comments

@sonawane-shashikant
Copy link

Test Bed -
OS - CentOS
3PAR version - Release version 3.3.1 (MU4)
Plugin - "PluginReference": "docker.io/hpestorage/hpedockervolumeplugin:3.1"

Steps to reproduce -
1.Create normal docker volume and pass invalid -o fsOwner="1001-1001"
2.Try to mount this volume to see mount failure.
3. Verify the VLUNs entries on 3PAR.
3. Now try to delete the volume.

Expected Result - In case of mount failure, VLUN entries on 3PAR should also be cleared and docker volume should get deleted successfully.

Actual Result - VLUN entries remains on 3PAR even when mounting fails. Volume does not delete saying, "unable to remove volume: remove : resource in use"

[docker@cld6b10 ~]$ docker volume ls
DRIVER VOLUME NAME
[docker@cld6b10 ~]$ docker volume create -d hpe --name=INVALID-FS-OWNER -o fsOwner="Shashi-Shashi" -o fsMode="07-77" -o size=9 -o backend=3PAR Error response from daemon: create INVALID-FS-OWNER: Invalid value '07-77' specified for fsMode. Please specify an integer value.
[docker@cld6b10 ~]$ docker volume create -d hpe --name=INVALID-FS-OWNER -o fsOwner="Shashi-Shashi" -o fsMode="0777" -o size=9 -o backend=3PAR
INVALID-FS-OWNER
[docker@cld6b10 ~]$ docker volume inspect INVALID-FS-OWNER
[
{
"Driver": "hpe:latest",
"Labels": {},
"Mountpoint": "/var/lib/docker/plugins/8564fb4e9a950e34333f8f5c1d8db4cbef0138416dc0143b14ee860fc59094a6/rootfs",
"Name": "INVALID-FS-OWNER",
"Options": {
"backend": "3PAR",
"fsMode": "0777",
"fsOwner": "Shashi-Shashi",
"size": "9"
},
"Scope": "global",
"Status": {
"volume_detail": {
"3par_vol_name": "dcv-WP2hIcOWT9y5K40p1.Un3A",
"backend": "3PAR",
"compression": null,
"cpg": "SSD_r1",
"domain": "TEST_DOMAIN",
"flash_cache": null,
"fsMode": "0777",
"fsOwner": "Shashi-Shashi",
"mountConflictDelay": 30,
"provisioning": "thin",
"size": 9,
"snap_cpg": "SSD_r1"
}
}
}
]
[docker@cld6b10 ~]$ docker run -it -d -v INVALID-FS-OWNER:/data --volume-driver hpe --name MOUNTER --rm busybox /bin/sh
3cc02a91b1a7e53755a8b935a8cdaa7dff8f492a22a03a7cd7035e6a63d9b13b
docker: Error response from daemon: error while mounting volume '/var/lib/docker/plugins/8564fb4e9a950e34333f8f5c1d8db4cbef0138416dc0143b14ee860fc59094a6/rootfs': Post http://%2Frun%2Fdocker%2Fplugins%2F8564fb4e9a950e34333f8f5c1d8db4cbef0138416dc0143b14ee860fc59094a6%2Fhpe.sock/VolumeDriver.Mount: net/http: request canceled (Client.Timeout exceeded while awaiting headers).
[docker@cld6b10 ~]$

[docker@cld6b10 ~]$ docker volume rm INVALID-FS-OWNER
Error response from daemon: unable to remove volume: remove INVALID-FS-OWNER: resource in use
[docker@cld6b10 ~]$

3PAR output after mount failure -

CSIM-8K02_MXN6072AC7 cli% showvv -cpg SSD_r1 -showcols Name,Comment
Name Comment
dcv-WP2hIcOWT9y5K40p1.Un3A {"volume_id": "58fda121-c396-4fdc-b92b-8d29d7e527dc", "name": "58fda121-c396-4fdc-b92b-8d29d7e527dc", "type": "Docker", "display_name": "INVALID-FS-OWNER"}

total
CSIM-8K02_MXN6072AC7 cli% showvlun -v dcv-WP2hIcOWT9y5K40p1.Un3A
Active VLUNs
Lun VVName HostName --------Host_WWN/iSCSI_Name-------- Port Type Status ID
0 dcv-WP2hIcOWT9y5K40p1.Un3A cld6b10 iqn.1994-05.com.redhat:d0f7bb324eaa 2:2:1 matched set active 1
0 dcv-WP2hIcOWT9y5K40p1.Un3A cld6b10 iqn.1994-05.com.redhat:d0f7bb324eaa 3:2:1 matched set active 1

2 total

VLUN Templates
Lun VVName HostName -Host_WWN/iSCSI_Name- Port Type
0 dcv-WP2hIcOWT9y5K40p1.Un3A cld6b10 ---------------- 2:2:1 matched set
0 dcv-WP2hIcOWT9y5K40p1.Un3A cld6b10 ---------------- 3:2:1 matched set

2 total
CSIM-8K02_MXN6072AC7 cli% showvlun -v dcv-WP2hIcOWT9y5K40p1.Un3A
Active VLUNs
Lun VVName HostName --------Host_WWN/iSCSI_Name-------- Port Type Status ID
0 dcv-WP2hIcOWT9y5K40p1.Un3A cld6b10 iqn.1994-05.com.redhat:d0f7bb324eaa 2:2:1 matched set active 1
0 dcv-WP2hIcOWT9y5K40p1.Un3A cld6b10 iqn.1994-05.com.redhat:d0f7bb324eaa 3:2:1 matched set active 1

2 total

VLUN Templates
Lun VVName HostName -Host_WWN/iSCSI_Name- Port Type
0 dcv-WP2hIcOWT9y5K40p1.Un3A cld6b10 ---------------- 2:2:1 matched set
0 dcv-WP2hIcOWT9y5K40p1.Un3A cld6b10 ---------------- 3:2:1 matched set

2 total
CSIM-8K02_MXN6072AC7 cli%

imran-ansari added a commit that referenced this issue Apr 16, 2019
-Added rollback for mount
-Added validation for fsOwner
imran-ansari added a commit that referenced this issue Apr 16, 2019
This reverts commit 35b4fc6.
imran-ansari added a commit to imran-ansari/python-hpedockerplugin that referenced this issue Apr 16, 2019
-Added rollback to mount flow for any cleanup in case of any failure
-Added validation for fsOwner
wdurairaj added a commit that referenced this issue Apr 16, 2019
wdurairaj pushed a commit to wdurairaj/python-hpedockerplugin that referenced this issue Apr 16, 2019
-Added rollback to mount flow for any cleanup in case of any failure
-Added validation for fsOwner
wdurairaj added a commit that referenced this issue Apr 16, 2019
* Fix Issue #390, Allow 'size' in snapshot options

* Updated usage doc

* Fixed issue #513

-Added rollback to mount flow for any cleanup in case of any failure
-Added validation for fsOwner

* Pep8 fixed
@wdurairaj wdurairaj added the Fixed Code fixed label Apr 16, 2019
@wdurairaj
Copy link
Collaborator

Fix available in hpestorage/legacyvolumeplugin:3.1 and hpestorage/hpedockervolumeplugin:3.1

@sonawane-shashikant
Copy link
Author

Since fsOwner validation is implemneted in the latest plugin, this bug is verified by mounting volume without multipathd service and making host available before mounting.

  1. By stopping the multipathd service

[root@cld6b9 ~]# docker run -it -v INVALID-FS-OWNER:/data --volume-driver hpe --rm busybox /bin/sh
docker: Error response from daemon: error while mounting volume '/var/lib/docker/plugins/15822b1f3df1f3008b4ed1174e2ba07c99962c58ea4ed987f26b93da481aa636/rootfs': Unexpected error while running command.
Command: multipathd show status
Exit code: 1
Stdout: ''
Stderr: ''.
[root@cld6b9 ~]#

[root@cld6b9 ~]# docker volume inspect INVALID-FS-OWNER
[
{
"Driver": "hpe:latest",
"Labels": {},
"Mountpoint": "/var/lib/docker/plugins/15822b1f3df1f3008b4ed1174e2ba07c99962c58ea4ed987f26b93da481aa636/rootfs",
"Name": "INVALID-FS-OWNER",
"Options": {
"backend": "3PAR",
"fsMode": "0111",
"fsOwner": "1001:1001",
"size": "9"
},
"Scope": "global",
"Status": {
"volume_detail": {
"3par_vol_name": "dcv-X1B09OmsRfKXhIrx-85szg",
"backend": "3PAR",
"compression": null,
"cpg": "SHASHI-SSD",
"domain": "SUMIT",
"flash_cache": null,
"fsMode": "0111",
"fsOwner": "1001:1001",
"mountConflictDelay": 30,
"provisioning": "thin",
"size": 9,
"snap_cpg": "SHASHI-SSD"
}
}
}
]
[root@cld6b9 ~]#

CSIM-8K02_MXN6072AC7 cli% showvlun -v dcv-X1B09OmsRfKXhIrx-85szg
Active VLUNs
no vluns listed

VLUN Templates
no vluns listed
CSIM-8K02_MXN6072AC7 cli%


  1. By making host available before mounting

[root@cld6b9 ~]# docker run -it -v INVALID-FS-OWNER:/data --volume-driver hpe --rm busybox /bin/sh
docker: Error response from daemon: error while mounting volume '/var/lib/docker/plugins/15822b1f3df1f3008b4ed1174e2ba07c99962c58ea4ed987f26b93da481aa636/rootfs': HPE Docker Volume Plugin Mount Failed: ('Initialize Connection Failed: connection info retrieval failed, error is: ', 'Forbidden (HTTP 403) 118 - Volume not in same domain').
[root@cld6b9 ~]#

CSIM-8K02_MXN6072AC7 cli% showvlun -v dcv-X1B09OmsRfKXhIrx-85szg
Active VLUNs
no vluns listed

VLUN Templates
no vluns listed
CSIM-8K02_MXN6072AC7 cli%

nilangekarss pushed a commit that referenced this issue Sep 25, 2019
* Fix Issue #390, Allow 'size' in snapshot options

* Updated usage doc

* Added space between words

* Ability to create a regular volume from a replicated backend

* Fixed pep8 issue regarding redundant back slashes

* Pep8 Fix attempt 2: Indentation

* Update hpe_storage_api.py

* Fixed an issue when a regular volume is mounted while the backend is replication enabled

* Fixed pep8 line too long issues

* Not treating as a replication backend if the volume created is not replicated volume

* Allowing the non replicated volume from a replicated backend to be successfully imported to docker volume plugin

* Added back some required checks

* Removed unwanted space

* Update .travis.yml

* Fix for issue 518-encrypted password decrytion fails when the passphrase length is of 16,24,32 characters

* Fix for issue 502 (#555)

* Added needed check to see mgr object is available or not (#559)

* Feature: Add logging to file -- Include changes for Pull Request #563 in v300 branch (#569)

* Fix Issue #390, Allow 'size' in snapshot options

* Updated usage doc

* Feature: Add support for RotatingFileHandler in logging

* Fix Issue #534 (#576)

* Fix Issue #390, Allow 'size' in snapshot options

* Updated usage doc

* Fix issue #534 - invalid config entry creates session leak

* Fix issue #513 on v300 branch (#583)

* Fix Issue #390, Allow 'size' in snapshot options

* Updated usage doc

* Fixed issue #513

-Added rollback to mount flow for any cleanup in case of any failure
-Added validation for fsOwner

* Pep8 fixed

* Use deferred thread for processing REST calls in twistd

* Fixed msg creation

* Retry on lock exception

* Another attempt on processing lock failed exception

* Changes in mount_volume to avoid lock during mount conflict check

* Fix _is_vol_mounted_on_this_node definition

* Minor change

* Backport pull request #650 and related changes

* Implemented blocking Etcd lock + Eviction fixes merged

* Fix problem with mount entry check

* Returning multiple enums from _is_vol_mounted_on_this_node + inspect output to have volume id

* Expect node_mount_info to be absent for the first mount

-Also removed dead code

* path_info to be handled as JSON object + handled stale mount_id in reboot case

* Fix for UTs

* Replaced path.path with path

* Fixed snap related TC

* PEP8 errors fixed

* Added more information to the logs

* For UT 3pardcv.log location changed

* Added check for manager-list initialization

* Removed redundant code

* Removed duplicate functions from fileutil

As part of merge process, fileutil ended up having two duplicate functions. Fixed it.
Also UT needed to use un-deferred thread code to avoid handling multi-threaded UTs.

* Fixed UTs for File

* Added exception handling for mount_dir()

* Adopted 3.2 async initialization fix required for UT

* Reintroduced sleep of 3 secs

* Corrected usage of sleep() call

* Disabled detailed logging due to Travis CI log size restriction

* Pep8 fix

* Fix for issue #735

* Fixed removal of redundant old_path_info entries

* Added missing argument to rollback call

* Removed code that was added to look for iscsi devices

Ideally, we should remove this file altogether... to be taken up later
wdurairaj pushed a commit that referenced this issue Oct 17, 2019
* Fix Issue #390, Allow 'size' in snapshot options

* Updated usage doc

* Added space between words

* Ability to create a regular volume from a replicated backend

* Fixed pep8 issue regarding redundant back slashes

* Pep8 Fix attempt 2: Indentation

* Update hpe_storage_api.py

* Fixed an issue when a regular volume is mounted while the backend is replication enabled

* Fixed pep8 line too long issues

* Not treating as a replication backend if the volume created is not replicated volume

* Allowing the non replicated volume from a replicated backend to be successfully imported to docker volume plugin

* Added back some required checks

* Removed unwanted space

* Update .travis.yml

* Fix for issue 518-encrypted password decrytion fails when the passphrase length is of 16,24,32 characters

* Fix for issue 502 (#555)

* Added needed check to see mgr object is available or not (#559)

* Feature: Add logging to file -- Include changes for Pull Request #563 in v300 branch (#569)

* Fix Issue #390, Allow 'size' in snapshot options

* Updated usage doc

* Feature: Add support for RotatingFileHandler in logging

* Fix Issue #534 (#576)

* Fix Issue #390, Allow 'size' in snapshot options

* Updated usage doc

* Fix issue #534 - invalid config entry creates session leak

* Fix issue #513 on v300 branch (#583)

* Fix Issue #390, Allow 'size' in snapshot options

* Updated usage doc

* Fixed issue #513

-Added rollback to mount flow for any cleanup in case of any failure
-Added validation for fsOwner

* Pep8 fixed

* Use deferred thread for processing REST calls in twistd

* Fixed msg creation

* Retry on lock exception

* Another attempt on processing lock failed exception

* Changes in mount_volume to avoid lock during mount conflict check

* Fix _is_vol_mounted_on_this_node definition

* Minor change

* Backport pull request #650 and related changes

* Implemented blocking Etcd lock + Eviction fixes merged

* Fix problem with mount entry check

* Returning multiple enums from _is_vol_mounted_on_this_node + inspect output to have volume id

* Expect node_mount_info to be absent for the first mount

-Also removed dead code

* path_info to be handled as JSON object + handled stale mount_id in reboot case

* Fix for UTs

* Replaced path.path with path

* Fixed snap related TC

* PEP8 errors fixed

* Added more information to the logs

* For UT 3pardcv.log location changed

* Added check for manager-list initialization

* Removed redundant code

* Removed duplicate functions from fileutil

As part of merge process, fileutil ended up having two duplicate functions. Fixed it.
Also UT needed to use un-deferred thread code to avoid handling multi-threaded UTs.

* Fixed UTs for File

* Added exception handling for mount_dir()

* Adopted 3.2 async initialization fix required for UT

* Reintroduced sleep of 3 secs

* Corrected usage of sleep() call

* Disabled detailed logging due to Travis CI log size restriction

* Pep8 fix

* Fix for issue #735

* Fixed removal of redundant old_path_info entries

* Added missing argument to rollback call

* Removed code that was added to look for iscsi devices

Ideally, we should remove this file altogether... to be taken up later

* pyparsing ImportError fix

* Changed setuptools version to 41.0.0

41.0.0 was used by v3.1 of plugin and was

* Device remapping fix

On reboot, the volumes that were mapped to the multipath devices earlier are remapped to different devices. This fix handles that case.

* Fixed lock name

* Fixed PEP8 issues

* Missed a PEP8 conformance

* Fixed log statement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants