diff --git a/.github/actions/configure/action.yml b/.github/actions/configure/action.yml index 68c4e7434..9c35b4a6e 100644 --- a/.github/actions/configure/action.yml +++ b/.github/actions/configure/action.yml @@ -20,6 +20,10 @@ inputs: required: false type: string default: 'kdevops-ci' + guest_os: + required: false + type: string + default: 'default' runs: using: "composite" @@ -112,11 +116,27 @@ runs: echo "Using Linux CI configuration (4GB/8core VMs)" fi + # Configure guest OS if specified + GUEST_OS_CONFIG= + if [[ "${{ inputs.guest_os }}" != "default" ]]; then + GUEST_OS_CONFIG="defconfigs/configs/guestfs-${{ inputs.guest_os }}.config" + + if [[ ! -f "$GUEST_OS_CONFIG" ]]; then + echo "Error: Guest OS config not found: $GUEST_OS_CONFIG" + exit 1 + fi + + echo "Using guest OS configuration: $GUEST_OS_CONFIG" + else + echo "Using default guest OS from defconfig" + fi + ./scripts/kconfig/merge_config.sh \ -n .config \ defconfigs/configs/diy.config \ defconfigs/configs/ci.config \ - ${VM_CONFIG_ARG} + ${VM_CONFIG_ARG} \ + ${GUEST_OS_CONFIG} - name: Run kdevops make shell: bash diff --git a/.github/workflows/kdevops.yml b/.github/workflows/kdevops.yml index 6fc583c6a..d94a7e7f8 100644 --- a/.github/workflows/kdevops.yml +++ b/.github/workflows/kdevops.yml @@ -88,6 +88,15 @@ on: options: - 'kdevops-ci' - 'linux-ci' + guest_os: + description: 'Guest OS for testing' + required: false + default: 'default' + type: choice + options: + - default # Use defconfig's default (typically Debian 13 on debian hosts) + - debian-13 # Force Debian 13 Trixie + - fedora-41 # Force Fedora 41 tests: description: 'Custom test to run (for kdevops-ci mode only)' required: false @@ -231,6 +240,7 @@ jobs: uses: ./.github/actions/configure with: ci_workflow: ${{ matrix.ci_workflow }} + guest_os: ${{ github.event.inputs.guest_os || 'default' }} kernel_ref: >- ${{ github.event_name == 'schedule' && needs.generate_kernel_ref.outputs.kernel_ref diff --git a/Makefile b/Makefile index bf72eee9a..f8d36572e 100644 --- a/Makefile +++ b/Makefile @@ -213,13 +213,6 @@ endif KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK:=$(subst ",,$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)) ifeq (y,$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_ENABLE)) ANSIBLE_EXTRA_ARGS += kdevops_ansible_provision_playbook='$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)' - -KDEVOPS_DEVCONFIG_CUSTOM_REPOS:=$(subst ",,$(CONFIG_KDEVOPS_DEVCONFIG_CUSTOM_REPOS)) -ANSIBLE_EXTRA_ARGS += kdevops_devconfig_custom_repos='$(KDEVOPS_DEVCONFIG_CUSTOM_REPOS)' - -KDEVOPS_DEVCONFIG_CUSTOM_PACKAGES:=$(subst ",,$(CONFIG_KDEVOPS_DEVCONFIG_CUSTOM_PACKAGES)) -ANSIBLE_EXTRA_ARGS += kdevops_devconfig_custom_packages='$(KDEVOPS_DEVCONFIG_CUSTOM_PACKAGES)' - endif include scripts/gen-hosts.Makefile diff --git a/defconfigs/configs/guestfs-debian-13.config b/defconfigs/configs/guestfs-debian-13.config new file mode 100644 index 000000000..b638304ae --- /dev/null +++ b/defconfigs/configs/guestfs-debian-13.config @@ -0,0 +1,2 @@ +CONFIG_GUESTFS_DEBIAN=y +CONFIG_GUESTFS_DEBIAN_TRIXIE=y diff --git a/defconfigs/configs/guestfs-fedora-41.config b/defconfigs/configs/guestfs-fedora-41.config new file mode 100644 index 000000000..bfbd4cf8e --- /dev/null +++ b/defconfigs/configs/guestfs-fedora-41.config @@ -0,0 +1,2 @@ +CONFIG_GUESTFS_FEDORA=y +CONFIG_VIRT_BUILDER_OS_VERSION="fedora-41" diff --git a/kconfigs/Kconfig.ansible_provisioning b/kconfigs/Kconfig.ansible_provisioning index 52b648549..93cc395f8 100644 --- a/kconfigs/Kconfig.ansible_provisioning +++ b/kconfigs/Kconfig.ansible_provisioning @@ -37,7 +37,7 @@ config KDEVOPS_DEVCONFIG_ENABLE_CONSOLE depends on KDEVOPS_DEVCONFIG_ENABLE help Enable this so that we configure and enable console serial settings - for you on /etc/default/grub. + for you on /etc/default/grub. if KDEVOPS_DEVCONFIG_ENABLE_CONSOLE @@ -45,26 +45,26 @@ config KDEVOPS_DEVCONFIG_KERNEL_CONSOLE_SETTINGS string "Kernel command line console kernel parameters to use" default "console=tty0 console=tty1 console=ttyS0,115200n8" help - Linux kernel console kernel parameters to use. This will be appended + Linux kernel console kernel parameters to use. This will be appended to the GRUB configuration file /etc/default/grub on the variable - GRUB_CMDLINE_LINUX_DEFAULT, if and only if you did not have any - console settings already set. + GRUB_CMDLINE_LINUX_DEFAULT, if and only if you did not have any + console settings already set. config KDEVOPS_DEVCONFIG_GRUB_SERIAL_COMMAND string "GRUB specific serial settings" default "serial --speed=115200 --unit=0 --parity=no --stop=1" help - GRUB console settings to use. This will be appended to the GRUB - configuration file /etc/default/grub on the variable - GRUB_SERIAL_COMMAND, if and only if we did change the your console - settings as per the above configured kernel parameters passed. + GRUB console settings to use. This will be appended to the GRUB + configuration file /etc/default/grub on the variable + GRUB_SERIAL_COMMAND, if and only if we did change the your console + settings as per the above configured kernel parameters passed. config KDEVOPS_GRUB_TIMEOUT int "GRUB timeout" default 2 help - GRUB timeout to wait for user interaction to let you pick another - kernel or boot options. + GRUB timeout to wait for user interaction to let you pick another + kernel or boot options. endif # KDEVOPS_DEVCONFIG_ENABLE_CONSOLE @@ -72,7 +72,7 @@ config KDEVOPS_DEVCONFIG_ENABLE_SYSTEMD_WATCHDOG bool "Enable systemd watchdog setup" default y depends on KDEVOPS_DEVCONFIG_ENABLE - help + help Enable this to allow you to configure your systemd watchdog configuration. For details refer to: https://www.freedesktop.org/software/systemd/man/systemd-system.conf.html @@ -81,20 +81,20 @@ if KDEVOPS_DEVCONFIG_ENABLE_SYSTEMD_WATCHDOG config KDEVOPS_DEVCONFIG_SYSTEMD_WATCHDOG_TIMEOUT_RUNTIME string "Configures the RuntimeWatchdogSec settting" default "5min" - help - Configures the systemd watchdog RuntimeWatchdogSec setting. + help + Configures the systemd watchdog RuntimeWatchdogSec setting. config KDEVOPS_DEVCONFIG_SYSTEMD_WATCHDOG_TIMEOUT_REBOOT string "Configures the RebootWatchdogSec settting" default "10min" - help - Configures the systemd watchdog RebootWatchdogSec setting. + help + Configures the systemd watchdog RebootWatchdogSec setting. config KDEVOPS_DEVCONFIG_SYSTEMD_WATCHDOG_TIMEOUT_KEXEC string "Configures the KexecWatchdogSec settting" default "5min" - help - Configures the systemd watchdog KexecWatchdogSec setting. + help + Configures the systemd watchdog KexecWatchdogSec setting. endif # KDEVOPS_DEVCONFIG_ENABLE_SYSTEMD_WATCHDOG @@ -131,8 +131,8 @@ config DEVCONFIG_ENABLE_SYSTEMD_JOURNAL_REMOTE select DEVCONFIG_ENABLE_SYSTEMD_TIMESYNCD select DEVCONFIG_ENABLE_SYSTEMD_TIMESYNCD_NTP help - It is a pain to have to ssh to target nodes one is testing to check - for kernel logs. Enable this to allow us to set up the host with + It is a pain to have to ssh to target nodes one is testing to check + for kernel logs. Enable this to allow us to set up the host with systemd-journal-remote.service on then we will also congigure all test nodes with systemd-journal-upload.service so to upload their systemd journal to the host. By default we rely on insecure http @@ -168,8 +168,8 @@ config DEVCONFIG_SYSTEMD_JOURNAL_USE_HTTP bool "Use simple insecure http" default y help - For a simple setup you don't want to set up SSL cert files. - If you disable this you are on your own for now on setting up the + For a simple setup you don't want to set up SSL cert files. + If you disable this you are on your own for now on setting up the SSL cert files. For cloud environments you may want to have a command and control server within the network on the nodes, and assign that node as the systemd service. @@ -178,8 +178,8 @@ config DEVCONFIG_SYSTEMD_JOURNAL_REMOTE_URL string "systemd-remote URL" default $(shell, scripts/append-makefile-vars.sh http:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS)) if GUESTFS help - This is used for the client /etc/systemd/journal-upload.conf URL line. - By default we won't use SSL for now. If you should make sure the + This is used for the client /etc/systemd/journal-upload.conf URL line. + By default we won't use SSL for now. If you should make sure the IP address used here matches what the node should use. If using libvirt then ensure it is the same for your virtualization setup. If you are using libvirt on debian on the host it would seem the @@ -191,7 +191,7 @@ config DEVCONFIG_ENABLE_SYSTEMD_TIMESYNCD bool "Set up systemd-timesyncd" default n help - It if often useful to have the host and target nodes on the same + It if often useful to have the host and target nodes on the same time. This is usefult to optimize watchdogs so that we can use on local time instead of remote time for a sense of how much time has lapsed. Enable this if you want to benefit from this. @@ -202,7 +202,7 @@ config DEVCONFIG_ENABLE_SYSTEMD_TIMESYNCD_NTP bool "Enable systemd-timesyncd NTP" default y help - Enable NTP service using systemd-timesyncd. + Enable NTP service using systemd-timesyncd. if DEVCONFIG_ENABLE_SYSTEMD_TIMESYNCD_NTP @@ -238,13 +238,14 @@ config KDEVOPS_DEVCONFIG_ENABLE_CUSTOM_REPOS bool "Allow user to add custom repositories and install packages from them" default n help - Enable Kconfig options to allow user to add custom package - repositories and to also specify packages to be installed - from them. + Enable Kconfig options to allow user to add custom package + repositories and to also specify packages to be installed + from them. config KDEVOPS_DEVCONFIG_CUSTOM_REPOS string "Comma separated list of custom repositories to be enabled" default "" + output yaml depends on KDEVOPS_DEVCONFIG_ENABLE_CUSTOM_REPOS=y help Comma separated list of custom repositories to be enabled @@ -252,6 +253,7 @@ config KDEVOPS_DEVCONFIG_CUSTOM_REPOS config KDEVOPS_DEVCONFIG_CUSTOM_PACKAGES string "Comma separated list of custom packages to be installed" default "" + output yaml depends on KDEVOPS_DEVCONFIG_ENABLE_CUSTOM_REPOS=y help Comma separated list of custom packages to be installed diff --git a/kconfigs/Kconfig.guestfs b/kconfigs/Kconfig.guestfs index d0ac66fc8..3bc4b0603 100644 --- a/kconfigs/Kconfig.guestfs +++ b/kconfigs/Kconfig.guestfs @@ -78,6 +78,8 @@ choice config GUESTFS_FEDORA bool "Fedora (or derived distro)" output yaml + select HAVE_CUSTOM_DISTRO_HOST_PREFIX + select HAVE_DISTRO_PREFERS_CUSTOM_HOST_PREFIX select HAVE_DISTRO_XFS_PREFERS_MANUAL if FSTESTS_XFS select HAVE_DISTRO_BTRFS_PREFERS_MANUAL if FSTESTS_BTRFS select HAVE_DISTRO_EXT4_PREFERS_MANUAL if FSTESTS_EXT4 @@ -118,12 +120,12 @@ config GUESTFS_DEBIAN_TRIXIE select GUESTFS_HAS_CUSTOM_RAW_IMAGE_SHA512SUMS select GUESTFS_HAS_CUSTOM_RAW_IMAGE_ROLLING help - Select this for debian trixie, debian 13. Since debian does not yet - provie a virt-builder repo, we must download mock up our own URL - for trixie release, as the default guestfs repo only has debian buster. + Select this for Debian Trixie, Debian 13. Since Debian does not yet + provide a virt-builder repo, we must download mock up our own URL + for trixie release, as the default guestfs repo only has Debian Buster. We download the image for you once, and once its there we don't refresh it. We can later add support to force a refresh using the latest URL, - as trixie is debian-testing and debian testing always has an new + as trixie is debian-testing and Debian Testing always has a new up to date image release, that is, its a rolling distribution release. This doesn't work yet.. it gets stuck on the grub prompt. @@ -132,7 +134,7 @@ config GUESTFS_DEBIAN_BUSTER bool "Debian 12 - Buster" output yaml help - Select this for debian buster, debian 12. + Select this for Debian Buster, Debian 12. endchoice @@ -194,9 +196,9 @@ config GUESTFS_DEBIAN_IMAGE_NAME default "debian-12" if GUESTFS_DEBIAN_BUSTER config GUESTFS_DEBIAN_BOX_SHORT - string - default "debian13" if GUESTFS_DEBIAN_TRIXIE - default "debian12" if GUESTFS_DEBIAN_BUSTER + string + default "debian13" if GUESTFS_DEBIAN_TRIXIE + default "debian12" if GUESTFS_DEBIAN_BUSTER config GUESTFS_DEBIAN_COPY_HOST_SOURCES bool @@ -204,16 +206,16 @@ config GUESTFS_DEBIAN_COPY_HOST_SOURCES default DISTRO_DEBIAN_HAS_HOP1_SOURCES select GUESTFS_COPY_SOURCES_FROM_HOST_TO_GUEST help - We have detected that you are running debian on the host, this option + We have detected that you are running Debian on the host, this option will be enabled by default if we detect that your /etc/apt/sources.list is using a source we determine has only one hop via traceroute to it, for details of that heuristic see the script: ./scripts/get-distro-has-hop-count-sources.sh - If your hop distance to your mirror is just 1, you are using debian on - the host, want to use debian guests, both host and guest match the - target release, then its a good assumtion you'd likely want to take + If your hop distance to your mirror is just 1, you are using Debian on + the host, want to use Debian guests, both host and guest match the + target release, then its a good assumption you'd likely want to take advantage of that same mirror for your guests. So disable this if you really don't want to take advantage of your sources.list. @@ -222,35 +224,21 @@ config GUESTFS_DEBIAN_COPY_HOST_SOURCES endif # GUESTFS_DEBIAN -config VIRT_BUILDER_OS_VERSION - string "virt-builder os-version" - default "fedora-39" if GUESTFS_FEDORA - default GUESTFS_DEBIAN_IMAGE_NAME if GUESTFS_DEBIAN - help - Have virt-builder use this os-version string to - build a root image for the guest. Run "virt-builder -l" - to get a list of operating systems and versions supported - by guestfs. - -choice - prompt "Guestfs bringup debug mode" - default GUESTFS_BRINGUP_DEBUG_DISABLED - -config GUESTFS_BRINGUP_DEBUG_DISABLED - bool "Disabled" - help - Disables bringup debug. - -config GUESTFS_BRINGUP_DEBUG_0 - bool "set -x" - help - Enables 'set -x' when running scripts/guestfs_bringup.sh. +config GUESTFS_FEDORA_BOX_SHORT + string + default "fedora41" if VIRT_BUILDER_OS_VERSION = "fedora-41" + default "fedora40" if VIRT_BUILDER_OS_VERSION = "fedora-40" + default "fedora39" if VIRT_BUILDER_OS_VERSION = "fedora-39" + default "fedora" -config GUESTFS_BRINGUP_DEBUG_1 - bool "set -euxo pipefile" +config VIRT_BUILDER_OS_VERSION + string "virt-builder os-version" + default "fedora-39" if GUESTFS_FEDORA + default GUESTFS_DEBIAN_IMAGE_NAME if GUESTFS_DEBIAN help - Enables 'set -euxo pipefile' when running scripts/guestfs_bringup.sh. - -endchoice + Have virt-builder use this os-version string to + build a root image for the guest. Run "virt-builder -l" + to get a list of operating systems and versions supported + by guestfs. endif # GUESTFS diff --git a/kconfigs/Kconfig.kdevops b/kconfigs/Kconfig.kdevops index 1b40db5b0..68e91193d 100644 --- a/kconfigs/Kconfig.kdevops +++ b/kconfigs/Kconfig.kdevops @@ -25,6 +25,7 @@ config HAVE_DISTRO_REQUIRES_CUSTOM_SSH_KEXALGORITHMS config CUSTOM_DISTRO_HOST_PREFIX string depends on HAVE_CUSTOM_DISTRO_HOST_PREFIX + default GUESTFS_FEDORA_BOX_SHORT if GUESTFS_FEDORA default GUESTFS_DEBIAN_BOX_SHORT if GUESTFS_DEBIAN config CUSTOM_SSH_KEXALGORITHMS diff --git a/playbooks/roles/base_image/tasks/base-image.yml b/playbooks/roles/base_image/tasks/base-image.yml index fc022649f..a7f2da2d0 100644 --- a/playbooks/roles/base_image/tasks/base-image.yml +++ b/playbooks/roles/base_image/tasks/base-image.yml @@ -52,6 +52,7 @@ creates: "{{ base_image_pathname }}" when: - libvirt_uri_system|bool + register: virt_builder_result_system - name: Generate a new base image for {{ base_image_os_version }} ansible.builtin.command: @@ -71,6 +72,39 @@ creates: "{{ base_image_pathname }}" when: - not libvirt_uri_system|bool + register: virt_builder_result_user + +- name: Set SELinux to permissive mode for Fedora images on non-SELinux hosts (system libvirt) + become: true + become_method: ansible.builtin.sudo + ansible.builtin.command: + argv: + - "virt-customize" + - "-a" + - "{{ base_image_pathname }}" + - "--run-command" + - "sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config" + when: + - libvirt_uri_system|bool + - guestfs_fedora is defined + - guestfs_fedora|bool + - ansible_distribution|lower in ['debian', 'ubuntu'] + - virt_builder_result_system is changed + +- name: Set SELinux to permissive mode for Fedora images on non-SELinux hosts (user libvirt) + ansible.builtin.command: + argv: + - "virt-customize" + - "-a" + - "{{ base_image_pathname }}" + - "--run-command" + - "sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config" + when: + - not libvirt_uri_system|bool + - guestfs_fedora is defined + - guestfs_fedora|bool + - ansible_distribution|lower in ['debian', 'ubuntu'] + - virt_builder_result_user is changed - name: Set proper ownership on base image for rcloud access (system libvirt) become: true diff --git a/playbooks/roles/base_image/templates/virt-builder.j2 b/playbooks/roles/base_image/templates/virt-builder.j2 index 3069e95f8..289ee9e5e 100644 --- a/playbooks/roles/base_image/templates/virt-builder.j2 +++ b/playbooks/roles/base_image/templates/virt-builder.j2 @@ -73,6 +73,7 @@ append-line /etc/nsswitch.conf:ethers: db files append-line /etc/nsswitch.conf:rpc: db files append-line /etc/nsswitch.conf:netgroup: nis uninstall cloud-init +install locales-all write /etc/default/locale:LANG=en_US.UTF-8 append-line /etc/default/locale:LANGUAGE=en_US:en write /etc/locale.gen:en_US.UTF-8 UTF-8 diff --git a/playbooks/roles/bootlinux/defaults/main.yml b/playbooks/roles/bootlinux/defaults/main.yml index 1ae70b2c1..78e4e28ff 100644 --- a/playbooks/roles/bootlinux/defaults/main.yml +++ b/playbooks/roles/bootlinux/defaults/main.yml @@ -141,3 +141,9 @@ bootlinux_fragment_x86: false bootlinux_fragment_xarray: false bootlinux_fragment_xarray_no_multi: false + +# Distro controls +distro_debian_based: false +distro_fedora: false +distro_redhat_based: false +distro_suse_based: false diff --git a/playbooks/roles/bootlinux/tasks/build/9p.yml b/playbooks/roles/bootlinux/tasks/build/9p.yml index f390f028d..809d342ae 100644 --- a/playbooks/roles/bootlinux/tasks/build/9p.yml +++ b/playbooks/roles/bootlinux/tasks/build/9p.yml @@ -14,7 +14,7 @@ when: - target_linux_install_b4 is defined - target_linux_install_b4 - - ansible_facts['os_family']|lower != 'debian' + - not distro_debian_based|bool run_once: true delegate_to: localhost diff --git a/playbooks/roles/bootlinux/tasks/install-deps/main.yml b/playbooks/roles/bootlinux/tasks/install-deps/main.yml index 51a207416..058f39268 100644 --- a/playbooks/roles/bootlinux/tasks/install-deps/main.yml +++ b/playbooks/roles/bootlinux/tasks/install-deps/main.yml @@ -2,14 +2,14 @@ - name: Debian-specific setup ansible.builtin.import_tasks: debian/main.yml when: - - ansible_os_family == "Debian" + - distro_debian_based|bool - name: SuSE-specific setup ansible.builtin.import_tasks: suse/main.yml when: - - ansible_os_family == "Suse" + - distro_suse_based|bool - name: Red Hat-specific setup ansible.builtin.import_tasks: redhat/main.yml when: - - ansible_os_family == "RedHat" + - distro_redhat_based|bool diff --git a/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml b/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml index 7f1955bf4..e9a0c6e23 100644 --- a/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml +++ b/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml @@ -3,7 +3,7 @@ ansible.builtin.include_role: name: epel-release when: - - ansible_distribution != "Fedora" + - not distro_fedora|bool - name: Install packages we care about become: true @@ -67,7 +67,7 @@ vars: packages: - btrfs-progs - when: ansible_distribution == 'Fedora' + when: distro_fedora|bool - name: Install clang become: true diff --git a/playbooks/roles/devconfig/defaults/main.yml b/playbooks/roles/devconfig/defaults/main.yml index b5d4724d3..122cb8985 100644 --- a/playbooks/roles/devconfig/defaults/main.yml +++ b/playbooks/roles/devconfig/defaults/main.yml @@ -60,3 +60,7 @@ unattended_upgrades_installed: false workflow_infer_user_and_group: false kdevops_use_declared_hosts: false kdevops_enable_terraform: false + +# Custom repository and package installation defaults +kdevops_devconfig_custom_repos: "" +kdevops_devconfig_custom_packages: "" diff --git a/playbooks/roles/devconfig/tasks/config-custom-repos-and-packages/redhat/main.yml b/playbooks/roles/devconfig/tasks/config-custom-repos-and-packages/redhat/main.yml index 0a772dd71..76d1ce3c0 100644 --- a/playbooks/roles/devconfig/tasks/config-custom-repos-and-packages/redhat/main.yml +++ b/playbooks/roles/devconfig/tasks/config-custom-repos-and-packages/redhat/main.yml @@ -10,7 +10,6 @@ mode: "0644" with_items: "{{ kdevops_devconfig_custom_repos | trim | split(',') }}" when: - - kdevops_devconfig_custom_repos - kdevops_devconfig_custom_repos | trim | length > 1 - name: Install custom packages @@ -24,5 +23,4 @@ until: result.rc == 0 with_items: "{{ kdevops_devconfig_custom_packages | trim | split(',') }}" when: - - kdevops_devconfig_custom_packages - kdevops_devconfig_custom_packages | trim | length > 1 diff --git a/playbooks/roles/guestfs/tasks/bringup/main.yml b/playbooks/roles/guestfs/tasks/bringup/main.yml index 510e1a7dc..f3645b903 100644 --- a/playbooks/roles/guestfs/tasks/bringup/main.yml +++ b/playbooks/roles/guestfs/tasks/bringup/main.yml @@ -91,6 +91,10 @@ "--firstboot-command", "if command -v ufw >/dev/null 2>&1 && systemctl is-active ufw >/dev/null 2>&1; then ufw allow " + (ansible_cfg_ssh_port | string) + "/tcp; fi" ] if ansible_cfg_ssh_port | int != 22 else [] + ) + ( + ["--no-selinux-relabel"] + if (guestfs_fedora is defined and guestfs_fedora|bool and ansible_distribution|lower in ['debian', 'ubuntu']) + else [] ) }} diff --git a/playbooks/roles/selftests/defaults/main.yml b/playbooks/roles/selftests/defaults/main.yml index 45cb5022b..216236908 100644 --- a/playbooks/roles/selftests/defaults/main.yml +++ b/playbooks/roles/selftests/defaults/main.yml @@ -37,3 +37,9 @@ selftest_kernelspace: false selftest_xarray: false selftest_maple: false selftest_vma: false + +# Distro controls +distro_debian_based: false +distro_fedora: false +distro_redhat_based: false +distro_suse_based: false diff --git a/playbooks/roles/selftests/tasks/install-deps/main-localhost.yml b/playbooks/roles/selftests/tasks/install-deps/main-localhost.yml new file mode 100644 index 000000000..4817f530b --- /dev/null +++ b/playbooks/roles/selftests/tasks/install-deps/main-localhost.yml @@ -0,0 +1,10 @@ +--- +# tasks to install dependencies for selftests on localhost (for 9P builds) +# Uses Kconfig distro variables instead of ansible_facts to detect control host OS +- name: Debian-specific setup for localhost + ansible.builtin.import_tasks: tasks/install-deps/debian/main.yml + when: distro_debian_based|bool +- ansible.builtin.import_tasks: tasks/install-deps/suse/main.yml + when: distro_suse_based|bool +- ansible.builtin.import_tasks: tasks/install-deps/redhat/main.yml + when: distro_redhat_based|bool diff --git a/playbooks/roles/selftests/tasks/main.yml b/playbooks/roles/selftests/tasks/main.yml index f8af3080d..3f5e0319f 100644 --- a/playbooks/roles/selftests/tasks/main.yml +++ b/playbooks/roles/selftests/tasks/main.yml @@ -19,7 +19,7 @@ - name: Install dependencies to build Linux selftests on host tags: ["deps"] run_once: true - ansible.builtin.import_tasks: install-deps/main.yml + ansible.builtin.import_tasks: install-deps/main-localhost.yml delegate_to: localhost when: - bootlinux_9p|bool diff --git a/scripts/update_ssh_config_guestfs.py b/scripts/update_ssh_config_guestfs.py index 40f1ccad0..0ec329597 100755 --- a/scripts/update_ssh_config_guestfs.py +++ b/scripts/update_ssh_config_guestfs.py @@ -33,11 +33,15 @@ # We take the first IPv4 address on the first non-loopback interface. def get_addr(name): + # Timeout increased to 180s to account for slower boot times with Fedora guests + # on Debian hosts (SELinux permissive mode initialization takes longer). + timeout_seconds = int(os.environ.get("KDEVOPS_SSH_CONFIG_TIMEOUT", "180")) attempt = 0 while True: attempt += 1 - if attempt > 60: - raise Exception(f"Unable to get an address for {name} after 60s") + if attempt > timeout_seconds: + raise Exception(f"Unable to get an address for {name} after {timeout_seconds}s. " + f"VM may be taking longer to boot. Check 'virsh console {name}' for boot status.") result = subprocess.run( [