lib: remove deprecated APIs and implicit resource creation#688
Conversation
|
There's an interesting API design challenge here where Another way to do this might be to explore passing the init-specific config when choosing the init binary. It's subtle but it makes it clear that the two things are coupled. |
This is not the final design, this is only the first step in untangling this, I'll decouple this more. The main motivation for this was to get rid of the buggy Currently the If you wanted to use a different |
a0af916 to
1da73b7
Compare
1da73b7 to
9d9144c
Compare
…th krun_add_disk Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
These were replaced by krun_add_disk. Also remove the internal root_block_cfg/data_block_cfg fields and their setters, and simplify get_block_cfg() now that the legacy compat path is gone. Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
…_set_net_mac These were replaced by krun_add_net_unixstream, krun_add_net_unixgram, and krun_add_net_tap (which take mac as a parameter directly). Also remove the internal LegacyNetworkConfig enum, legacy_net_cfg and legacy_mac fields, the compat path in krun_start_enter that converted them to the new net backend, and the now-unused NET_COMPAT_FEATURES constant. Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
krun_set_log_level set KRUN_NITRO_DEBUG when level==4 (debug), but krun_init_log did not. Fix the omission so removing krun_set_log_level doesn't regress nitro debug logging. Also fix the condition to level >= 4 so that trace (level 5) also enables nitro debug. Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
Superseded by krun_init_log which provides control over target fd, log style, and env override options. Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
This function has been returning -EINVAL unconditionally. Remove it. Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
Replace implicit console creation with explicit krun_add_virtio_console_default calls. Also replace krun_set_console_output in nitro.c with krun_add_virtio_console_default. No test or example relies on implicit console injection anymore. Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
…nd implicit console Console creation is now fully explicit via krun_add_virtio_console_default or krun_add_virtio_console_multiport. No console is created unless the caller requests one. Remove the disable_implicit_console field from VmResources, the implicit console and serial device creation paths in builder.rs, the console_output field and setter on VmResources, and krun_set_console_output (kept only behind cfg(aws-nitro) where NitroEnclave still needs it). Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
- test_tsi_tcp_guest_connect: add krun_add_vsock(ctx, KRUN_TSI_HIJACK_INET) - test_tsi_tcp_guest_listen: same - test_vsock_guest_connect: add krun_add_vsock(ctx, 0) - chroot_vm.c: replace krun_disable_implicit_vsock + vhost-user with explicit krun_add_vsock when not using vhost-user-vsock No test or example relies on implicit vsock creation anymore. Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
Vsock creation is now fully explicit via krun_add_vsock(). No vsock device is created unless the caller requests one. Remove the Implicit variant from VsockConfig, the implicit vsock creation heuristics in krun_start_enter, and krun_disable_implicit_vsock. Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
All krun_disable_implicit_* functions are gone. The 2.0 API requires explicit resource creation. Assisted-by: OpenCode:claude-opus-4.6 Signed-off-by: Matej Hrica <mhrica@redhat.com>
9d9144c to
35f42d9
Compare
This PR is a preparatory cleanup before the full 2.0 API (#634).
Depends on
Depends on: #673 "Replace hardcoded init.krun with generic virtual file overlay"
New functionality introduced (replacing old way of doing this)
krun_set_oci_config_json(ctx, json)— set init config from OCI container-spec JSON (user shall no longer write it to disk)krun_inject_init(ctx, fs_tag)— explicitly injects the init binary and json config for the init into the guestDeprecated functions removed
krun_set_log_level→krun_init_logkrun_set_root_disk→krun_add_disk3krun_set_data_disk→krun_add_disk3krun_set_passt_fd→krun_add_net_unixstreamkrun_set_gvproxy_path→krun_add_net_unixgramkrun_set_net_mac→ mac parameter onkrun_add_net_*krun_set_mapped_volumes— was already returning-EINVALkrun_set_console_output→krun_add_virtio_console_defaultkrun_get_default_init→krun_inject_initOld numbered API variants removed
krun_add_disk,krun_add_disk2→krun_add_disk3krun_add_virtiofs,krun_add_virtiofs2→krun_add_virtiofs3krun_add_vsock_port→krun_add_vsock_port2krun_set_gpu_options→krun_set_gpu_options2Implicit resource creation removed
krun_disable_implicit_init+ implicit init injection →krun_inject_init(ctx, fs_tag)krun_disable_implicit_console+ implicit console →krun_add_virtio_console_default(ctx, in, out, err)krun_disable_implicit_vsock+ implicit vsock with TSI heuristics →krun_add_vsock(ctx, tsi_features)Init config delivery change
krun_set_exec/krun_set_env/krun_set_workdir/krun_set_rlimitsno longer format config into kernel cmdline env vars (KRUN_INIT=,KRUN_WORKDIR=,-- args). Instead, they use newly introducedInitConfig/.krun_config.jsonon virtiofs.The kernel cmdline no longer carries:
KRUN_INIT=...KRUN_WORKDIR=...KRUN_RLIMITS=...(now injected as an env var in the JSONEnvarray — see FIXME in code)-- argsepilogOnly
KRUN_BLOCK_ROOT_DEVICE(+ fstype/options) remains on the cmdline when a block root is configured.Init side follow-up: The C init (
init/init.c) still supports both the cmdline and JSON paths. Eventually (maybe as part of #670), the legacy cmdline parsing can be dropped from init since libkrun will no longer use it.