[nailgun] Nailgun returns incorrect nodes id during erroneously node assigning procedure

Bug #1576198 reported by Vitalii Kulanov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Committed
Low
Vitalii Kulanov

Bug Description

Detailed bug description:
While trying to set some already assigned nodes to another environment nailgun returns nodes instance id instead real nodes id.

[root@fuel ~]# fuel --env 2 node set --node 3 --role controller --debug
POST http://10.20.0.2:8000/api/v1/clusters/2/assignment/ data=[{"id": 3, "roles": ["controller"]}]
400 Client Error: Bad Request for url: http://10.20.0.2:8000/api/v1/clusters/2/assignment/ (Nodes with ids <nailgun.db.sqlalchemy.models.node.Node object at 0x5df7410> already assigned to environments. Nodes must be unassigned before they can be assigned again.)

Steps to reproduce:

1. Deploy Fuel (e.g. 1 master + 5 nodes).
2. Create env and add several nodes to it.
3. Create new env and try to add node that already belongs to another environment through the python-fuelclient (REST API)

Expected results:
Error message should contain specific id(s) of node(s) that can not be added.

Actual result:
Error message contains nailgun.db.sqlalchemy.models.node.Node object id

Reproducibility:
Always

Description of the environment:
cat /etc/fuel_build_id:
 88
cat /etc/fuel_build_number:
 88
cat /etc/fuel_release:
 10.0
cat /etc/fuel_openstack_version:
 newton-10.0

Additional information:
check_if_already_done method should be refactored (https://github.com/openstack/fuel-web/blob/master/nailgun/nailgun/api/v1/validators/assignment.py#L47-L54)

Changed in fuel:
assignee: nobody → Vitalii Kulanov (vitaliy-t)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-web (master)

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

Changed in fuel:
status: New → In Progress
Changed in fuel:
milestone: none → 10.0
Changed in fuel:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-web (master)

Reviewed: https://review.openstack.org/310801
Committed: https://git.openstack.org/cgit/openstack/fuel-web/commit/?id=cef9e6706423f553a4e0e4334b7e31d9a21b326f
Submitter: Jenkins
Branch: master

commit cef9e6706423f553a4e0e4334b7e31d9a21b326f
Author: tivaliy <email address hidden>
Date: Thu Apr 28 16:42:40 2016 +0300

    Fix incorrect values of nodes ids in Nailgun response

    Fix incorrect value of nodes ids in nailgun response
    (400 Client Error) during nodes assignment procedure for
    already assigned nodes

    Change-Id: I0c0812c683a768a7a1007037fc8d4470fcae643e
    Closes-Bug: 1576198

Changed in fuel:
status: In Progress → Fix Committed
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.