Skip to content
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

refactor: move validation/defaults to app #514

Merged
merged 2 commits into from
Aug 22, 2022
Merged

refactor: move validation/defaults to app #514

merged 2 commits into from
Aug 22, 2022

Conversation

richardcase
Copy link
Member

What this PR does / why we need it:

This change moves the adding of the mmds network interface and
validation of the microvm spec to the app and out of the gRPC
infrastructure.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #513

Special notes for your reviewer:

Checklist:

  • squashed commits into logical changes

@richardcase richardcase added the kind/refactor Only refactoring changes label Aug 19, 2022
@@ -171,3 +186,24 @@ func (a *app) addInstanceData(vm *models.MicroVM, logger *logrus.Entry) error {

return nil
}

func (a *app) addMetadataInterface(mvm *models.MicroVM) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could probably return a bool rather than an error. The caller is doing fmt.Errorf("adding metadata network interface: %w", err) but the func never returns an err.
Actually, in that case does it need to return anything? It could just return nothing on 194 and leave the func early

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a good point. Changed.

This change moves the adding of the mmds network interface and
validation of the microvm spec to the app and out of the gRPC
infrastructure.

Signed-off-by: Richard Case <richard.case@outlook.com>
},
})

return
Copy link
Member

@Callisto13 Callisto13 Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this last return is likely redundant

@richardcase richardcase merged commit 40bd434 into liquidmetal-dev:main Aug 22, 2022
@richardcase richardcase deleted the 513_grpc_app_refactor branch August 22, 2022 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/refactor Only refactoring changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move defaulting and validation from gRPC to App
2 participants