From 91cf42fa9ceb12fb6bf8673fc8bcb81dcac04ddd Mon Sep 17 00:00:00 2001 From: Wesley Hershberger Date: Tue, 3 Dec 2024 15:23:41 -0600 Subject: [PATCH] config: Add db.trace snap config to set LIBDQLITE_TRACE Signed-off-by: Wesley Hershberger --- snapcraft.yaml | 1 + snapcraft/commands/daemon.start | 4 ++++ snapcraft/hooks/configure | 2 ++ 3 files changed, 7 insertions(+) diff --git a/snapcraft.yaml b/snapcraft.yaml index 177edd3f5..bf99fb87d 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -42,6 +42,7 @@ description: |- - daemon.preseed: Pass a YAML configuration to `lxd init` on initial start - daemon.syslog: Send LXD log events to syslog [default=false] - daemon.verbose: Increase logging to verbose level [default=false] + - db.trace: Enable dqlite trace logging (very verbose) [default=false] - lvm.external: Use the system's LVM tools [default=false] - lxcfs.pidfd: Start per-container process tracking [default=false] - lxcfs.loadavg: Start tracking per-container load average [default=false] diff --git a/snapcraft/commands/daemon.start b/snapcraft/commands/daemon.start index 774d0d13d..afc808c85 100755 --- a/snapcraft/commands/daemon.start +++ b/snapcraft/commands/daemon.start @@ -726,6 +726,10 @@ if [ "${daemon_verbose:-"false"}" = "true" ]; then CMD="${CMD} --verbose" fi +if [ "${db_trace:-"false"}" = "true" ]; then + export LIBDQLITE_TRACE=1 +fi + # Check if this is the first time LXD is started. FIRSTRUN="false" if [ ! -d "${SNAP_COMMON}/lxd/database" ]; then diff --git a/snapcraft/hooks/configure b/snapcraft/hooks/configure index 9a3208f59..2b7d25792 100755 --- a/snapcraft/hooks/configure +++ b/snapcraft/hooks/configure @@ -48,6 +48,7 @@ daemon_group=$(snapctl get daemon.group) daemon_user_group=$(snapctl get daemon.user.group) daemon_syslog=$(get_bool "$(snapctl get daemon.syslog)") daemon_verbose=$(get_bool "$(snapctl get daemon.verbose)") +db_trace=$(get_bool "$(snapctl get db.trace)") lvm_external=$(get_bool "$(snapctl get lvm.external)") lxcfs_loadavg=$(get_bool "$(snapctl get lxcfs.loadavg)") lxcfs_pidfd=$(get_bool "$(snapctl get lxcfs.pidfd)") @@ -80,6 +81,7 @@ daemon_group=${daemon_group:-"lxd"} daemon_syslog=${daemon_syslog:-"false"} daemon_user_group=${daemon_user_group:-"lxd"} daemon_verbose=${daemon_verbose:-"false"} +db_trace=${db_trace:-"false"} lvm_external=${lvm_external:-"false"} lxcfs_cfs=${lxcfs_cfs:-"false"} lxcfs_debug=${lxcfs_debug:-"false"}