-
Notifications
You must be signed in to change notification settings - Fork 77
add deleting all types of nodes #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'_' is not defined.
|
Codes uses new constants defined in on-core (PR RackHD/on-core#55). The success of unit test depends on it. PR RackHD/on-core#55 would be merged to master first and rerun the test here. |
lib/services/nodes-api-service.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does "ds" mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DsNodes = downstream nodes, I stated the latter in PR description and the doc for this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to use "downstream" instead of the short name "ds" though it is a long word. "ds" is not a conventional abbreviation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have thought the name a lot before when coding, and got to know from HW engineer that "downstream port" is abbreviated as "DSP", thus I chose the variable name here as it is now (ds). But now it seems that it still brings confusion, changing the function name to "downstream" for clear understanding and keeping the local variable as "ds" for direct use might be good choice.
|
@yyscamper @anhou I rename all "downstream" to "target" node to make it clearer. |
lib/services/nodes-api-service.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be Promise.resolve() ?
lib/services/nodes-api-service.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the word "Downstream" be modified as now you have all changed it to "Target"?
|
I know it's a pain, but could you add a |
788a938 to
99d4827
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'before' is not defined.
|
@benbp done for adding local '_' in unittest |
|
This should be the top 1 PR with highest number of comment :) |
|
👍 |
Implement full function about deleting nodes and update its related ones based on "relations" field in nodes/ document. It is invoked by ODR-314 (https://hwjiraprd01.corp.emc.com/browse/ODR-314) requiring removing compute nodes in an enclosure when user asks to delete that enclosure node.
Currently there is only (enclosedBy, encloses) relation in node, but it is easily extensible to cover other relations such as (powers, powerBy) or (compute node use dae, dae used by compute node). When deleting one node, RackHD should also delete or update its corresponding nodes in different conditions.
There are 3 types of operations to deal with corresponding (I call it "target node" in code and here) nodes:
e.g. delete enclosure node -> delete compute node as well
e.g. delete compute node -> delete enclosure node if this enclosure doesn't have other compute node
e.g. delete compute node -> update relations in pdu node
This PR covers all cases above. constants.js in on-core defines mapping table and supported target operations. node-api-service in this PR reads this setting and manipulates database. The required nodes will be deleted only after all its target nodes have been processed successfully.
related PR:
RackHD/on-core#55