Skip to contentSkip to conversation

kdevops: add debian support

PATCH In review Luis Chamberlain 1 participant 5 messages Mar 5, 2024 – Mar 6, 2024

lore
Share & tools
lore
#0 lore raw

cover kdevops: add debian support

This enables users on debian to start using guestfs, and also enables debian to be used as a guest.

Luis Chamberlain (3):
scripts/bringup_guestfs.sh: start networking for system session scripts/bringup_guestfs.sh: allow libvirt user to modify extra disks
guestfs: add debian guest support

 kconfigs/Kconfig.bringup   | 42 +++++++++++++++++++++++++++++++++++++-
 kconfigs/Kconfig.kdevops   |  1 +
 scripts/bringup_guestfs.sh | 12 +++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/3 scripts/bringup_guestfs.sh: start networking for system session

When the system session is used we need to ensure we start the default networking, otherwise we will get a complaint about not finding mtu for virb0, or virb1, etc. Fix this by ensuring that if the default networking is off, we start it.

---
 scripts/bringup_guestfs.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
scripts/bringup_guestfs.sh +9 -0
index 34ad48cbe81f..19e636fc64f3 100755
@@ -7,6 +7,15 @@ source ${TOPDIR}/scripts/lib.sh
 
 export LIBVIRT_DEFAULT_URI=$CONFIG_LIBVIRT_URI
 
+# On systems using system sesion, ensure that we start the default
+# libvirt network.
+if [[ "$CONFIG_LIBVIRT_URI_SYSTEM" == "y" ]]; then
+	 sudo virsh net-list | grep -q default
+	 if [[ $? -ne 0 ]]; then
+		 sudo virsh net-start default
+	 fi
+fi
+
 #
 # We use the NVMe setting for virtio too (go figure), but IDE
 # requires qcow2
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/3 scripts/bringup_guestfs.sh: allow libvirt user to modify extra disks

In reply to Luis Chamberlain

When a system session is used libvirt runs as a privileged user, not the user, and so the user needs to be able to modify the user's files. The directory already should have the correct permissions, but no the files. Fix those.

This let's us start guestfs guests on debian.

---
 scripts/bringup_guestfs.sh | 3 +++
 1 file changed, 3 insertions(+)
scripts/bringup_guestfs.sh +3 -0
index 19e636fc64f3..58e5e3d2a018 100755
@@ -114,6 +114,9 @@ do
 		diskimg="$STORAGEDIR/$name/extra${i}.${IMG_FMT}"
 		rm -f $diskimg
 		qemu-img create -f $IMG_FMT "$STORAGEDIR/$name/extra${i}.$IMG_FMT" 100G
+		if [[ "$CONFIG_LIBVIRT_URI_SYSTEM" == "y" ]]; then
+			chmod g+rw $STORAGEDIR/$name/extra${i}.$IMG_FMT
+		fi
 	done
 
 	virsh define $GUESTFSDIR/$name/$name.xml
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/3 guestfs: add debian guest support

In reply to Luis Chamberlain

guestfs has only debian-12, no debian testing yet. While at it, also set default fedora options for fstests when the user tests a specific filesystem.

---
 kconfigs/Kconfig.bringup | 42 +++++++++++++++++++++++++++++++++++++++-
 kconfigs/Kconfig.kdevops |  1 +
 2 files changed, 42 insertions(+), 1 deletion(-)
kconfigs/Kconfig.bringup +41 -1
index 95991cc599f4..ba7b5430bcf9 100644
@@ -58,14 +58,54 @@ config SKIP_BRINGUP
 endchoice
 
 if GUESTFS
+
+choice
+	prompt "Guestfs Linux distribution to use"
+	default GUESTFS_FEDORA
+
+config GUESTFS_FEDORA
+	bool "Fedora (or derived distro)"
+	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
+	select HAVE_DISTRO_PREFERS_FSTESTS_WATCHDOG if KDEVOPS_WORKFLOW_ENABLE_FSTESTS
+	select HAVE_DISTRO_PREFERS_FSTESTS_WATCHDOG_KILL if KDEVOPS_WORKFLOW_ENABLE_FSTESTS
+	help
+	  This option will set the target guest to be a distro in the Fedora family.
+	  For example, Fedora, RHEL, etc.
+
+config GUESTFS_DEBIAN
+	bool "Debian"
+	select HAVE_CUSTOM_DISTRO_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
+	select HAVE_DISTRO_PREFERS_CUSTOM_HOST_PREFIX
+	select HAVE_DISTRO_PREFERS_FSTESTS_WATCHDOG if KDEVOPS_WORKFLOW_ENABLE_FSTESTS
+	select HAVE_DISTRO_PREFERS_FSTESTS_WATCHDOG_KILL if KDEVOPS_WORKFLOW_ENABLE_FSTESTS
+	help
+	  This option will set the target guest to Debian.
+
+endchoice
+
 config VIRT_BUILDER_OS_VERSION
        string "virt-builder os-version"
-       default "fedora-39"
+       default "fedora-39" if GUESTFS_FEDORA
+       default "debian-12" 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.
+
+if GUESTFS_DEBIAN
+
+config GUESTFS_DEBIAN_BOX_SHORT
+        string
+        default "debian12" if GUESTFS_DEBIAN
+
+endif
+
 endif # GUESTFS
 
 config LIBVIRT
kconfigs/Kconfig.kdevops +1 -0
index 53782f413a44..423619cf1443 100644
@@ -28,6 +28,7 @@ config CUSTOM_DISTRO_HOST_PREFIX
 	default VAGRANT_DEBIAN_BOX_SHORT if VAGRANT_DEBIAN
 	default VAGRANT_OPENSUSE_BOX_SHORT if VAGRANT_OPENSUSE
 	default VAGRANT_REDHAT_GENERIC_BOX_SHORT if VAGRANT_REDHAT_GENERIC
+	default GUESTFS_DEBIAN_BOX_SHORT if GUESTFS_DEBIAN
 
 config CUSTOM_SSH_KEXALGORITHMS
 	string
Signature · 1 line
2.43.0
#4 lore raw
In reply to Luis Chamberlain
Quoted 7 lines · Luis Chamberlain

This enables users on debian to start using guestfs, and also enables debian to be used as a guest.

Luis Chamberlain (3):
scripts/bringup_guestfs.sh: start networking for system session scripts/bringup_guestfs.sh: allow libvirt user to modify extra disks
guestfs: add debian guest support

Alright, pushed.

Luis