-
Notifications
You must be signed in to change notification settings - Fork 29
Temporary DHCP fix #228
base: master
Are you sure you want to change the base?
Temporary DHCP fix #228
Conversation
…r dhcp operation type CREATE/UPDATE
| } | ||
|
|
||
| switch (current_DhcpState.operation_type()) { | ||
| alcor::schema::OperationType current_operation_type = |
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.
since this is a temporary fix :), it will be great to add a bunch of comment on why we are doing it, what does it do and when we should remove it.
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.
Comment added, thanks for your suggestions 👍
src/dhcp/aca_dhcp_state_handler.cpp
Outdated
| for (int i = 0; i < parsed_struct.port_states().size(); i++) { | ||
| ACA_LOG_INFO( | ||
| "Port %d MAC: %s, device_ID: %s, device_owner: %s\n", i, | ||
| (parsed_struct.port_states().at(i).configuration().mac_address()).c_str(), |
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.
you can do parsed_struct.port_states(i) instead of parsed_struct.port_states().at(i)
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.
Done
src/dhcp/aca_dhcp_state_handler.cpp
Outdated
| alcor::schema::OperationType current_operation_type = | ||
| current_DhcpState.operation_type(); | ||
| if (current_operation_type == alcor::schema::OperationType::UPDATE) { | ||
| for (auto &port_state : parsed_struct.port_states()) { |
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.
for the goalstatev2, you may direct access the corresponding port_state assuming the port resource ID is the same as the DHCP resource ID. See this for an example:
| // lookup subnet information |
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.
This is really a good way to do it, thanks for pointing it out 👍
er1cthe0ne
left a comment
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.
LGTM
This is a temporary DHCP fix, we need to test it with the cluster.