public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: kdevops@lists.linux.dev
Cc: Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 1/8] guestfs: use macros for drives for aarch64
Date: Thu,  7 Mar 2024 16:03:52 -0800	[thread overview]
Message-ID: <20240308000400.1646823-2-mcgrof@kernel.org> (raw)
In-Reply-To: <20240308000400.1646823-1-mcgrof@kernel.org>

Now that we have macros for drive generation for the XML files
we can share this with aarch64. So move all the code to generate
drives into a shared file and include it for both q35 and aarch64.

This then also augments aarch64 to also support large IO experimentation
(CONFIG_QEMU_ENABLE_EXTRA_DRIVE_LARGEIO)

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 .../roles/gen_nodes/templates/gen_drives.j2   | 57 ++++++++++++++++++
 .../gen_nodes/templates/guestfs_q35.j2.xml    | 58 +------------------
 .../gen_nodes/templates/guestfs_virt.j2.xml   | 38 +-----------
 3 files changed, 59 insertions(+), 94 deletions(-)
 create mode 100644 playbooks/roles/gen_nodes/templates/gen_drives.j2

diff --git a/playbooks/roles/gen_nodes/templates/gen_drives.j2 b/playbooks/roles/gen_nodes/templates/gen_drives.j2
new file mode 100644
index 00000000..105e2cf0
--- /dev/null
+++ b/playbooks/roles/gen_nodes/templates/gen_drives.j2
@@ -0,0 +1,57 @@
+{% if libvirt_extra_storage_drive_ide %}
+{{ drives.gen_drive_ide(4,
+			kdevops_storage_pool_path,
+			hostname,
+			libvirt_extra_drive_format,
+			libvirt_extra_storage_aio_mode,
+			libvirt_extra_storage_aio_cache_mode) }}
+{% elif libvirt_extra_storage_drive_virtio %}
+{% if libvirt_largeio_enable %}
+{{ drives.gen_drive_large_io_virtio(libvirt_largeio_logical_compat,
+				    libvirt_largeio_logical_compat_size,
+				    libvirt_largeio_pow_limit,
+				    libvirt_largeio_drives_per_space,
+				    hostname,
+				    libvirt_extra_drive_format,
+				    libvirt_extra_storage_aio_mode,
+				    libvirt_extra_storage_aio_cache_mode,
+				    kdevops_storage_pool_path) }}
+{% else %}
+{{ drives.gen_drive_virtio(4,
+			   kdevops_storage_pool_path,
+			   hostname,
+			   libvirt_extra_drive_format,
+			   libvirt_extra_storage_aio_mode,
+			   libvirt_extra_storage_aio_cache_mode,
+			   libvirt_extra_storage_virtio_logical_block_size,
+			   libvirt_extra_storage_virtio_physical_block_size) }}
+{% endif %}
+{% elif libvirt_extra_storage_drive_nvme  %}
+{% if libvirt_largeio_enable %}
+{{ drives.gen_drive_large_io_nvme(libvirt_largeio_logical_compat,
+				  libvirt_largeio_logical_compat_size,
+				  libvirt_largeio_pow_limit,
+				  libvirt_largeio_drives_per_space,
+				  hostname,
+				  libvirt_extra_drive_format,
+				  libvirt_extra_storage_aio_mode,
+				  libvirt_extra_storage_aio_cache_mode,
+				  kdevops_storage_pool_path) }}
+{% else %}
+{{ drives.gen_drive_nvme(4,
+			 kdevops_storage_pool_path,
+			 hostname,
+			 libvirt_extra_drive_format,
+			 libvirt_extra_storage_aio_mode,
+			 libvirt_extra_storage_aio_cache_mode,
+			 libvirt_extra_storage_nvme_logical_block_size) }}
+{% endif %}
+{% endif %}
+{% if bootlinux_9p %}
+  {{ drives.gen_9p_mount(bootlinux_9p_driver,
+			 bootlinux_9p_fsdev,
+			 bootlinux_9p_host_path,
+			 bootlinux_9p_mount_tag,
+			 bootlinux_9p_security_model,
+			 10) }}
+{% endif %}
diff --git a/playbooks/roles/gen_nodes/templates/guestfs_q35.j2.xml b/playbooks/roles/gen_nodes/templates/guestfs_q35.j2.xml
index fe8be827..ce160490 100644
--- a/playbooks/roles/gen_nodes/templates/guestfs_q35.j2.xml
+++ b/playbooks/roles/gen_nodes/templates/guestfs_q35.j2.xml
@@ -178,62 +178,6 @@
     <qemu:arg value='ICH9-LPC.disable_s4=0'/>
     <qemu:arg value='-device'/>
     <qemu:arg value='pxb-pcie,id=pcie.1,bus_nr=32,bus=pcie.0,addr=0x8'/>
