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

Create Block devices during configuration instead of boot-time #1736

Merged
merged 3 commits into from
Apr 9, 2020

Conversation

acatangiu
Copy link
Contributor

@acatangiu acatangiu commented Apr 1, 2020

Reason for This PR

Fixes #1702

Prerequisite for #1713

Description of Changes

Following the more decoupled design we can now create block 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 (deleting backing files, 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 force-pushed the build_block branch 2 times, most recently from 18a9d45 to 4d4e2be Compare April 1, 2020 18:18
@raduiliescu
Copy link
Contributor

Will this help in being able to attach block devices to a running Firecracker?

@acatangiu
Copy link
Contributor Author

It is a step in that direction yes, but we're far from it since the biggest missing piece there is PCI + Hotplug

src/vmm/src/vmm_config/drive.rs Outdated Show resolved Hide resolved
src/vmm/src/vmm_config/drive.rs Outdated Show resolved Hide resolved
src/vmm/src/vmm_config/drive.rs Outdated Show resolved Hide resolved
src/vmm/src/builder.rs Show resolved Hide resolved
src/vmm/src/vmm_config/drive.rs Show resolved Hide resolved
@acatangiu
Copy link
Contributor Author

This PR is a prerequisite for #1713

ioanachirca
ioanachirca previously approved these changes Apr 8, 2020
Copy link
Contributor

@ioanachirca ioanachirca left a comment

Choose a reason for hiding this comment

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

LGTM

src/vmm/src/builder.rs Show resolved Hide resolved
src/devices/src/virtio/block/device.rs Show resolved Hide resolved
alxiord
alxiord previously approved these changes Apr 8, 2020
Signed-off-by: Adrian Catangiu <acatan@amazon.com>
Following the more decoupled design we can now create block 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 (deleting files, 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 <acatan@amazon.com>
Validating the Display value of errors against the static
strings used in the Display implementation is redundant.

This is typically a bad engineering practice referred to as WET.
You can read more about it here:
https://en.wikipedia.org/wiki/Don%27t_repeat_yourself

Signed-off-by: Adrian Catangiu <acatan@amazon.com>
@acatangiu acatangiu dismissed stale reviews from alxiord and ioanachirca via a99beca April 9, 2020 08:08
@acatangiu
Copy link
Contributor Author

@ioanachirca @aghecenco I've rebased, please take a look.

@alxiord alxiord merged commit 12a015a into firecracker-microvm:master Apr 9, 2020
@acatangiu acatangiu deleted the build_block 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 Block devices during configuration instead of boot-time
6 participants