Test for Cinder V3 API: update volume attachment
[Steps]
1. Create a RBD volume vol-01
2. Boot a Server vm-01
3. Create volume attachment (volume: vol-01, instance: vm-01)
4. Update volume attachment
[Error Logs]
2017-06-12 23:45:27.175 INFO cinder.api.openstack.wsgi req-46202758-84ef-4a4c-9266-736bd5801c1b demo demo PUT http://192.168.51.189:8776/v3/1febf01be12843a09cb8670ef754d587/attachments/cb117a23-c7af-4098-b0fc-9d1c855e1a9d
2017-06-12 23:45:27.176 DEBUG cinder.api.openstack.wsgi req-46202758-84ef-4a4c-9266-736bd5801c1b demo demo Action: 'update', calling method: <function version_select at 0x8ea91b8>,
body: {"attachment": {"connector": {"host": "openstack"}}}
from (pid=23271) _process_stack /home/stack.master/cinder/cinder/api/openstack/wsgi.py:868
2017-06-12 23:45:27.936 ERROR cinder.api.v3.attachments req-46202758-84ef-4a4c-9266-736bd5801c1b demo demo Unable to update the attachment.
ValueError: A string is required in field connection_info[hosts], not a list
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments Traceback (most recent call last):
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments File "/home/stack.master/cinder/cinder/api/v3/attachments.py", line 234, in update
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments connector))
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments File "/home/stack.master/cinder/cinder/volume/api.py", line 101, in wrapped
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments return func(self, context, target_obj, *args, **kwargs)
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments File "/home/stack.master/cinder/cinder/volume/api.py", line 1977, in attachment_update
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments attachment_ref.connection_info = connection_info
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 72, in setter
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments field_value = field.coerce(self, name, value)
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/fields.py", line 195, in coerce
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments return self._type.coerce(obj, attr, value)
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/fields.py", line 665, in coerce
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments coerced_dict.update(value)
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/fields.py", line 1292, in update
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments super(CoercedDict, self).update(self._coerce_dict(other),
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/fields.py", line 1270, in _coerce_dict
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments res[key] = self._coerce_item(key, element)
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/fields.py", line 1282, in _coerce_item
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments return self._element_type.coerce(self._obj, att_name, item)
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/fields.py", line 195, in coerce
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments return self._type.coerce(obj, attr, value)
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/fields.py", line 265, in coerce
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments {'attr': attr, 'type': type(value).__name__})
2017-06-12 23:45:27.936 TRACE cinder.api.v3.attachments ValueError: A string is required in field connection_info[hosts], not a list
[Reason]
The connection info (dict) got from 'initialize_connection' in RBD driver contains two list elemnts (hosts and ports). The field type of connection_info in VolumeAttachment Object is fields.DictOfNullableStringsField(nullable=True) which is not fit for list element.
Fix proposed to branch: master /review. openstack. org/475638
Review: https:/