Change the "node" name to be more verbose and clearly document which parts of the API use Node and which use BaremetalNode

Bug #1244202 reported by Radomir Dopieralski
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tuskar
Won't Fix
Medium
Unassigned
tuskar-ui
Won't Fix
Medium
Radomir Dopieralski

Bug Description

After bug #1236192 is fixed, we need to be careful to use the right kind of node references with the API. Right now it's not clear which functions accept/emit which kinds of the nodes. We need to make sure this is very clear.

One example where it's not clear: https://review.openstack.org/#/c/53542/1/tuskar_ui/infrastructure/resource_management/racks/workflows.py

Revision history for this message
Marios Andreou (marios-b) wrote :

Hey - so I was initially a bit confused with the use of 'document' - i immediately thought about the API docs. However I think you mean more like "lets make sure Tuskar-UI and Tuskar-API are exchanging the correct node ids in appropriate places" (Perhaps this *could* eventually go into the dev docs as well but we first need to fix the code).

Sorry for the silly question, but is this really a bug, yet? I mean is it causing explosions, in a specific place in the code. If so, why don't we file a specific bug for that, with what you wrote above in the description. I just think this is a bit too broad right now and reads almost like a blueprint rather than bug. So i'm not sure whether I should set this to 'triaged' just yet? I'll set it to 'incomplete' right now as its the best fit I could find in the list.

Changed in tuskar:
status: New → Incomplete
Changed in tuskar-ui:
status: New → Incomplete
Revision history for this message
Radomir Dopieralski (deshipu) wrote :

Sorry for ambiguous wording. I didn't mean the separate docs, and I didn't mean going through the code and checking if it's all correct. What I mean is using different variable, field and attribute names for different kinds of nodes, clearly stating in the docstrings what kind of nodes a given function returns, etc.

I think this *is* a bug in the code, and it will, sooner or later, make things explode -- or at least it will cause strange and hard to find bugs. If we can't see at a glance whether it's a tuskar node or a baremetal node, then we will make mistakes. Code that invites mistakes is buggy code. It's a catastrophe waiting to happen.

The places where this needs to happen are pretty obvious: tuskar.db.api, tuskar.db.sqlalchemy.models, tuskar_ui.api

Revision history for this message
Radomir Dopieralski (deshipu) wrote :

It would be best if we agreed to never use the "node" name, and instead always use either "tuskar_node" or "baremetal_node".

Changed in tuskar-ui:
assignee: nobody → Radomir Dopieralski (thesheep)
Revision history for this message
Ladislav Smola (lsmola) wrote :

"tuskar_node", "baremetal_node"(ironic_node) and "nova_node"

Otherwise it's to too hard to read the code.

summary: - Clearly document which parts of the API use Node and which use
+ Clearly indicate which parts of the API use Node and which use
BaremetalNode
summary: - Clearly indicate which parts of the API use Node and which use
+ Clearly indicate which parts of the code use Node and which use
BaremetalNode
Ladislav Smola (lsmola)
Changed in tuskar-ui:
status: Incomplete → Triaged
summary: - Clearly indicate which parts of the code use Node and which use
- BaremetalNode
+ Change the "node" name to be more verbose and clearly document which
+ parts of the API use Node and which use BaremetalNode
Changed in tuskar-ui:
importance: Undecided → Medium
milestone: none → icehouse-1
Tomas Sedovic (tsedovic)
Changed in tuskar:
status: Incomplete → Triaged
Tomas Sedovic (tsedovic)
Changed in tuskar:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tuskar-ui (master)

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

Changed in tuskar-ui:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tuskar-ui (master)

Reviewed: https://review.openstack.org/54564
Committed: http://github.com/openstack/tuskar-ui/commit/10f428eb765b894f4c2403f8b5def8f4b3a5df5d
Submitter: Jenkins
Branch: master

commit 10f428eb765b894f4c2403f8b5def8f4b3a5df5d
Author: Radomir Dopieralski <email address hidden>
Date: Wed Oct 30 16:14:50 2013 +0100

    Rename "node" variables and methods to tuskar_node or baremetal_node

    Since we have so many different types representing node data in some
    way, it has became hard to read the code when it's not certain what
    kind of node we are dealing with at a particular point. Renaming the
    variables to clearly indicate the node type should help with it.

    This patch only does the changes that don't require changing anything
    in tuskar or tuskarclient. There are still a few places left that
    require such changes, but that requires some synchronization.

    Change-Id: If5fae7b60318ec91fd288da5a42bdefb93fce911
    Partial-bug: #1244202

Changed in tuskar:
status: Triaged → Won't Fix
Changed in tuskar-ui:
status: In Progress → Won't Fix
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.