set_metadata throws AttributeError: id, but actually sets the metadata

Bug #1315175 reported by Travis Tripp
22
This bug affects 5 people
Affects Status Importance Assigned to Milestone
python-cinderclient
Triaged
Low
Unassigned

Bug Description

No errors from CLI, but when using python-cinderclient, I get AttributeError whether using volume.set_metadata() or using .volumes.set_metadata(). In either case, the metadata actually gets set. I suspect that it is similar to this nova issue: https://bugs.launchpad.net/python-novaclient/+bug/1293779

See below:

>>> volume = cinder_client.volumes.get('de284b86-8ce1-4deb-b306-aface0a1bc4b')
>>> volume.metadata
{u'readonly': u'False'}

>>> volume.set_metadata(volume, {'hello':'world'})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cinderclient/v1/volumes.py", line 31, in __repr__
    return "<Volume: %s>" % self.id
  File "cinderclient/base.py", line 268, in __getattr__
    self.get()
  File "cinderclient/base.py", line 287, in get
    new = self.manager.get(self.id)
  File "cinderclient/base.py", line 271, in __getattr__
    raise AttributeError(k)
AttributeError: id
>>> volume.id
u'de284b86-8ce1-4deb-b306-aface0a1bc4b'

>>> volume = cinder_client.volumes.get('de284b86-8ce1-4deb-b306-aface0a1bc4b')
>>> volume.metadata
{u'readonly': u'False', u'hello': u'world'}

>>> cinder_client.volumes.set_metadata('de284b86-8ce1-4deb-b306-aface0a1bc4b',{'foo':'bar'})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cinderclient/v1/volumes.py", line 31, in __repr__
    return "<Volume: %s>" % self.id
  File "cinderclient/base.py", line 268, in __getattr__
    self.get()
  File "cinderclient/base.py", line 287, in get
    new = self.manager.get(self.id)
  File "cinderclient/base.py", line 271, in __getattr__
    raise AttributeError(k)
AttributeError: id

>>> volume = cinder_client.volumes.get('de284b86-8ce1-4deb-b306-aface0a1bc4b')
>>> volume.metadata
{u'readonly': u'False', u'foo': u'bar', u'hello': u'world'}

Revision history for this message
Eric Pendergrass (eap-x) wrote :

Verified:

>>> from cinderclient import client
>>> cinder_client = client.Client('1', 'admin', 'xxxx', 'admin', 'http://localhost:5000/v2.0')
>>> cinder_client.volumes.list()
[<Volume: 4d942f28-812a-4862-bf9e-eb7a2a30bdf5>]
>>> volume = cinder_client.volumes.get('4d942f28-812a-4862-bf9e-eb7a2a30bdf5')
>>> volume.metadata
{}
>>> cinder_client.volumes.set_metadata('4d942f28-812a-4862-bf9e-eb7a2a30bdf5',{'foo':'bar'})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/stack/python-cinderclient/cinderclient/v1/volumes.py", line 31, in __repr__
    return "<Volume: %s>" % self.id
  File "/opt/stack/python-cinderclient/cinderclient/base.py", line 268, in __getattr__
    self.get()
  File "/opt/stack/python-cinderclient/cinderclient/base.py", line 287, in get
    new = self.manager.get(self.id)
  File "/opt/stack/python-cinderclient/cinderclient/base.py", line 271, in __getattr__
    raise AttributeError(k)
AttributeError: id
>>> volume.metadata
{}
>>> volume = cinder_client.volumes.get('4d942f28-812a-4862-bf9e-eb7a2a30bdf5')
>>> volume.metadata
{u'foo': u'bar'}
>>>

Changed in python-cinderclient:
status: New → Confirmed
Changed in python-cinderclient:
assignee: nobody → Juan Manuel Ollé (juan-m-olle)
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to python-cinderclient (master)

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

Changed in python-cinderclient:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-cinderclient (master)

Change abandoned by Mike Perez (<email address hidden>) on branch: master
Review: https://review.openstack.org/92199

Revision history for this message
M L (leongmzreg) wrote :

I ran into this problem as well trying to set the metadata on a snapshot. I'm using python-cinderclient 1.0.8 on CentOS 6. The metadata does get set despite the error.

>>> print snapshot.id
51c007cc-404d-406a-96ec-95fbbab1de17
>>> cinder.volume_snapshots.set_metadata(snapshot = snapshot, metadata = {"owner": "bla"})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/cinderclient/v1/volume_snapshots.py", line 34, in __repr__
    return "<Snapshot: %s>" % self.id
  File "/usr/lib/python2.6/site-packages/cinderclient/base.py", line 268, in __getattr__
    self.get()
  File "/usr/lib/python2.6/site-packages/cinderclient/base.py", line 287, in get
    new = self.manager.get(self.id)
  File "/usr/lib/python2.6/site-packages/cinderclient/base.py", line 271, in __getattr__
    raise AttributeError(k)
AttributeError: id

Revision history for this message
Sheel Rana (ranasheel2000) wrote :

No progress seen since long time on this..
Changing status from progress to New so that someone can go ahead with this if this issue still exists.

Changed in python-cinderclient:
status: In Progress → New
Changed in python-cinderclient:
assignee: Juan Manuel Ollé (juan-m-olle) → Yuriy Nesenenko (ynesenenko)
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-cinderclient (master)

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

Changed in python-cinderclient:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-cinderclient (master)

Change abandoned by Yuriy Nesenenko (<email address hidden>) on branch: master
Review: https://review.openstack.org/310457
Reason: wrong patch

Changed in python-cinderclient:
importance: Undecided → Low
Changed in python-cinderclient:
assignee: Yuriy Nesenenko (ynesenenko) → Ivan Kolodyazhny (e0ne)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Sean McGinnis (<email address hidden>) on branch: master
Review: https://review.openstack.org/308475
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
Sean McGinnis (sean-mcginnis) wrote : Bug Assignee Expired

Unassigning due to no activity for > 6 months.

Changed in python-cinderclient:
assignee: Ivan Kolodyazhny (e0ne) → nobody
status: In Progress → Triaged
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.