API validation: Add cinder_host type to support ipv6 in manage
This will fail due to overly restrictive regex validation: cinder manage hostgroup@cloud#[dead:beef::cafe]:/cinder01 abcd This is because validation for this call checks for a valid hostname but needs to check for any string that would be a valid "host" in Cinder, which is not the same thing. Closes-Bug: #1904892 Change-Id: I1349e8d3eb422f9dcd533c54f922f7ab8133b753
This commit is contained in:
parent
a4e64d839f
commit
8687925ce7
@ -33,7 +33,7 @@ volume_manage_create = {
|
|||||||
"bootable": parameter_types.boolean,
|
"bootable": parameter_types.boolean,
|
||||||
"volume_type": parameter_types.name_allow_zero_min_length,
|
"volume_type": parameter_types.name_allow_zero_min_length,
|
||||||
"name": 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']},
|
"ref": {'type': ['object', 'string']},
|
||||||
"metadata": parameter_types.metadata_allows_null,
|
"metadata": parameter_types.metadata_allows_null,
|
||||||
},
|
},
|
||||||
|
@ -230,6 +230,18 @@ hostname = {
|
|||||||
'pattern': '^[a-zA-Z0-9-._#@:/+]*$'
|
'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}
|
resource_type = {'type': ['string', 'null'], 'minLength': 0, 'maxLength': 40}
|
||||||
|
|
||||||
|
@ -205,7 +205,8 @@ class VolumeManageTest(test.TestCase):
|
|||||||
|
|
||||||
@ddt.data({'host': 'host_ok'},
|
@ddt.data({'host': 'host_ok'},
|
||||||
{'host': 'user@host#backend:/vol_path'},
|
{'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
|
@ddt.unpack
|
||||||
@mock.patch('cinder.volume.api.API.manage_existing', wraps=api_manage)
|
@mock.patch('cinder.volume.api.API.manage_existing', wraps=api_manage)
|
||||||
def test_manage_volume_ok(self, mock_api_manage, host):
|
def test_manage_volume_ok(self, mock_api_manage, host):
|
||||||
|
@ -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…
x
Reference in New Issue
Block a user