Neutron 2: Update NetFloatingIP to fetch and set all the fields#51
Neutron 2: Update NetFloatingIP to fetch and set all the fields#51olivergondza merged 2 commits intoopenstack4j:masterfrom
Conversation
|
@openstack4j/reviewers, review would be highly appreciated. |
pjdarton
left a comment
There was a problem hiding this comment.
Personally, I prefer refactoring/reformatting changes and functional changes not to be in the same changeset - it makes it more difficult to see what the functional changes are when there's also diffs from non-functional changes.
e.g. NetFloatingIP.java line 63, 70, 72, NetFloatingIPBuilder.java line 12-28, NeutronFloatingIP.java line 183, 191, 195-197, 200-201, 204-226
There's also inconsistency within the code w.r.t. {@inheritDoc}. I think that we should either have a consistent policy of always having /** {@inheritDoc} */ comments for @Override methods or never having them; this PR removes some but adds others.
FYI I approve of the refactoring / whitespace changes, I'd just prefer them in their own PR that can be reviewed as a "no brainer", merged and then provide a nice clean starting point for the new functionality that's desired.
My only comments w.r.t. functionality are that NeutronFloatingIP.toString() no longer includes the tenantId field and now includes a \n. Given that we're calling omitNullValues() I think it'd be better to include all fields and, personally, I'm not a fan of embedded \n characters in toString methods - if a caller wants a linebreak then that's their business and it's trivial to add, whereas taking things away is more complicated.
I've not compared NeutronFloatingIP's json metadata against the OpenStack spec (mostly because I'm not 100% clear what this PR is trying to do) but I'd hope that these fields are (a) correctly spelled and (b) in the same order they're listed in the spec.
I believe that adding new fields that go unused by client code will have no effect because null values don't get written into the json, so there should be no fear of backwards-compatibility issues from adding new fields to outgoing requests, but I guess it's possible we might throw if the json we receive from incoming results has fields we now support but in formats we don't. It's probably the lowest risk option we can do.
Lastly, I'd recommend adding a description to the PR - while I can see what code changes have been made, I don't know what functional changes were intended or what need these changes were intending to address, so I can't make any informed decisions on whether or not the code meets requirements/design; this also limits the utility of any code review I can give.
|
@pjdarton, I tried to stay from whitespace changes but some of the files ware badly messed (three space indent, tabs mixed with spaces) so I gave up at places. There ware no intent to rectify the bed formatting. I track that effort in https://github.com/openstack4j/openstack4j/projects/1.
100% agreed, mind the
Correct, I have verified that. One nasty thing about the openstack4j design is, the same object are often used for sending and receiving the entity even though the fields documented on GET and POST do not always 100% match (
oh, are they not?
Valid point. My apology. |
|
😁 Yeah, I have similar tendencies myself - a near-uncontrollable need to tidy up messy code as I go along - the problem with that is that those changes then make the main changes harder to see. That's why I prefer to keep functional changes in PRs that have no other others, and tidy-up/refactor PRs to have no functional changes.
Ok, my bad; I'm glad the
If they're separate fields, they're not guaranteed to be the same value - a user could set them to different values.
I hadn't checked; I'd not looked up the spec when I first reviewed the code. |
|
@pjdarton, good idea with the Re reformatting all the code and property reordering, I prefer to keep the code changes conservative since the fork day to simplify eventual merging back. In fact, we are having discussions with past maintainers of ContianX/openstack4j to move beck there taking advantage of existing .org domain, continuation of maven coordinates and the fact most users are filing issues and PRs there. Once we merge or we get clear that we won't, I am happy to do that. |
|
Ah, if we're planning on merging back then, yes, I agree that we should keep our code changes as simple as possible. |
|
Thanks for the review, @pjdarton. We are in agreement, I hope we will be able to get rid of the messed formatting soon. |
Add remaining fields missing in
NetFloatingIPso all documented fields can be read.https://docs.openstack.org/api-ref/network/v2/?expanded=list-floating-ips-detail