Reviewed: https://review.opendev.org/709431 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b68033ecc9d38dcbe339c993338bdca691f73b33 Submitter: Zuul Branch: master
commit b68033ecc9d38dcbe339c993338bdca691f73b33 Author: Fan Zhang <[email protected]> Date: Mon Feb 24 16:49:35 2020 +0800 Fix hypervisors paginted collection_name. Hypervisor view builder's _collection_name, 'hypervisors' is used to build next link that sdk use as uri to do paginated query. But correct API should be `GET /v2.1/os-hypervisors?<params>` rather than `GET /v2.1/hypervisors?<params>`. This patch fixes this bug. Change-Id: Idc4f3fe54136a6bd3dbc7dc0efd3f62745991199 Closes-Bug: 1864428 Signed-off-by: Fan Zhang <[email protected]> ** Changed in: nova Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1864428 Title: Hypervisors collection_name affects pagination query Status in OpenStack Compute (nova): Fix Released Status in OpenStack SDK: New Bug description: In nova, hypervisor view builder's collect_name is 'hypervisors': ``` # nova.api.openstack.compute.views.hypervisors.ViewBuilder class ViewBuilder(common.ViewBuilder): _collection_name = "hypervisors" def get_links(self, request, hypervisors, detail=False): coll_name = (self._collection_name + '/detail' if detail else self._collection_name) return self._get_collection_links(request, hypervisors, coll_name, 'id') ``` So when we do paginated query via openstacksdk, we would get response like this: ``` {u'hypervisors': [{u'status': u'enabled', u'state': u'up', u'id': u'53fb5bdc-f9a4-4fc4-a4be-8eb33cd236b1', u'hypervisor_hostname': u'gd02-compute-11e115e64e19'}, {u'status': u'enabled', u'state': u'up', u'id': u'a4db6ea8-2a91-45e7-a4b4-cb26c2dbc514', u'hypervisor_hostname': u'gd02-compute-11e115e64e11'}, {u'status': u'enabled', u'state': u'up', u'id': u'd92c5452-ea75-4f58-8e0b-b4a6823850d8', u'hypervisor_hostname': u'gd02-compute-11e115e64e12'}], u'hypervisors_links': [{u'href': u'http://nova-api.cty.os:11010/v2.1/hypervisors?limit=3&marker=d92c5452-ea75-4f58-8e0b-b4a6823850d8', u'rel': u'next'}]} ``` And openstacksdk uses wrong hypervisors_links to query next page, and get error: ``` Traceback (most recent call last): File "p_hypervisors-admin.py", line 48, in <module> do_operation(limit, marker) File "p_hypervisors-admin.py", line 38, in do_operation srvs = [i for i in info] File "/usr/lib/python2.7/site-packages/openstack/resource.py", line 898, in list exceptions.raise_from_response(response) File "/usr/lib/python2.7/site-packages/openstack/exceptions.py", line 212, in raise_from_response http_status=http_status, request_id=request_id openstack.exceptions.NotFoundException: NotFoundException: 404: Client Error for url: http://nova-api.cty.os:11010/v2.1/hypervisors?limit=3&marker=ea9d857a-6328-47a8-abde-dc38972f4ca2, Not Found ``` The right uri should be `/v2.1/os-hypervisors` To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1864428/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