-{% if libvirt_extra_storage_drive_ide %}
-{{ drives.gen_drive_ide(4,
-			kdevops_storage_pool_path,
-			hostname,
-			libvirt_extra_drive_format,
-			libvirt_extra_storage_aio_mode,
-			libvirt_extra_storage_aio_cache_mode) }}
-{% elif libvirt_extra_storage_drive_virtio %}
-{% if libvirt_largeio_enable %}
-{{ drives.gen_drive_large_io_virtio(libvirt_largeio_logical_compat,
-				    libvirt_largeio_logical_compat_size,
-				    libvirt_largeio_pow_limit,
-				    libvirt_largeio_drives_per_space,
-				    hostname,
-				    libvirt_extra_drive_format,
-				    libvirt_extra_storage_aio_mode,
-				    libvirt_extra_storage_aio_cache_mode,
-				    kdevops_storage_pool_path) }}
-{% else %}
-{{ drives.gen_drive_virtio(4,
-			   kdevops_storage_pool_path,
-			   hostname,
-			   libvirt_extra_drive_format,
-			   libvirt_extra_storage_aio_mode,
-			   libvirt_extra_storage_aio_cache_mode,
-			   libvirt_extra_storage_virtio_logical_block_size,
-			   libvirt_extra_storage_virtio_physical_block_size) }}
-{% endif %}
-{% elif libvirt_extra_storage_drive_nvme  %}
-{% if libvirt_largeio_enable %}
-{{ drives.gen_drive_large_io_nvme(libvirt_largeio_logical_compat,
-				  libvirt_largeio_logical_compat_size,
-				  libvirt_largeio_pow_limit,
-				  libvirt_largeio_drives_per_space,
-				  hostname,
-				  libvirt_extra_drive_format,
-				  libvirt_extra_storage_aio_mode,
-				  libvirt_extra_storage_aio_cache_mode,
-				  kdevops_storage_pool_path) }}
-{% else %}
-{{ drives.gen_drive_nvme(4,
-			 kdevops_storage_pool_path,
-			 hostname,
-			 libvirt_extra_drive_format,
-			 libvirt_extra_storage_aio_mode,
-			 libvirt_extra_storage_aio_cache_mode,
-			 libvirt_extra_storage_nvme_logical_block_size) }}
-{% endif %}
-{% endif %}
-{% if bootlinux_9p %}
-  {{ drives.gen_9p_mount(bootlinux_9p_driver,
-			 bootlinux_9p_fsdev,
-			 bootlinux_9p_host_path,
-			 bootlinux_9p_mount_tag,
-			 bootlinux_9p_security_model,
-			 10) }}
-{% endif %}
+{% include './templates/gen_drives.j2' %}
   </qemu:commandline>
 </domain>
diff --git a/playbooks/roles/gen_nodes/templates/guestfs_virt.j2.xml b/playbooks/roles/gen_nodes/templates/guestfs_virt.j2.xml
index 9a7f004d..29dc0951 100644
--- a/playbooks/roles/gen_nodes/templates/guestfs_virt.j2.xml
+++ b/playbooks/roles/gen_nodes/templates/guestfs_virt.j2.xml
@@ -174,42 +174,6 @@
     <qemu:arg value='ICH9-LPC.disable_s4=0'/>
     <qemu:arg value='-device'/>
     <qemu:arg value='pxb-pcie,id=pcie.1,bus_nr=32,bus=pcie.0,addr=0x8'/>
