Skip to content

Create Net devices during configuration instead of boot-time #1735

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

Merged
merged 5 commits into from
Apr 8, 2020

Conversation

acatangiu
Copy link
Contributor

@acatangiu acatangiu commented Apr 1, 2020

Reason for This PR

Fixes #1708

Prerequisite for #1713

Description of Changes

Simplify code in NetworkInterfaceConfig

Refactored the insert() function to remove duplicated code between the create and update cases. Also removed a couple of redundant getters.

Create Net devices during config instead of boot

Following the more decoupled design we can now create net devices on their configuration path, rather than saving a config and delaying creation to boot-time.

Such a model allows user-errors (like invalid resources or permissions) to be reported as part of the configuration step rather than later at attempted boot.

It would also remove the time window between configuration and boot where changes to the host system (creating Taps, changing permissions, etc) would cause microVM boot failures (race condition between validation and commitment of resources).

Such a model should also decrease code complexity and should provide better efficiency to the process of configuring and starting a microVM (no more moving configurations around in memory and validating resources both at config time and boot-time).

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.

PR Checklist

[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any newly added unsafe code is properly documented.
  • Any API changes are reflected in firecracker/swagger.yaml.
  • Any user-facing changes are mentioned in CHANGELOG.md.

@acatangiu acatangiu self-assigned this Apr 1, 2020
@acatangiu acatangiu added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Apr 1, 2020
@acatangiu acatangiu changed the title Create Net devices during config instead of boot Create Net devices during configuration instead of boot-time Apr 1, 2020
// Validate there is no Mac conflict.
// No need to validate host_dev_name conflict. In such a case,
// an error will be thrown during device creation anyway.
if self.if_list.iter().any(no_mac_conflict) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would read better if the closure was called mac_conflict.

ioanachirca
ioanachirca previously approved these changes Apr 8, 2020
Refactored the 'insert()' function to remove duplicated code
between the create and update cases.
Also removed a couple of redundant getters.

Signed-off-by: Adrian Catangiu <[email protected]>
Remove 'Result' wrapper over built MmioTransport.

Signed-off-by: Adrian Catangiu <[email protected]>
This commit adds a device 'id' field and getters for both 'id'
and 'guest_mac'.

Signed-off-by: Adrian Catangiu <[email protected]>
Following the more decoupled design we can now create net devices
on their configuration path, rather than saving a config and delaying
creation to boot-time.

This model allows user-errors (like invalid resources or permissions)
to be reported as part of the configuration step rather than later
at attempted boot.
It also removes the time window between configuration and boot where
changes to the host system (creating Taps, changing permissions, etc)
could cause microVM boot failures.

This commit decreases code complexity and should provide better
efficiency to the process of configuring and starting a microVM.

Signed-off-by: Adrian Catangiu <[email protected]>
@sandreim sandreim self-requested a review April 8, 2020 10:42
@sandreim sandreim merged commit 0b8d0b9 into firecracker-microvm:master Apr 8, 2020
@acatangiu acatangiu deleted the build_net branch April 14, 2020 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting review Indicates that a pull request is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Net devices during configuration instead of boot-time
3 participants