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

images/inventory: add field for enabled plugins #2489

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

rst0git
Copy link
Member

@rst0git rst0git commented Sep 27, 2024

This pull request extends the inventory image with a plugins field that contains an array of names indicating which plugins were used during checkpointing, for example, to save GPU state. In particular, the CUDA and AMDGPU plugins are added to this field only when the checkpoint contains GPU state. This allows to disable unnecessary plugins during restore, show appropriate error messages if required CRIU plugins are missing, and migrate a process that does not use GPU from a GPU-enabled system to CPU-only environment.

Examples:

  1. The checkpoint contains AMDGPU state and requires amdgpu_plugin for restore.
{
    "magic": "INVENTORY",
    "entries": [
        {
            "plugins_entry": {
                "plugins": [
                    "amdgpu_plugin"
                ]
            }
        }
    ]
}
  1. The checkpoint contains CUDA state and requires cuda_plugin for restore.
{
    "magic": "INVENTORY",
    "entries": [
        {
            "plugins_entry": {
                "plugins": [
                    "cuda_plugin"
                ]
            }
        }
    ]
}
  1. The checkpoint does not contain GPU state (i.e., no plugins are required for restore).
{
    "magic": "INVENTORY",
    "entries": [
        {
            "plugins_entry": {}
        }
    ]
}

@rst0git rst0git marked this pull request as draft September 27, 2024 17:15
@rst0git rst0git marked this pull request as ready for review September 27, 2024 18:08
criu/plugin.c Outdated Show resolved Hide resolved
images/inventory.proto Outdated Show resolved Hide resolved
@rst0git rst0git force-pushed the inventory-plugins branch 12 times, most recently from 0d79239 to 278c174 Compare October 7, 2024 15:29
@rst0git rst0git changed the title images/inventory: add fields for plugins images/inventory: add field for enabled plugins Oct 7, 2024
criu/image.c Show resolved Hide resolved
@rst0git rst0git force-pushed the inventory-plugins branch 2 times, most recently from 0caf28f to 62238a4 Compare October 8, 2024 15:18
@avagin
Copy link
Member

avagin commented Oct 14, 2024

I think we should introduce a test for this change.

criu/image.c Show resolved Hide resolved
test/plugins/Makefile Outdated Show resolved Hide resolved
@avagin
Copy link
Member

avagin commented Oct 14, 2024

LGTM

@rst0git rst0git force-pushed the inventory-plugins branch 2 times, most recently from f301a3b to 671ffad Compare October 14, 2024 14:14
This patch extends the inventory image with a `plugins` field that
contains an array of plugins which were used during checkpoint,
for example, to save GPU state. In particular, the CUDA and AMDGPU
plugins are added to this field only when the checkpoint contains
GPU state. This allows to disable unnecessary plugins during restore,
show appropriate error messages if required CRIU plugin are missing,
and migrate a process that does not use GPU from a GPU-enabled system
to CPU-only environment.

We use the `optional plugins_entry` for backwards compatibility. This
entry allows us to distinguish between *unset* and *missing* field:

- When the field is missing, it indicates that the checkpoint was
  created with a previous version of CRIU, and all plugins should be
  *enabled* during restore.

- When the field is empty, it indicates that no plugins were used during
  checkpointing. Thus, all plugins can be *disabled* during restore.

Signed-off-by: Radostin Stoyanov <[email protected]>
This patch adds two test plugins to verify that CRIU plugins listed
in the inventory image are enabled, while those that are not listed
can be disabled.

Signed-off-by: Radostin Stoyanov <[email protected]>
Copy link
Contributor

@jesus-ramos jesus-ramos left a comment

Choose a reason for hiding this comment

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

LGTM

@avagin avagin merged commit f5d59ec into checkpoint-restore:criu-dev Oct 21, 2024
36 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants