Browse Source

Merge "API validation: Add cinder_host type to support ipv6 in manage" into stable/ussuri

changes/48/790048/1
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
5157b50eb5
4 changed files with 22 additions and 2 deletions
  1. +1
    -1
      cinder/api/schemas/volume_manage.py
  2. +12
    -0
      cinder/api/validation/parameter_types.py
  3. +2
    -1
      cinder/tests/unit/api/contrib/test_volume_manage.py
  4. +7
    -0
      releasenotes/notes/bug-1904892-ipv6-nfs-manage-391118115dfaaf54.yaml

+ 1
- 1
cinder/api/schemas/volume_manage.py View File

@ -33,7 +33,7 @@ volume_manage_create = {
"bootable": parameter_types.boolean,
"volume_type": parameter_types.name_allow_zero_min_length,
"name": parameter_types.name_allow_zero_min_length,
"host": parameter_types.hostname,
"host": parameter_types.cinder_host,
"ref": {'type': ['object', 'string']},
"metadata": parameter_types.metadata_allows_null,
},


+ 12
- 0
cinder/api/validation/parameter_types.py View File

@ -232,6 +232,18 @@ hostname = {
'pattern': '^[a-zA-Z0-9-._#@:/+]*$'
}
cinder_host = {
# A string that represents a cinder host.
# Examples:
# hostname
# hostname.domain
# hostname.domain@backend
# hostname.domain@backend#pool
# hostname.domain@backend#[dead:beef::cafe]:/complex_ipv6_pool_w_share
'type': ['string', 'null'], 'minLength': 1, 'maxLength': 255,
'pattern': r'^[a-zA-Z0-9-._#@:/+\[\]]*$' # hostname plus brackets
}
resource_type = {'type': ['string', 'null'], 'minLength': 0, 'maxLength': 40}


+ 2
- 1
cinder/tests/unit/api/contrib/test_volume_manage.py View File

@ -205,7 +205,8 @@ class VolumeManageTest(test.TestCase):
@ddt.data({'host': 'host_ok'},
{'host': 'user@host#backend:/vol_path'},
{'host': 'host@backend#parts+of+pool'})
{'host': 'host@backend#parts+of+pool'},
{'host': 'host@backend#[dead:beef::cafe]:/vol01'})
@ddt.unpack
@mock.patch('cinder.volume.api.API.manage_existing', wraps=api_manage)
def test_manage_volume_ok(self, mock_api_manage, host):


+ 7
- 0
releasenotes/notes/bug-1904892-ipv6-nfs-manage-391118115dfaaf54.yaml View File

@ -0,0 +1,7 @@
---
fixes:
- |
`Bug #1904892 <https://bugs.launchpad.net/cinder/+bug/1904892>`_:
Fix cinder manage operations for NFS backends using IPv6 addresses
in the NFS server address. These were previously rejected by the
Cinder API.

Loading…
Cancel
Save