migration-list: 'unicode' object has no attribute 'iteritems'

Bug #1260249 reported by Sahid Orentino
44
This bug affects 9 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Sahid Orentino

Bug Description

There is an AttributeError when we try to use the command "nova migration-list"

Traceback (most recent call last):
  File "/opt/stack/python-novaclient/novaclient/shell.py", line 721, in main
    OpenStackComputeShell().main(map(strutils.safe_decode, sys.argv[1:]))
  File "/opt/stack/python-novaclient/novaclient/shell.py", line 657, in main
    args.func(self.cs, args)
  File "/opt/stack/python-novaclient/novaclient/v1_1/contrib/migrations.py", line 71, in do_migration_list
    args.cell_name))
  File "/opt/stack/python-novaclient/novaclient/v1_1/contrib/migrations.py", line 53, in list
    return self._list("/os-migrations%s" % query_string, "migrations")
  File "/opt/stack/python-novaclient/novaclient/base.py", line 80, in _list
    for res in data if res]
  File "/opt/stack/python-novaclient/novaclient/base.py", line 426, in __init__
    self._add_details(info)
  File "/opt/stack/python-novaclient/novaclient/base.py", line 449, in _add_details
    for (k, v) in six.iteritems(info):
  File "/usr/local/lib/python2.7/dist-packages/six.py", line 439, in iteritems
    return iter(getattr(d, _iteritems)(**kw))
AttributeError: 'unicode' object has no attribute 'iteritems'
ERROR: 'unicode' object has no attribute 'iteritems'

Changed in python-novaclient:
assignee: nobody → sahid (sahid-ferdjaoui)
Revision history for this message
Joe Gordon (jogo) wrote :

this looks like a novaclient bug only

Changed in nova:
status: New → Invalid
Revision history for this message
Sahid Orentino (sahid-ferdjaoui) wrote :

Joe, actually the bug is on nova and no novaclient.

Changed in python-novaclient:
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
Sahid Orentino (sahid-ferdjaoui) wrote :
Joe Gordon (jogo)
Changed in nova:
status: Invalid → New
Changed in nova:
assignee: nobody → sahid (sahid-ferdjaoui)
Changed in nova:
status: New → In Progress
Revision history for this message
Sahid Orentino (sahid-ferdjaoui) wrote :

This bug is not related with python-novaclient, may be we have to remove this dependence and set the "importance" for nova.

Changed in nova:
importance: Undecided → Medium
Yaguang Tang (heut2008)
no longer affects: python-novaclient
tags: added: compute
Vincent Untz (vuntz)
tags: added: havana-backport-potential
Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :

I think this bug is important.
The RESTful API is broken from the viewpoint of its design.

Now "get os-migrations" API returns the following body:

{"migrations": {
"objects": [
{"dest_host": "192.168.11.100", "instance_uuid": "7b2288fb-f16e-4b2d-9ee6-daebb0caca00", "deleted": false, "old_instance_type_id": 6, "updated_at": "2014-03-07T11:25:33.000000", "dest_compute": "localhost", "created_at": "2014-03-07T11:25:10.000000", "status": "finished", "source_node": "localhost", "source_compute": "localhost", "dest_node": "localhost", "deleted_at": null, "id": 1, "new_instance_type_id": 2}
]
}

On the other hand, ./doc/api_samples/os-migrations/migrations-get.json is

{
"migrations": [
{
            "created_at": "2012-10-29T13:42:02.000000",
            "dest_compute": "compute2",
            "dest_host": "1.2.3.4",
            "dest_node": "node2",
            "id": 1234,
            "instance_uuid": "instance_id_123",
            "new_instance_type_id": 2,
            "old_instance_type_id": 1,
            "source_compute": "compute1",
            "source_node": "node1",
            "status": "Done",
            "updated_at": "2012-10-29T13:42:02.000000"
        },
[..]
]

The difference is "objects" and it should be removed.
novaclient does not expect "objects" because of the API design, and this problem happens.
We need to fix this faster before the other clients expect the body should include "objects".

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/61717
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=4963fa0fa0d96d8641339614438d42c81958f728
Submitter: Jenkins
Branch: master

commit 4963fa0fa0d96d8641339614438d42c81958f728
Author: Sahid Orentino Ferdjaoui <email address hidden>
Date: Thu Jan 16 10:44:33 2014 +0100

    Fix broken API os-migrations

    The return is not what we are expecting:
      migration-list: 'unicode' object has no attribute 'iteritems'

    The conversion of the object nova.objects.MigrationList into a list
    is not applied automatically.

    Change-Id: I1579b1baf62275bf448f23be9465d4e9bc11ed85
    Closes-Bug: #1260249

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-rc1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/85692

Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-rc1 → 2014.1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/110890

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/havana)

Change abandoned by Edward Hope-Morley (<email address hidden>) on branch: stable/havana
Review: https://review.openstack.org/85692
Reason: Fixed ChangeID issue but unfortunately that means a new changeset - https://review.openstack.org/#/c/110890/ - so closing this one

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Alan Pevec (<email address hidden>) on branch: stable/havana
Review: https://review.openstack.org/110890
Reason: Final Havana release 2013.2.4 has been cut and stable/havana is going to be removed in a week.

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.