Skip to content

Add Packer configuration to build a minimal Alpine 3.23 UEFI VM for XCP-ng tests#523

Draft
glehmann wants to merge 6 commits into
masterfrom
gln/packer-alpine-uefi-xcpng-loun
Draft

Add Packer configuration to build a minimal Alpine 3.23 UEFI VM for XCP-ng tests#523
glehmann wants to merge 6 commits into
masterfrom
gln/packer-alpine-uefi-xcpng-loun

Conversation

@glehmann
Copy link
Copy Markdown
Member

@glehmann glehmann commented May 11, 2026

The image is built with the vatesfr/packer-plugin-xenserver plugin targeting a
local XCP-ng host. It produces a zstd-compressed XVA with:

  • Alpine Linux 3.23.4 (x86_64), UEFI boot (grub + GPT)
  • 1 vCPU, 256 MiB RAM, 512 MiB disk, no swap
  • xe-guest-utilities installed from the Alpine community repo
  • XCP-ng CI public SSH keys authorised for root
  • Post-processed by xva_bridge.py to set bridge=xenbr0 and zstd compression

Signed-off-by: Gaëtan Lehmann gaetan.lehmann@vates.tech

This PR is part of a tree containing 19 PRs:

  1. master
  2. storage: avoid removing the xva/vdi before going in the debugger #436master
  3. storage: test large volumes #437storage: avoid removing the xva/vdi before going in the debugger #436
  4. host: include mdadm RAID devices in disk detection #447storage: test large volumes #437
  5. Update randstream to 0.5.0 #446host: include mdadm RAID devices in disk detection #447
  6. storage: Avoid writing the whole device in coalesce tests #449Update randstream to 0.5.0 #446
  7. storage: avoid writing the whole device in migration tests #450storage: Avoid writing the whole device in coalesce tests #449
  8. xva/vdi: only write a small data amount in large volumes for faster tests #452storage: avoid writing the whole device in migration tests #450
  9. storage: test full device write #453xva/vdi: only write a small data amount in large volumes for faster tests #452
  10. storage: test that we can't create a vdi over its max allowed size #454storage: test full device write #453
  11. storage: add jobs for large volume tests #461storage: test that we can't create a vdi over its max allowed size #454
  12. skip large volume tests for zvol and nfsv4 #464storage: add jobs for large volume tests #461
  13. storage: add comprehensive tests for lvmohba storage repositories #470skip large volume tests for zvol and nfsv4 #464
  14. storage: free space for XVA import by destroying source VM first #471storage: add comprehensive tests for lvmohba storage repositories #470
  15. storage: limit data written per VDI with --write-volume-cap #481storage: free space for XVA import by destroying source VM first #471
  16. "Add Packer configuration to build a minimal Alpine 3.23 UEFI VM for XCP-ng tests" (this PR) → storage: limit data written per VDI with --write-volume-cap #481
  17. migration: create a xfs sr on the second host for intra/cross-pool migration #497storage: limit data written per VDI with --write-volume-cap #481
  18. Enhance block device management #498migration: create a xfs sr on the second host for intra/cross-pool migration #497
  19. Add VHD_MAX and QCOW2_MAX symbolic size constants #500Enhance block device management #498
  20. partially_populate_device: align span positions to block size for better performance #509Add VHD_MAX and QCOW2_MAX symbolic size constants #500

"<wait3>",
"ifconfig eth0 up && udhcpc -i eth0<enter><wait5>",
# "USE<leftShiftOn>-<leftShiftOff>EFI=1 SWAP<leftShiftOn>-<leftShiftOff>SIZE=0 ERASE<leftShiftOn>-<leftShiftOff>DISKS=/dev/xvda setup-alpine -f http://{{.HTTPIP}}:{{.HTTPPort}}/answers.txt<enter>",
"USE<leftShiftOn>-<leftShiftOff>EFI=1 SWAP<leftShiftOn>-<leftShiftOff>SIZE=0 ERASE<leftShiftOn>-<leftShiftOff>DISKS=/dev/xvda setup-alpine -f https://raw.githubusercontent.com/xcp-ng/xcp-ng-tests/refs/heads/gln/packer-alpine-uefi-xcpng-loun/packer/http_files/answers.txt<enter>",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value of -f flag should be generic, isn't it?

