public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Chuck Lever <cel@kernel.org>, Daniel Gomez <da.gomez@kruces.com>,
	kdevops@lists.linux.dev
Cc: Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 2/8] gen-dynamic-pci: fix PCI passthrough target guest default value
Date: Mon, 11 Aug 2025 13:12:24 -0700	[thread overview]
Message-ID: <20250811201230.2145164-3-mcgrof@kernel.org> (raw)
In-Reply-To: <20250811201230.2145164-1-mcgrof@kernel.org>

Fix two issues preventing PCI passthrough configuration from appearing
in generated nodes files:

1. Template generation was producing "None" in YAML files due to
   incorrect include path and missing None handling in the Jinja2
   template. Fixed by correcting the include path and adding a
   replace filter to remove "None" values.

2. PCI passthrough target_guest field was defaulting to empty string,
   preventing devices from being assigned to guests. Fixed by setting
   the Kconfig default to reference KDEVOPS_HOSTS_PREFIX, which
   automatically assigns devices to the configured host prefix (e.g.,
   "debian13").

With these fixes, PCI passthrough configuration now correctly appears
in the generated guestfs/kdevops_nodes.yaml file when devices are
enabled and target_guest is properly configured.

Generated-by: Claude AI
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py | 4 ++--
 playbooks/roles/gen_nodes/templates/guestfs_nodes.j2          | 2 +-
 playbooks/roles/gen_nodes/templates/hosts.j2                  | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py b/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py
index 107bb25..f86ce74 100755
--- a/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py
+++ b/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py
@@ -95,9 +95,9 @@ def add_pcie_kconfig_name(config_name, sdevice):
 def add_pcie_kconfig_target(config_name, sdevice):
     sys.stdout.write("config %s_TARGET_GUEST\n" % (config_name))
     sys.stdout.write(
-        '\tstring  "Taret guest to offload %s"\n' % (strip_kconfig_name(sdevice))
+        '\tstring  "Target guest to offload %s"\n' % (strip_kconfig_name(sdevice))
     )
-    sys.stdout.write('\tdefault ""\n')
+    sys.stdout.write('\tdefault KDEVOPS_HOSTS_PREFIX\n')
     sys.stdout.write("\tdepends on %s\n" % config_name)
     sys.stdout.write("\tdepends on KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH_TYPE_EACH\n")
     sys.stdout.write("\thelp\n")
diff --git a/playbooks/roles/gen_nodes/templates/guestfs_nodes.j2 b/playbooks/roles/gen_nodes/templates/guestfs_nodes.j2
index 5e87df3..a548f25 100644
--- a/playbooks/roles/gen_nodes/templates/guestfs_nodes.j2
+++ b/playbooks/roles/gen_nodes/templates/guestfs_nodes.j2
@@ -1,3 +1,3 @@
 ---
 guestfs_nodes:
-{% include './templates/hosts.j2' %}
+{% include 'hosts.j2' -%}
diff --git a/playbooks/roles/gen_nodes/templates/hosts.j2 b/playbooks/roles/gen_nodes/templates/hosts.j2
index ca4d2cb..a7f8b82 100644
--- a/playbooks/roles/gen_nodes/templates/hosts.j2
+++ b/playbooks/roles/gen_nodes/templates/hosts.j2
@@ -1,6 +1,6 @@
-{% from "gen_nodes_list.j2" import gen_nodes_list %}
+{% from "gen_nodes_list.j2" import gen_nodes_list -%}
 {{ gen_nodes_list( nodes, kdevops_baseline_and_dev, 100,
 		   pcie_passthrough_enable,
 		   pcie_passthrough_target_type,
 		   pcie_passthrough_target,
-		   pcie_passthrough_devices ) }}
+		   pcie_passthrough_devices ) | replace("None", "") }}
-- 
2.47.2


  parent reply	other threads:[~2025-08-11 20:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain
2025-08-11 20:12 ` [PATCH 1/8] libvirt: fix PCI-E passthrough configuration after Vagrant removal Luis Chamberlain
2025-08-11 20:12 ` Luis Chamberlain [this message]
2025-08-11 20:12 ` [PATCH 3/8] gen-dynamic-pci: add GPU detection and naming support Luis Chamberlain
2025-08-11 20:12 ` [PATCH 4/8] guestfs / devconfig: allow for upgrade from Debian testing to forky Luis Chamberlain
2025-08-11 20:12 ` [PATCH 5/8] guestfs: add OVMF package for UEFI firmware support Luis Chamberlain
2025-08-11 20:12 ` [PATCH 6/8] gen_nodes: fix duplicate pcipassthrough keys in YAML output Luis Chamberlain
2025-08-11 20:12 ` [PATCH 7/8] gen_nodes: fix YAML indentation in pcipassthrough template Luis Chamberlain
2025-08-11 20:12 ` [PATCH 8/8] guestfs: fix PCIe passthrough device attachment Luis Chamberlain
2025-08-11 20:38 ` [PATCH 0/8] various fixes Chuck Lever
2025-08-11 21:31   ` 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=20250811201230.2145164-3-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=cel@kernel.org \
    --cc=da.gomez@kruces.com \
    --cc=kdevops@lists.linux.dev \
    /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