Empty string in key_name treated as None but gets into DB

Bug #1403544 reported by Alexey I. Froloff
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Alexey I. Froloff

Bug Description

When creating instance, it is possible to specify "'key_name': ''". This empty string is treated as None by nova.compute.api._validate_and_build_base_options(), but gets written to DB. Then it breaks Horizon when it creates the "Decrypt Password" button for instance details view, because 'key_name' is checked to be not None.

Tags: compute
Changed in nova:
assignee: nobody → Avinash (avinash-jalumuru)
Changed in nova:
assignee: Avinash (avinash-jalumuru) → Santhosh Peddiboyina (peddiboyina-9)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
assignee: Santhosh Peddiboyina (peddiboyina-9) → Alexey I. Froloff (raorn)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
Alexey I. Froloff (raorn) wrote :

I have posted two patches. One treats empty key_name as non Null (and gives error trying to find matching keypair), other sets key_name to None when key_name is empty.

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

Change abandoned by Alexey I. Froloff (<email address hidden>) on branch: master
Review: https://review.openstack.org/142755

melanie witt (melwitt)
Changed in nova:
importance: Undecided → Medium
tags: added: compute
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/142752
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=2ad3009f3595e701a866f265263ca3a0a8ef09dc
Submitter: Jenkins
Branch: master

commit 2ad3009f3595e701a866f265263ca3a0a8ef09dc
Author: Alexey I. Froloff <email address hidden>
Date: Thu Dec 18 15:19:05 2014 +0300

    Do not treat empty key_name as None

    When running instance, empty ("") key_name is treated as None and
    keypair lookup does not happen. However, empty string is written to
    key_name field in instance's database record. When horizon renders
    instance info, it looks up keypair if key_name is not None. Having
    empty string in this property generates error and instance info is not
    displayed.

    Change-Id: Ib67b124e6480f3435d31c983f1bfca769899c8e7
    Closes-Bug: #1403544

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-2
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to nova (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/163230

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

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

commit dd52617232c0915c85ca227e975c759c20e41b75
Author: Kent Wang <email address hidden>
Date: Tue Mar 10 08:44:32 2015 -0700

    Adds Not Null constraint to KeyPair name

    Since the API enforces that name is not null, the database schema and
    model are now updated to enforce this.

    Change-Id: I1088cc79f4998d3b6609891adbb0479381297ec4
    Related-Bug: #1403544
    Closes-Bug: #1189981

Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-2 → 2015.1.0
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.