What do you think of using an hcl variable to enable configuration here?

"rc-update add xe-guest-utilities default<enter>",
# "rc-service xe-guest-utilities start<enter>",
# Remove log files
"find /var/log -type f -exec truncate -s 0 {} \\;<enter>",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those commands look similar to what I can see in cleanup.sh. Is it normal?

Btw, I don't see any occurrence of calling the cleanup script. Is there an implicit mechanism of Packer?

@olivierh-pro olivierh-pro requested a review from a team May 12, 2026 07:06
@glehmann glehmann force-pushed the gln/limit-vdi-write-cap-umro branch from e9ab3bf to f2fef78 Compare May 12, 2026 13:16
@glehmann glehmann force-pushed the gln/packer-alpine-uefi-xcpng-loun branch 2 times, most recently from 701ce24 to e14efd4 Compare May 12, 2026 13:23
@glehmann glehmann force-pushed the gln/limit-vdi-write-cap-umro branch from f2fef78 to fdd3cbf Compare May 12, 2026 13:23
Base automatically changed from gln/limit-vdi-write-cap-umro to master May 12, 2026 13:35
@glehmann glehmann force-pushed the gln/packer-alpine-uefi-xcpng-loun branch 2 times, most recently from a5fd3b0 to f7496e0 Compare May 13, 2026 13:55
Replace the BlockDeviceInfo TypedDict and the per-call disk_is_available()
check with a dataclass that includes availability as a field, determined once
at scan time using mountpoint, mdadm, LVM, and ZFS checks. Extend enumeration
to cover mdadm arrays and multipath devices in addition to local disks. Update
all callers to use attribute access instead of dict subscript.

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
glehmann added 5 commits May 13, 2026 15:58
zpool destroy removes the pool but leaves ZFS member signatures and the
partition table on disk, causing the device to appear in use on the next
test run.

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
Add a WWN field to BlockDeviceInfo (populated from lsblk for local disks,
and from the DM alias for mpath devices). In the disks fixture, use WWNs to:

- Mark a LUN unavailable on all hosts if it is already in use on any host
  (cross-host deduplication for shared FC/iSCSI LUNs).
- Sort LUNs listed in LVMOHBA_DEVICE_CONFIG or LVMOISCSI_DEVICE_CONFIG to
  the end of each host's disk list, so they are only selected by other tests
  when no other disk is available.

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
Allow passing VHD_MAX and QCOW2_MAX as values to --volume-size and
--write-volume-cap, making it easy to test at the maximum supported VDI
size for each image format. MAX_VDI_SIZE in storage.py is now derived
from the same constants to keep a single source of truth.

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
…ter performance

Add an optional `align` parameter (default: 4KiB) to align span positions
to a given block size. Only positions are aligned (rounded down); span sizes
are reduced if needed to avoid overlapping the next span's position. When
config.write_volume_cap is large enough, spans are contiguous and cover the
full device with no gaps. Without alignment, write throughput drops from
~700MiB/s to ~200MiB/s on large disks.

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
…CP-ng tests

The image is built with the vatesfr/packer-plugin-xenserver plugin targeting a
local XCP-ng host. It produces a zstd-compressed XVA with:
- Alpine Linux 3.23.4 (x86_64), UEFI boot (grub + GPT)
- 1 vCPU, 256 MiB RAM, 512 MiB disk, no swap
- xe-guest-utilities installed from the Alpine community repo
- XCP-ng CI public SSH keys authorised for root
- Post-processed by xva_bridge.py to set bridge=xenbr0 and zstd compression

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
@glehmann glehmann force-pushed the gln/packer-alpine-uefi-xcpng-loun branch from f7496e0 to cddcf93 Compare May 13, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants