-
Notifications
You must be signed in to change notification settings - Fork 2k
Vhost user block #4170
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
Vhost user block #4170
Conversation
bc4074a
to
3aa7d42
Compare
I know it is a tedious thing to do, but at some point (if you haven't already) we need to make sure every commit builds and unit tests pass. |
f1e5873
to
3ae0d8d
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #4170 +/- ##
==========================================
- Coverage 82.98% 82.20% -0.79%
==========================================
Files 230 236 +6
Lines 28710 29203 +493
==========================================
+ Hits 23826 24007 +181
- Misses 4884 5196 +312
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
c4058d1
to
a11cc77
Compare
2adb53c
to
d7f610f
Compare
d9884a3
to
4c1a788
Compare
52f7142
to
837b5e9
Compare
Created a separate block config struct and updated Block::new method to accept it instead of separate parameters. Updated block restoration code as well. Signed-off-by: Egor Lazarchuk <[email protected]>
This is done to better differentiate between virtio devices and vhost-user devices. Signed-off-by: Egor Lazarchuk <[email protected]>
In order to allow creation of other block device subtypes, we wrap former Block structure into an enum. At the moment it contains a single variant `VirtioBlock`. Further on it will be extended with other device subtypes. Signed-off-by: Egor Lazarchuk <[email protected]> Co-authored-by: Nikita Kalyazin <[email protected]>
Added vhost-user wrapper for the interraction with backend. Signed-off-by: Egor Lazarchuk <[email protected]> Co-authored-by: Nikita Kalyazin <[email protected]> Co-authored-by: Diana Popa <[email protected]>
Added implementation for vhost-user-block device. Signed-off-by: Egor Lazarchuk <[email protected]> Co-authored-by: Nikita Kalyazin <[email protected]> Co-authored-by: Diana Popa <[email protected]>
Now `BlockDeviceType` has both virtio-block and vhost-user-block. Because we can not test vhost-user-block at this time, we skip vhost-user-block in the unit tests. Signed-off-by: Egor Lazarchuk <[email protected]>
Even though we don't support creation of snapshots with vhost-user-block device we add it to the restoration path for future use. Signed-off-by: Egor Lazarchuk <[email protected]>
Updated `BlockDeviceConfig` with vhost-user-block specific field. Updated methods to convert `BlockDeviceConfig` into `VirtIOBlockConfig` or `VhostUserBlockConfig`. Updated integration tests with new ordering of fields in the `BlockDeviceConfig`. Signed-off-by: Egor Lazarchuk <[email protected]>
This is done to make it clear where the imports are comming from. Signed-off-by: Egor Lazarchuk <[email protected]>
CacheType is shared between VirtioBlock and VhostUserBlock. Signed-off-by: Egor Lazarchuk <[email protected]>
Simplified `DiskProperties` implementation. Removed a lot of getters from `VirtIOBlock` Removed `CacheTypeState` because it is same as `CacheType` Signed-off-by: Egor Lazarchuk <[email protected]>
Now virtio_block is named similar to vhost_user_block Signed-off-by: Egor Lazarchuk <[email protected]>
Moved duplicated code into a macro in `attach_block_devices` Signed-off-by: Egor Lazarchuk <[email protected]>
Now `MmioTransport` stores info if the device uses vhost_user implementation. Based on this info the interrupt status reported to the guest is either an updatde interrupt status (for usual virtio devices) or `VIRTIO_MMIO_INT_VRING`(0x1) for vhost_user devices. This is done because vhost_user devices can not update interrupt status variable in the FC. Signed-off-by: Egor Lazarchuk <[email protected]>
Updated swagger for `drive` api with new descriptions and fields for vhost-user-block. Signed-off-by: Egor Lazarchuk <[email protected]>
For some reason this file was not formatted. Signed-off-by: Egor Lazarchuk <[email protected]>
Added `sendmsg` syscall to the seccomp. It is needed for vhost-user-block. Signed-off-by: Egor Lazarchuk <[email protected]>
Added a simple test that boots a VM with vhost-user-block as root block device. Signed-off-by: Egor Lazarchuk <[email protected]>
In firecracker-microvm#2702 the behaviour of the `Unsafe` cache type was changed. If selected the `flush` feature is not advertised to the guest. This commit just adds missing documentation change. Signed-off-by: Egor Lazarchuk <[email protected]>
Added a trait that helps with mocking `vhost::Master` struct. Added unit tests for feature negotiated methods. Signed-off-by: Egor Lazarchuk <[email protected]>
Made `VhostUserBlock` generic on `VhostUserHandleBackend`. Added unit tests for `VhostUserBlock` creation and feature negotiation. Signed-off-by: Egor Lazarchuk <[email protected]>
Moved `create_test_socket` into test module Signed-off-by: Egor Lazarchuk <[email protected]>
837b5e9
to
edec970
Compare
Changes
This PR adds vhost-user-bock device implementation with unit tests and initial integration test.
In order to configure new device type, old
/drive
endpoint is used with new parametersocket
.Depending if certain fields are present in the request body, different types of device can be configured. More details in the swagger file.
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following
Developer Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md
.PR Checklist
CHANGELOG.md
.TODO
s link to an issue.rust-vmm
.