[openstack-dev] [nova]can someone help me? when I use cmd "nova migration-list" error.

li zheming lizheminghw at gmail.com
Mon Jan 20 02:34:04 UTC 2014


hi all:
      when I use cmd nova migration-list, it return error,like this:
   openstack at devstack:/home$ nova migration-list
   ERROR: 'unicode' object has no attribute 'iteritems'

   I step the codes and find the codes have some error.


   python-novaclient/novaclient/base.py

   class Manager(utils.HookableMixin):
    ......
    def _list(self, url, response_key, obj_class=None, body=None):
        if body:
            _resp, body = self.api.client.post(url, body=body)
        else:
            _resp, body = self.api.client.get(url)

        if obj_class is None:
            obj_class = self.resource_class

        data = body[response_key]
        # NOTE(ja): keystone returns values as list as {'values': [ ... ]}
        # unlike other services which just return the list...
        if isinstance(data, dict):
            try:
                data = data['values']
            except KeyError:
                pass

        with self.completion_cache('human_id', obj_class, mode="w"):
            with self.completion_cache('uuid', obj_class, mode="w"):
                return [obj_class(self, res, loaded=True)
                        for res in data if res]

        I set a breakpoint in "data = data['values']", and find the date is

        {u'objects': []}}, it has no key named values.

        it except a keyError and pass.

        if go " for res in data if res ", the res is unicode "object", this
will

         occur error in the next fun.

        do you met this issue? and someone who know why the comment
say "keystone
returns values as list as {'values': [ ... ]}"

        but I think this is not relevant about keystone. may be I
misunderstand this codes. please give me more info about this code.

                  thank you very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140120/58f58dfb/attachment.html>


More information about the OpenStack-dev mailing list