images/inventory: add field for enabled plugins

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 <rstoyanov@fedoraproject.org>
This commit is contained in:
Radostin Stoyanov 2024-10-04 12:14:29 +01:00 committed by Andrei Vagin
parent b524dab32f
commit 5335b35f72
7 changed files with 193 additions and 5 deletions

View file

@ -10,6 +10,13 @@ enum lsmtype {
APPARMOR = 2;
}
// It is not possible to distinguish between an empty repeated field
// and unset repeated field. To solve this problem and provide backwards
// compabibility, we use the 'plugins_entry' message.
message plugins_entry {
repeated string plugins = 12;
};
message inventory_entry {
required uint32 img_version = 1;
optional bool fdinfo_per_id = 2;
@ -21,4 +28,5 @@ message inventory_entry {
optional uint32 pre_dump_mode = 9;
optional bool tcp_close = 10;
optional uint32 network_lock_method = 11;
optional plugins_entry plugins_entry = 12;
}