-{% if libvirt_extra_storage_drive_ide %}
-{% for n in range(0,4) %}
-    <qemu:arg value='-drive'/>
-    <qemu:arg value='file={{ kdevops_storage_pool_path }}/guestfs/{{ hostname }}/extra{{ n }}.{{ libvirt_extra_drive_format }},format={{ libvirt_extra_drive_format }},aio={{ libvirt_extra_storage_aio_mode }},cache={{ libvirt_extra_storage_aio_cache_mode }},if=none,id=drv{{ n }}'/>
-    <qemu:arg value='-device'/>
-    <qemu:arg value="ide-hd,drive=drv{{ n }},bus=ide.{{ n }},serial=kdevops{{ n }}"/>
-{% endfor %}
-{% elif libvirt_extra_storage_drive_virtio %}
-{% for n in range(0,4) %}
-    <qemu:arg value='-device'/>
-    <qemu:arg value='pcie-root-port,id=pcie-port-for-virtio-{{ n }},multifunction=on,bus=pcie.1,addr=0x{{ n }},chassis=5{{ n }}'/>
-    <qemu:arg value="-object"/>
-    <qemu:arg value="iothread,id=kdevops-virtio-iothread-{{ n }}"/>
-    <qemu:arg value="-drive"/>
-    <qemu:arg value="file={{ kdevops_storage_pool_path }}/guestfs/{{ hostname }}/extra{{ n }}.{{ libvirt_extra_drive_format }},format={{ libvirt_extra_drive_format }},if=none,aio={{ libvirt_extra_storage_aio_mode }},cache={{ libvirt_extra_storage_aio_cache_mode }},id=drv{{ n }}"/>
-    <qemu:arg value="-device"/>
-    <qemu:arg value="virtio-blk-pci,scsi=off,drive=drv{{ n }},id=virtio-drv{{ n }},serial=kdevops{{ n }},bus=pcie-port-for-virtio-{{ n }},addr=0x0,iothread=kdevops-virtio-iothread-{{ n }},logical_block_size={{ libvirt_extra_storage_virtio_logical_block_size }},physical_block_size={{ libvirt_extra_storage_virtio_physical_block_size }}"/>
-{% endfor %}
-{% elif libvirt_extra_storage_drive_nvme  %}
-{% for n in range(0,4) %}
-    <qemu:arg value='-device'/>
-    <qemu:arg value='pcie-root-port,id=pcie-port-for-nvme-{{ n }},multifunction=on,bus=pcie.1,addr=0x{{ n }},chassis=5{{ n }}'/>
-    <qemu:arg value='-drive'/>
-    <qemu:arg value='file={{ kdevops_storage_pool_path }}/guestfs/{{ hostname }}/extra{{ n }}.{{ libvirt_extra_drive_format }},format={{ libvirt_extra_drive_format }},if=none,id=drv{{ n }}'/>
-    <qemu:arg value='-device'/>
-    <qemu:arg value='nvme,id=nvme{{ n }},serial=kdevops{{ n }},bus=pcie-port-for-nvme-{{ n }},addr=0x0'/>
-    <qemu:arg value='-device'/>
-    <qemu:arg value='nvme-ns,drive=drv{{ n }},bus=nvme{{ n }},nsid=1,logical_block_size=512,physical_block_size=512'/>
-{% endfor %}
-{% endif %}
-{% if bootlinux_9p %}
-    <qemu:arg value='-device'/>
-    <qemu:arg value='{{ bootlinux_9p_driver }},fsdev={{ bootlinux_9p_fsdev }},mount_tag={{ bootlinux_9p_mount_tag }},bus=pcie.0,addr=0x10'/>
-    <qemu:arg value='-fsdev'/>
-    <qemu:arg value='local,id={{ bootlinux_9p_fsdev }},path={{ bootlinux_9p_host_path }},security_model={{ bootlinux_9p_security_model }}'/>
-{% endif %}
+{% include './templates/gen_drives.j2' %}
   </qemu:commandline>
 </domain>
-
-- 
2.43.0


  reply	other threads:[~2024-03-08  0:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08  0:03 [PATCH 0/8] guestfs: fixes and enhancements Luis Chamberlain
2024-03-08  0:03 ` Luis Chamberlain [this message]
2024-03-08  0:03 ` [PATCH 2/8] bringup: disable ZNS and CXL for guestfs Luis Chamberlain
2024-03-08  0:03 ` [PATCH 3/8] libvirt: move zns, largio and cxl to its own files Luis Chamberlain
2024-03-08  0:03 ` [PATCH 4/8] guestfs: move options to its own file Luis Chamberlain
2024-03-08  0:03 ` [PATCH 5/8] bringup: match default distro to user's distro Luis Chamberlain
2024-03-08  0:03 ` [PATCH 6/8] guestfs: remove explicit tap0 device name Luis Chamberlain
2024-03-08  0:03 ` [PATCH 7/8] destroy_guestfs.sh: remove known ssh key Luis Chamberlain
2024-03-08  0:03 ` [PATCH 8/8] guestfs: verify new line on ssh include directive Luis Chamberlain
2024-03-08  9:55 ` [PATCH 0/8] guestfs: fixes and enhancements Luis Chamberlain
2024-03-08 14:14   ` Chuck Lever III
2024-03-08 14:26     ` Chuck Lever III
2024-03-08 15:44       ` Luis Chamberlain
2024-03-08 15:46         ` Chuck Lever III
2024-03-08 15:56           ` 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=20240308000400.1646823-2-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --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