Field type of 'connection_info' in VolumeAttachment is not fit for RBD driver

Bug #1699003 reported by Jeremy Zhang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Jeremy Zhang

Bug Description

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.

Tags: attachment
Changed in cinder:
assignee: nobody → Jeremy Zhang (jeremy.zhang)
description: updated
tags: added: attachment
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/475638

Changed in cinder:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/475638
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=7cebd197c39e91f1e1d8a20c460fb28b2ffaa4f7
Submitter: Jenkins
Branch: master

commit 7cebd197c39e91f1e1d8a20c460fb28b2ffaa4f7
Author: jeremy.zhang <zhangjun_inspur@163.com>
Date: Tue Jun 20 16:31:21 2017 +0800

    Fix connection_info field in VolumeAttachment object

    The 'connection_info' field (DictOfNullableStringsField) in
    VolumeAttachment object is not fit for RBD driver, as the
    connection info got from RBD driver contains two list elements
    (hosts and ports). This patch is to solve this problem.

    Change-Id: Ia3cb9ae5a2bf5617b3ff0bd17039790b168ff136
    Closes-Bug: #1699003

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 11.0.0.0b3

This issue was fixed in the openstack/cinder 11.0.0.0b3 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.