diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-01-16 01:11:39 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-01-21 18:00:26 -0500 |
| commit | d7b6ee0369cd7bd891a443a41306d77ce5899ad9 (patch) | |
| tree | 305ec1169e3797c4d72a047956de1af264912e06 | |
| parent | 7b0bad588bb204dc02d3162cbf9387600bd458e4 (diff) | |
| download | meta-virtualization-d7b6ee0369cd7bd891a443a41306d77ce5899ad9.tar.gz | |
vcontainer: add sanity checks and auto-enable virtfs for QEMU
Add sanity check that warns when vcontainer distro feature is enabled
but BBMULTICONFIG is missing the required vruntime-* multiconfigs.
Add qemu-system-native bbappend to auto-enable virtfs (virtio-9p) when
vcontainer or virtualization distro feature is set. This is required
for the fast batch-import path in container-cross-install.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
| -rw-r--r-- | classes/sanity-meta-virt.bbclass | 36 | ||||
| -rw-r--r-- | recipes-devtools/qemu/qemu-system-native_%.bbappend | 10 |
2 files changed, 46 insertions, 0 deletions
diff --git a/classes/sanity-meta-virt.bbclass b/classes/sanity-meta-virt.bbclass index b4ed0825..3327a8ac 100644 --- a/classes/sanity-meta-virt.bbclass +++ b/classes/sanity-meta-virt.bbclass | |||
| @@ -8,3 +8,39 @@ python virt_bbappend_distrocheck() { | |||
| 8 | may not take effect. See the meta-virtualization README for details on enabling \ | 8 | may not take effect. See the meta-virtualization README for details on enabling \ |
| 9 | virtualization support.") | 9 | virtualization support.") |
| 10 | } | 10 | } |
| 11 | |||
| 12 | # Check for vcontainer requirements when vcontainer distro feature is enabled | ||
| 13 | addhandler vcontainer_sanity_check | ||
| 14 | vcontainer_sanity_check[eventmask] = "bb.event.SanityCheck" | ||
| 15 | python vcontainer_sanity_check() { | ||
| 16 | skip_check = e.data.getVar('SKIP_META_VIRT_SANITY_CHECK') == "1" | ||
| 17 | if skip_check: | ||
| 18 | return | ||
| 19 | |||
| 20 | distro_features = (e.data.getVar('DISTRO_FEATURES') or "").split() | ||
| 21 | |||
| 22 | if 'vcontainer' not in distro_features: | ||
| 23 | return | ||
| 24 | |||
| 25 | # Check for required BBMULTICONFIG | ||
| 26 | bbmulticonfig = e.data.getVar('BBMULTICONFIG') or "" | ||
| 27 | required_mcs = ['vruntime-aarch64', 'vruntime-x86-64'] | ||
| 28 | missing_mcs = [mc for mc in required_mcs if mc not in bbmulticonfig] | ||
| 29 | |||
| 30 | if missing_mcs: | ||
| 31 | bb.warn("vcontainer: BBMULTICONFIG is missing required multiconfigs: %s\n" | ||
| 32 | "Add to local.conf:\n" | ||
| 33 | " BBMULTICONFIG = \"vruntime-aarch64 vruntime-x86-64\"\n" | ||
| 34 | "This is required for building vdkr/vpdmn cross-architecture container tools." | ||
| 35 | % ', '.join(missing_mcs)) | ||
| 36 | |||
| 37 | # Informational message about vcontainer setup | ||
| 38 | bb.note("vcontainer enabled. Required settings:\n" | ||
| 39 | " DISTRO_FEATURES: vcontainer (detected)\n" | ||
| 40 | " BBMULTICONFIG: vruntime-aarch64 vruntime-x86-64 %s\n" | ||
| 41 | "Optional settings:\n" | ||
| 42 | " CONTAINER_PROFILE: docker|podman (default: docker)\n" | ||
| 43 | " CONTAINER_REGISTRY_URL: registry address for container-registry feature\n" | ||
| 44 | " BUNDLED_CONTAINERS: containers to bundle into images" | ||
| 45 | % ("(OK)" if not missing_mcs else "(MISSING)")) | ||
| 46 | } | ||
diff --git a/recipes-devtools/qemu/qemu-system-native_%.bbappend b/recipes-devtools/qemu/qemu-system-native_%.bbappend new file mode 100644 index 00000000..d360af80 --- /dev/null +++ b/recipes-devtools/qemu/qemu-system-native_%.bbappend | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # SPDX-FileCopyrightText: Copyright (C) 2025 Bruce Ashfield | ||
| 2 | # | ||
| 3 | # SPDX-License-Identifier: MIT | ||
| 4 | # | ||
| 5 | # Enable virtfs (virtio-9p) for vcontainer cross-architecture container bundling. | ||
| 6 | # This is required for the fast batch-import path in container-cross-install. | ||
| 7 | # | ||
| 8 | # Only applied when "vcontainer" or "virtualization" is in DISTRO_FEATURES. | ||
| 9 | |||
| 10 | PACKAGECONFIG:append = " ${@bb.utils.contains_any('DISTRO_FEATURES', 'vcontainer virtualization', 'virtfs', '', d)}" | ||
