diff options
author | Zuul <zuul@review.opendev.org> | 2021-05-06 18:36:43 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-05-06 18:36:43 +0000 |
commit | 9fa58ac3d8509891b67dfc0fc0f5ced9f27e8b4a (patch) | |
tree | 385a3a8f14b769158ac4a176780231342e281319 | |
parent | dd1f6b014919b9af50d8202bda736a4e4bed4af8 (diff) | |
parent | 1644aab33b62adb2042ea709b685fc093e449ff0 (diff) | |
download | cinder-9fa58ac3d8509891b67dfc0fc0f5ced9f27e8b4a.tar.gz |
Merge "API validation: Add cinder_host type to support ipv6 in manage" into stable/train
4 files changed, 22 insertions, 2 deletions
diff --git a/cinder/api/schemas/volume_manage.py b/cinder/api/schemas/volume_manage.py index 544214c49..858d8b950 100644 --- a/cinder/api/schemas/volume_manage.py +++ b/cinder/api/schemas/volume_manage.py @@ -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, }, diff --git a/cinder/api/validation/parameter_types.py b/cinder/api/validation/parameter_types.py index 71d277cb7..639a2ccb1 100644 --- a/cinder/api/validation/parameter_types.py +++ b/cinder/api/validation/parameter_types.py @@ -227,6 +227,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} diff --git a/cinder/tests/unit/api/contrib/test_volume_manage.py b/cinder/tests/unit/api/contrib/test_volume_manage.py index ca5935a9b..07db98e42 100644 --- a/cinder/tests/unit/api/contrib/test_volume_manage.py +++ b/cinder/tests/unit/api/contrib/test_volume_manage.py @@ -204,7 +204,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): diff --git a/releasenotes/notes/bug-1904892-ipv6-nfs-manage-391118115dfaaf54.yaml b/releasenotes/notes/bug-1904892-ipv6-nfs-manage-391118115dfaaf54.yaml new file mode 100644 index 000000000..8fc2e89c5 --- /dev/null +++ b/releasenotes/notes/bug-1904892-ipv6-nfs-manage-391118115dfaaf54.yaml @@ -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. |