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

runtime: Pass KataVirtualVolume to the guest as devices in go runtime #8494

Merged
merged 4 commits into from Nov 27, 2023

Conversation

ChengyuZhu6
Copy link
Member

@ChengyuZhu6 ChengyuZhu6 commented Nov 22, 2023

Pass KataVirtualVolume to the guest as devices(#7698, #8471) to support nydus image, raw block image, direct volume and image pulling on the guest.

This will be a core dependency for several other PRs(#8484, #7837).

Notes: This code is the outcome of extracting the logic about KataVirtualVolume from two PRs(#7688, #7676) in CCv0 that have been merged.

Fixes: #8495

@katacontainersbot katacontainersbot added the size/large Task of significant size label Nov 22, 2023
@ChengyuZhu6 ChengyuZhu6 changed the title Pass devices to the guest through KataVirtualVolume Pass devices to the guest through KataVirtualVolume in go runtime Nov 22, 2023
@ChengyuZhu6 ChengyuZhu6 added the area/runtime Issues that impact the runtime (including shimv2) label Nov 22, 2023
@ChengyuZhu6 ChengyuZhu6 self-assigned this Nov 22, 2023
@ChengyuZhu6 ChengyuZhu6 force-pushed the kata_virtual_volume branch 2 times, most recently from aabdaff to 2eddaad Compare November 22, 2023 15:58
@ChengyuZhu6 ChengyuZhu6 changed the title Pass devices to the guest through KataVirtualVolume in go runtime Pass KataVirtualVolume to the guest by devices in go runtime Nov 22, 2023
@ChengyuZhu6 ChengyuZhu6 changed the title Pass KataVirtualVolume to the guest by devices in go runtime Pass KataVirtualVolume to the guest as devices in go runtime Nov 22, 2023
@ChengyuZhu6 ChengyuZhu6 added merge-to-main PRs relating to merging CCv0 content to main no-backport-needed labels Nov 22, 2023
@ChengyuZhu6
Copy link
Member Author

/test

Comment on lines 525 to 509
///TODO implement the logic with KataVirtualVolume types
switch volumeType {
case types.KataVirtualVolumeImageGuestPullType:
case types.KataVirtualVolumeImageRawBlockType, types.KataVirtualVolumeLayerRawBlockType:
case types.KataVirtualVolumeImageNydusBlockType, types.KataVirtualVolumeLayerNydusBlockType:
case types.KataVirtualVolumeImageNydusFsType, types.KataVirtualVolumeLayerNydusFsType:
case types.KataVirtualVolumeDirectBlockType:
default:
}
Copy link
Member

Choose a reason for hiding this comment

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

Hey Chengyu, you have a couple of these volumeType switch blocks with TODOs, which I'm wondering about.
They don't seem to be doing anything at the moment, so are they set-up for a future PR? Would it be worth saving these blocks to that PR rather than adding code that doesn't do anything right now? Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

They don't seem to be doing anything at the moment, so are they set-up for a future PR?

Hey Steve - I appreciate your review and feedback. These code are set-up for PRs(#8484, #7837). I would fix it right now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

ChengyuZhu6 and others added 3 commits November 23, 2023 23:05
The snapshotter will place `KataVirtualVolume` information
into 'rootfs.options' and commence with the prefix 'io.katacontainers.volume='.
The purpose of this commit is to transform the encapsulated KataVirtualVolume data into device information.

Fixes: kata-containers#8495

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
Co-authored-by: Feng Wang <feng.wang@databricks.com>
Co-authored-by: Samuel Ortiz <sameo@linux.intel.com>
Co-authored-by: Wedson Almeida Filho <walmeida@microsoft.com>
To enhance the construction and administration of `Katavirtualvolume` storages,
this commit expands the 'sharedFile' structure to manage both
rootfs storages(`containerStorages`) including `Katavirtualvolume` and other data volumes storages(`volumeStorages`).

NOTE: `volumeStorages` is intended for future extensions to support Kubernetes data volumes.
Currently, `KataVirtualVolume` is exclusively employed for container rootfs, hence only `containerStorages` is actively utilized.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
1) Extract function `handleBlockVolume` to create Storage only.
2) Add functions to handle KataVirtualVolume device and construct
   corresponding storages.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
@ChengyuZhu6 ChengyuZhu6 force-pushed the kata_virtual_volume branch 3 times, most recently from 8efbb60 to 817cea2 Compare November 23, 2023 15:13
1) Creating storage for all `io.katacontainers.volume=` messages in rootFs.Options,
and then aggregates all storages  into `containerStorages`.
2) Creating storage for other data volumes and push them into `volumeStorages`.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
Copy link
Member

@stevenhorsman stevenhorsman left a comment

Choose a reason for hiding this comment

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

I'm not an expert, but this good to me and is familiar from the work I reviewed on CCv0

@ChengyuZhu6
Copy link
Member Author

/test

@jiangliu
Copy link
Contributor

It would be great to sync these changes to runtime-rs too, @studychao

@ChengyuZhu6
Copy link
Member Author

/test

@studychao studychao added the port-to-runtime-rs Features that need to be ported to runtime-rs label Nov 24, 2023
@studychao
Copy link
Member

It would be great to sync these changes to runtime-rs too, @studychao

label added.

Copy link
Contributor

@hsiangkao hsiangkao left a comment

Choose a reason for hiding this comment

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

It's useful to virtualization cases. Can we apply this?

@jiangliu
Copy link
Contributor

/test

@ChengyuZhu6 ChengyuZhu6 changed the title Pass KataVirtualVolume to the guest as devices in go runtime runtime: Pass KataVirtualVolume to the guest as devices in go runtime Nov 27, 2023
@fidencio fidencio merged commit bb4c51a into kata-containers:main Nov 27, 2023
311 of 326 checks passed
@ChengyuZhu6 ChengyuZhu6 deleted the kata_virtual_volume branch November 28, 2023 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/runtime Issues that impact the runtime (including shimv2) merge-to-main PRs relating to merging CCv0 content to main ok-to-test port-to-runtime-rs Features that need to be ported to runtime-rs size/large Task of significant size
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass devices to the guest through KataVirtualVolume in go runtime
7 participants