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

Unity: failed to get lun with # in its name #307

Closed
Murray-LIANG opened this issue Apr 29, 2020 · 0 comments
Closed

Unity: failed to get lun with # in its name #307

Murray-LIANG opened this issue Apr 29, 2020 · 0 comments
Labels

Comments

@Murray-LIANG
Copy link
Contributor

In [4]: lun = u.get_lun(name='Ansible#1lun')                                                                                                                                                  
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
---------------------------------------------------------------------------
UnityResourceNotFoundError                Traceback (most recent call last)
<ipython-input-4-7491fce119a7> in <module>
----> 1 lun = u.get_lun(name='Ansible#1lun')

~/git/storops/storops/unity/resource/system.py in get_lun(self, _id, name, **filters)
    133 
    134     def get_lun(self, _id=None, name=None, **filters):
--> 135         return self._get_unity_rsc(UnityLunList, _id=_id, name=name, **filters)
    136 
    137     def create_pool(self, name, raid_groups, description=None, **kwargs):

~/git/storops/storops/unity/resource/__init__.py in _get_unity_rsc(self, clz, _id, allow_dup, **filters)
    195             if len(ret) == 0:
    196                 raise UnityResourceNotFoundError(
--> 197                     '{}:{} not found.'.format(clz_name, name))
    198             elif len(ret) > 1:
    199                 if not allow_dup:

UnityResourceNotFoundError: UnityLun:Ansible#1lun not found.

Storops should use escaped string like Ansible%231lun in REST url, but didn't.

Murray-LIANG added a commit that referenced this issue May 21, 2020
The filter doesn't work when having \# char in name. Need to encode it
before sending to Unity.

Use a general function `urllib.parse.quote` to encode all chars except
: and space. : and space chars are known working with Unity,
eg. hostInitiator's initiatorID is string like
iqn.1993-08.org.debian:01:a4f95ed19999 and sp name is `SP A`.
And they are massively used in test cases. So, not to encode them to
avoid introducing regression failure.
Murray-LIANG added a commit that referenced this issue May 22, 2020
The filter doesn't work when having \# char in name. Need to encode it
before sending to Unity.

Use a general function `urllib.parse.quote` to encode all chars except
: and space. : and space chars are known working with Unity,
eg. hostInitiator's initiatorID is string like
iqn.1993-08.org.debian:01:a4f95ed19999 and sp name is `SP A`.
And they are massively used in test cases. So, not to encode them to
avoid introducing regression failure.

This commit also changes some flake8 errors, the var named l is not
allowed.
Murray-LIANG added a commit that referenced this issue May 22, 2020
The filter doesn't work when having \# char in name. Need to encode it
before sending to Unity.

Use a general function `urllib.parse.quote` to encode all chars except
: and space. : and space chars are known working with Unity,
eg. hostInitiator's initiatorID is string like
iqn.1993-08.org.debian:01:a4f95ed19999 and sp name is `SP A`.
And they are massively used in test cases. So, not to encode them to
avoid introducing regression failure.

This commit also changes some flake8 errors, the var named l is not
allowed.
Murray-LIANG added a commit that referenced this issue May 25, 2020
The filter doesn't work when having \# char in name. Need to encode it
before sending to Unity.

Use a general function `urllib.parse.quote` to encode all chars except
: and space. : and space chars are known working with Unity,
eg. hostInitiator's initiatorID is string like
iqn.1993-08.org.debian:01:a4f95ed19999 and sp name is `SP A`.
And they are massively used in test cases. So, not to encode them to
avoid introducing regression failure.

This commit also changes some flake8 errors, the var named l is not
allowed.
Murray-LIANG added a commit that referenced this issue May 26, 2020
- Unity: skip hlu0 for snap host access (#314)
- [#307] Unity: fix url encoding (#312)
- Fix flask8 variable name errors (#313)
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

2 participants