Create Keypair failed on latest DevStack

Bug #1493205 reported by Amogh
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Critical
Timur Sufiev
python-novaclient
Invalid
Critical
Unassigned

Bug Description

Deploy latest stack.

1. Login as admin, try to create new Keypair
2. Observe that Create Keypair fails.

Refer the screenshot.

Revision history for this message
Amogh (amogh-r-mavinagidad) wrote :
Revision history for this message
Chung Chih, Hung (lyanchih) wrote :

Hi, you can checkout this bug
https://bugs.launchpad.net/horizon/+bug/1493207
I was post after few minutes then your bug.

Changed in horizon:
assignee: nobody → Chung Chih, Hung (lyanchih)
Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

Good, the integration tests finally have started catching some bugs :).

Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

It makes the sense to mark all similar bugs filed later as duplicates of this one, still this one lacks some context that the first duplicate has. I'm fixing this with the following copy-paste:

Following is keypair-add api request in log
2015-09-08 05:09:49.213635 REQ: curl -g -i 'http://10.20.0.105:8774/v2.1/c6d51ff62ef147aaa5ec7e7583de74c7/os-keypairs' -X POST -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Project-Id: c6d51ff62ef147aaa5ec7e7583de74c7" -H "X-Auth-Token: {SHA1}bfc226cbca590d089f197b71fdcf88df5ea50175" -d '{"keypair": {"type": "ssh", "name": "d"}}'
2015-09-08 05:09:49.223710 RESP: [400] {'content-length': '190', 'x-compute-request-id': 'req-25eab1e0-20d7-4738-83ff-78061ce977bf', 'vary': 'X-OpenStack-Nova-API-Version', 'connection': 'keep-alive', 'x-openstack-nova-api-version': '2.1', 'date': 'Tue, 08 Sep 2015 05:09:49 GMT', 'content-type': 'application/json; charset=UTF-8'}
2015-09-08 05:09:49.223823 RESP BODY: null
2015-09-08 05:09:49.223882
2015-09-08 05:09:49.224676 Recoverable error: Invalid input for field/attribute keypair. Value: {u'type': u'ssh', u'name': u'd'}. Additional properties are not allowed (u'type' was unexpected) (HTTP 400) (Request-ID: req-25eab1e0-20d7-4738-83ff-78061ce977bf)

Body's schema is supported by api version above 2.2.
However horizon mark this request as 2.1 version.
Type is not allowed properties at 2.1.
Therefore this exception will been raised.

Besides nova cli is send 2.11 version, so it will work.

Sean Dague (sdague)
Changed in python-novaclient:
status: New → Confirmed
importance: Undecided → Critical
Revision history for this message
Serhii Vasheka (svasheka) wrote :

had same issue just now, been able to catch error message before the one in first screenshot shown.

Revision history for this message
Andriy Kurilin (andreykurilin) wrote :

Copy-paste of my comment from patch https://review.openstack.org/#/c/221222/ :

This problem should be fixed at horizon side. Horizon uses novaclient incorrect. Only novaclient.client should be used as entry point(it contains all version checks and backward compatibility for opts), but Horizon uses novaclient.v2.client directly... https://github.com/openstack/horizon/blob/master/openstack_dashboard/api/nova.py#L448-L454

From side of novaclient, we can add additional check at v2.client (https://github.com/openstack/python-novaclient/blob/master/novaclient/v2/client.py#L158) that api_version is provided and set it to APIVersion("2.0") if not. But, imo, current situation is a good chance to say "use correct entrypoint for novaclient now!"

Revision history for this message
Andriy Kurilin (andreykurilin) wrote :
Changed in horizon:
status: New → Confirmed
Changed in python-novaclient:
status: Confirmed → Invalid
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-novaclient (master)

Change abandoned by John Garbutt (<email address hidden>) on branch: master
Review: https://review.openstack.org/221222
Reason: cool, lets drop this, it seems it not actually required.

Changed in horizon:
assignee: Chung Chih, Hung (lyanchih) → Timur Sufiev (tsufiev-x)
status: Confirmed → In Progress
Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

Chung Chih, sorry for stepping on your toes here, but the fix I python-novaclient usage fix I made for Horizon seems to solve this bug as well.

Changed in horizon:
importance: Undecided → Critical
Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

Raising to Critical since it's impossible to create a keypair in Horizon.

Changed in horizon:
milestone: none → liberty-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/221711
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=27ceba6035c22b7f11e529ddbc287f27568bb8e8
Submitter: Jenkins
Branch: master

commit 27ceba6035c22b7f11e529ddbc287f27568bb8e8
Author: Timur Sufiev <email address hidden>
Date: Wed Sep 9 14:27:34 2015 +0300

    Fix usage of python-novaclient in Horizon

    Direct `from novaclient.v2 import client` became source of problems
    since the introduction of microversions in Nova. According to
    novaclient docs, `from novaclient import client` (with the following
    specification of version 2 in Client constructor) is a proper way of
    using it. It should safeguard Horizon against the backward
    incompatibility issues, such as in bug 1493205.

    Change-Id: Ifedd47e8ad6a7aac52549f6e1742dd73fed48da1
    Closes-Bug: #1493576
    Closes-Bug: #1493205

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: liberty-rc1 → 8.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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