Right now, various blocks rewrite domU_config= as a whole, even though it is
largely the same.
* dom0pvh-hvm does nothing but change the domain type to hvm
* *-pci sets the domain type, clears vif=[], appends earlyprintk=xen to the
cmdline, and adds some PCI config.
Refactor this to be domU_type (defaults to pvh), domU_vif (defaults to
xenbr0), and domU_extra_cfg (defaults to empty) and use these variables to
build domU_config= once.
Of note, the default domU_config= now sets cmdline=, and extra= is intended
for inclusion via domU_extra_cfg as necessary.
No practical change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
CC: Daniel P. Smith <dpsmith@apertussolutions.com>
CC: Anthony PERARD <anthony.perard@vates.tech>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Doug Goldstein <cardoe@cardoe.com>
---
automation/scripts/qubes-x86-64.sh | 50 +++++++++++++-----------------
1 file changed, 21 insertions(+), 29 deletions(-)
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 306304e9219f..4b6311efffa8 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -15,16 +15,9 @@ test_variant=$1
extra_xen_opts=
wait_and_wakeup=
timeout=120
-domU_config='
-type = "pvh"
-name = "domU"
-kernel = "/boot/vmlinuz"
-ramdisk = "/boot/initrd-domU"
-extra = "root=/dev/ram0 console=hvc0"
-memory = 512
-vif = [ "bridge=xenbr0", ]
-disk = [ ]
-'
+domU_type="pvh"
+domU_vif="'bridge=xenbr0',"
+domU_extra_cfg=
case "${test_variant}" in
### test: smoke test & smoke test PVH & smoke test HVM
@@ -50,16 +43,7 @@ echo \"${passed}\"
fi
if [ "${test_variant}" = "dom0pvh-hvm" ]; then
- domU_config='
-type = "hvm"
-name = "domU"
-kernel = "/boot/vmlinuz"
-ramdisk = "/boot/initrd-domU"
-extra = "root=/dev/ram0 console=hvc0"
-memory = 512
-vif = [ "bridge=xenbr0", ]
-disk = [ ]
-'
+ domU_type="hvm"
fi
;;
@@ -101,15 +85,11 @@ echo \"${passed}\"
passed="pci test passed"
- domU_config='
-type = "'${test_variant#pci-}'"
-name = "domU"
-kernel = "/boot/vmlinuz"
-ramdisk = "/boot/initrd-domU"
-extra = "root=/dev/ram0 console=hvc0 earlyprintk=xen"
-memory = 512
-vif = [ ]
-disk = [ ]
+ domU_type="${test_variant#pci-}"
+ domU_vif=""
+
+ domU_extra_config='
+extra = "earlyprintk=xen"
pci = [ "'$PCIDEV',seize=1" ]
on_reboot = "destroy"
'
@@ -148,6 +128,18 @@ done
;;
esac
+domU_config="
+type = '${domU_type}'
+name = 'domU'
+kernel = '/boot/vmlinuz'
+ramdisk = '/boot/initrd-domU'
+cmdline = 'root=/dev/ram0 console=hvc0'
+memory = 512
+vif = [ ${domU_vif} ]
+disk = [ ]
+$domU_extra_config
+"
+
# DomU
mkdir -p rootfs
cd rootfs
--
2.39.5
On Mon, 21 Oct 2024, Andrew Cooper wrote:
> Right now, various blocks rewrite domU_config= as a whole, even though it is
> largely the same.
>
> * dom0pvh-hvm does nothing but change the domain type to hvm
> * *-pci sets the domain type, clears vif=[], appends earlyprintk=xen to the
> cmdline, and adds some PCI config.
>
> Refactor this to be domU_type (defaults to pvh), domU_vif (defaults to
> xenbr0), and domU_extra_cfg (defaults to empty) and use these variables to
> build domU_config= once.
>
> Of note, the default domU_config= now sets cmdline=, and extra= is intended
> for inclusion via domU_extra_cfg as necessary.
>
> No practical change.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> ---
> CC: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> CC: Daniel P. Smith <dpsmith@apertussolutions.com>
> CC: Anthony PERARD <anthony.perard@vates.tech>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Doug Goldstein <cardoe@cardoe.com>
> ---
> automation/scripts/qubes-x86-64.sh | 50 +++++++++++++-----------------
> 1 file changed, 21 insertions(+), 29 deletions(-)
>
> diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
> index 306304e9219f..4b6311efffa8 100755
> --- a/automation/scripts/qubes-x86-64.sh
> +++ b/automation/scripts/qubes-x86-64.sh
> @@ -15,16 +15,9 @@ test_variant=$1
> extra_xen_opts=
> wait_and_wakeup=
> timeout=120
> -domU_config='
> -type = "pvh"
> -name = "domU"
> -kernel = "/boot/vmlinuz"
> -ramdisk = "/boot/initrd-domU"
> -extra = "root=/dev/ram0 console=hvc0"
> -memory = 512
> -vif = [ "bridge=xenbr0", ]
> -disk = [ ]
> -'
> +domU_type="pvh"
> +domU_vif="'bridge=xenbr0',"
> +domU_extra_cfg=
>
> case "${test_variant}" in
> ### test: smoke test & smoke test PVH & smoke test HVM
> @@ -50,16 +43,7 @@ echo \"${passed}\"
> fi
>
> if [ "${test_variant}" = "dom0pvh-hvm" ]; then
> - domU_config='
> -type = "hvm"
> -name = "domU"
> -kernel = "/boot/vmlinuz"
> -ramdisk = "/boot/initrd-domU"
> -extra = "root=/dev/ram0 console=hvc0"
> -memory = 512
> -vif = [ "bridge=xenbr0", ]
> -disk = [ ]
> -'
> + domU_type="hvm"
> fi
> ;;
>
> @@ -101,15 +85,11 @@ echo \"${passed}\"
>
> passed="pci test passed"
>
> - domU_config='
> -type = "'${test_variant#pci-}'"
> -name = "domU"
> -kernel = "/boot/vmlinuz"
> -ramdisk = "/boot/initrd-domU"
> -extra = "root=/dev/ram0 console=hvc0 earlyprintk=xen"
> -memory = 512
> -vif = [ ]
> -disk = [ ]
> + domU_type="${test_variant#pci-}"
> + domU_vif=""
> +
> + domU_extra_config='
> +extra = "earlyprintk=xen"
> pci = [ "'$PCIDEV',seize=1" ]
> on_reboot = "destroy"
> '
> @@ -148,6 +128,18 @@ done
> ;;
> esac
>
> +domU_config="
> +type = '${domU_type}'
> +name = 'domU'
> +kernel = '/boot/vmlinuz'
> +ramdisk = '/boot/initrd-domU'
> +cmdline = 'root=/dev/ram0 console=hvc0'
> +memory = 512
> +vif = [ ${domU_vif} ]
> +disk = [ ]
> +$domU_extra_config
> +"
> +
> # DomU
> mkdir -p rootfs
> cd rootfs
> --
> 2.39.5
>
© 2016 - 2026 Red Hat, Inc.