From: Daniel Gomez <da.gomez@kernel.org>
To: kdevops@lists.linux.dev, Luis Chamberlain <mcgrof@kernel.org>,
Daniel Gomez <da.gomez@samsung.com>
Cc: Daniel Gomez <da.gomez@kernel.org>
Subject: [PATCH v2 4/4] guestfs: bringup: add debug mode
Date: Mon, 12 May 2025 15:36:05 +0200 [thread overview]
Message-ID: <20250512-bringup-guestfs-debug-v2-4-bd5691108448@samsung.com> (raw)
In-Reply-To: <20250512-bringup-guestfs-debug-v2-0-bd5691108448@samsung.com>
From: Daniel Gomez <da.gomez@samsung.com>
To be able to run bringup_guestfs.sh script in bash debug mode:
1. disabled
2. set -x
3. set -euxo pipefile
From set manual:
-x Print commands and their arguments as they are executed.
-e Exit immediately if a command exits with a non-zero status.
-u Treat unset variables as an error when substituting.
-o option-name
Set the variable corresponding to option-name:
pipefail the return value of a pipeline is the status of
the last command to exit with a non-zero status,
or zero if no command exited with a non-zero status
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
kconfigs/Kconfig.guestfs | 21 +++++++++++++++++++++
scripts/bringup_guestfs.sh | 10 ++++++++++
2 files changed, 31 insertions(+)
diff --git a/kconfigs/Kconfig.guestfs b/kconfigs/Kconfig.guestfs
index a2fddd691be9dbfa025c916708d8c14a07eb4514..ed08d293b3f6085350d09b68457aed6f8c09a468 100644
--- a/kconfigs/Kconfig.guestfs
+++ b/kconfigs/Kconfig.guestfs
@@ -214,4 +214,25 @@ config VIRT_BUILDER_OS_VERSION
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_BRINGUP_DEBUG_1
+ bool "set -euxo pipefile"
+ help
+ Enables 'set -euxo pipefile' when running scripts/guestfs_bringup.sh.
+
+endchoice
+
endif # GUESTFS
diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
index 3fd48331b73f51e23818c553f8973d17d38dffca..67f85a5fdb0a41a12de01f6e9911c206d7ab9a5a 100755
--- a/scripts/bringup_guestfs.sh
+++ b/scripts/bringup_guestfs.sh
@@ -5,6 +5,16 @@
source ${TOPDIR}/.config
source ${TOPDIR}/scripts/lib.sh
+if [[ "${CONFIG_GUESTFS_BRINGUP_DEBUG_0+x}" && \
+ "${CONFIG_GUESTFS_BRINGUP_DEBUG_0}" == "y" ]]; then
+ set -x
+fi
+
+if [[ "${CONFIG_GUESTFS_BRINGUP_DEBUG_1+x}" && \
+ "${CONFIG_GUESTFS_BRINGUP_DEBUG_1}" == "y" ]]; then
+ set -euxo pipefail
+fi
+
export LIBVIRT_DEFAULT_URI=$CONFIG_LIBVIRT_URI
# We use the NVMe setting for virtio too (go figure), but IDE
--
2.49.0
next prev parent reply other threads:[~2025-05-12 13:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 13:36 [PATCH v2 0/4] guestfs: bringup: add debug mode Daniel Gomez
2025-05-12 13:36 ` [PATCH v2 1/4] guestfs: bringup: check if domain exists Daniel Gomez
2025-05-12 13:36 ` [PATCH v2 2/4] guestfs: bringup: fix unbound variable when debug Daniel Gomez
2025-05-12 13:36 ` [PATCH v2 3/4] guestfs: bringup: fix user check " Daniel Gomez
2025-05-12 13:36 ` Daniel Gomez [this message]
2025-05-12 15:43 ` [PATCH v2 0/4] guestfs: bringup: add debug mode Chuck Lever
2025-05-13 5:49 ` Daniel Gomez
2025-05-14 18:28 ` Luis Chamberlain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250512-bringup-guestfs-debug-v2-4-bd5691108448@samsung.com \
--to=da.gomez@kernel.org \
--cc=da.gomez@samsung.com \
--cc=kdevops@lists.linux.dev \
--cc=mcgrof@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox