Packer-windows builds Windows images with QEMU and Packer that can be deployed in an OpenStack Cloud with KVM hypervisors. It is a stripped down version of the bento repository (which is used to create Vagrant boxes), and incorperates elements from the Cloudbase Windows Imaging Tools, which also builds Windows images, albeit on a Hyper-V host. The end result is KVM compatible UEFI QCOW2 images with virtio drivers and Cloudbase-init. The target consumers of the images are users of the Norwegian Research and Education Cloud. The NREC end user documentation describes the end user process.
The build process produces a Windows image updated with the latest updates.
NOTE: It you want to build your own Windows images using this repository, you will want to edit or remove elements in nrec_specifics.ps1. Only Windows Server 2022 Standard and Windows Server 2025 Standard are build and tested by the NREC team (but Server 2019 should still work).
You must download the iso image with the Windows drivers for paravirtualized KVM/qemu hardware. You can do this from the command line: wget -nv -nc https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso -O virtio-win.iso
and place it in the same directory that contains this repository directory.
PACKER_CACHE_DIR="/home/user/packer-windows/packer_cache/" PACKER_LOG=1 packer build --only=qemu.vm -var-file=os_pkrvars/windows/windows-2022-x86_64.pkrvars.hcl ./packer_templates/
Packer will launch a vnc server, which you can use to monitor the build process. One build may take between one and two and a half hours, so please be patient.
When deploying the image to OpenStack glance, there are some image properties that must be set, and some settings that we strongly recommend:
hw_disk_bus: 'scsi' # Strongly recommended
hw_scsi_model: 'virtio-scsi' # Strongly recommended
hw_machine_type: 'q35' # Strongly recommended
hw_qemu_guest_agent: 'yes' # Recommended
hw_firmware_type: 'uefi' # Must be set, legacy BIOS not supported by image
os_require_quiesce: 'yes' # Recommended when using ceph
os_type: 'windows' # Greatly improves KVM performance
The final images generally clock in at about 13GB, but the build process itself needs a disk image that is larger (we set 25GB), so the minimum disk requirement for an instance must be greater than 25GB.
Feedback and contributions are welcome.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.