Image creation
Overview
This page describes the process of the image retrieval, modification and upload to our OpenStack based stoney cloud.
Get images
You can get VM images from:
Properties
The properties control important aspects of the resuling VM by manipulating the behaviour of libvirt. For a reference of available properties, see the online documentation at https://docs.openstack.org/glance/rocky/admin/useful-image-properties.html
Examples
AlmaLinux 8.5 (20211119): Single disk
This is an unmodified version of upstream AlmaLinux, more specifically of their generic cloud image.
AlmaLinux 8.5 (20211119): Single disk - Image download
curl \
--output AlmaLinux-8-GenericCloud-8.5-20211119.x86_64.qcow2 \
https://repo.almalinux.org/almalinux/8/cloud/x86_64/images/AlmaLinux-8-GenericCloud-8.5-20211119.x86_64.qcow2
AlmaLinux 8.5 (20211119): Single disk - Image checksum
curl \
--silent \
https://repo.almalinux.org/almalinux/8/cloud/x86_64/images/CHECKSUM \
| grep AlmaLinux-8-GenericCloud-8.5-20211119.x86_64.qcow2 \
| sha256sum -c -
AlmaLinux-8-GenericCloud-8.5-20211119.x86_64.qcow2: OK
AlmaLinux 8.5 (20211119): Single disk - Image conversion
Convert image to raw:
qemu-img convert -O raw AlmaLinux-8-GenericCloud-8.5-20211119.x86_64.qcow2 AlmaLinux-8-GenericCloud-8.5-20211119.x86_64.raw
AlmaLinux 8.5 (20211119): Single disk - Image upload (with QEMU Guest Agent support)
file=AlmaLinux-8-GenericCloud-8.5-20211119.x86_64.raw
imageName="AlmaLinux 8.5 (20211119): Single disk"
Source the OpenStack RC file:
syntaxhighlight path/to/your/rc/file.sh
Upload image:
openstack image create \
--disk-format raw \
--min-ram 1 \
--file $(realpath ./${file}) \
--protected \
--public \
--project openstack \
--project-domain default \
--property hw_qemu_guest_agent=yes \
--property os_require_quiesce=yes \
--property os_type=linux \
--property os_distro=almalinux \
--property hw_machine_type=q35 \
"${imageName}"
The output:
+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum | c133f9b306c5f8e01a0e50178e1669ee |
| container_format | bare |
| created_at | 2021-12-13T15:57:13Z |
| disk_format | raw |
| file | /v2/images/d4b93a5d-6cb5-4a60-baae-4e8131287fa0/file |
| id | d4b93a5d-6cb5-4a60-baae-4e8131287fa0 |
| min_disk | 0 |
| min_ram | 1 |
| name | AlmaLinux 8.5 (20211119): Single diks |
| owner | 32f959d2f3bb4249a7c989aadadb377d |
| properties | direct_url='rbd://a8606920-4830-45ba-8704-34b98a09c779/ost-dp1-image/d4b93a5d-6cb5-4a60-baae-4e8131287fa0/snap', hw_machine_type='q35', hw_qemu_guest_agent='yes', os_distro='almalinux', os_require_quiesce='yes', os_type='linux' |
| protected | True |
| schema | /v2/schemas/image |
| size | 10737418240 |
| status | active |
| tags | |
| updated_at | 2021-12-13T16:07:08Z |
| virtual_size | None |
| visibility | public |
+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Windows Server 2019
Windows Server 2019 - Image download
Download the ISO image to your local workstation from
You can get the latest VirtIO drivers from
Windows Server 2019 - Temporary VM creation
Create a local qcow2 image with the name win2k19.qcow2
and the following resources:
- 2 GB RAM
- 2 CPU
- 15 GB storage space
- 2 CD-ROM devices
Execute the following steps:
- Connect the first CD-ROM to the Windows Server 2019 ISO and the second CD-ROM to the virtio drivers.
- Follow the installation wizard until the VM is ready. Select the following:
- Operating system: Windows Server 2019 Standard (Desktop Experience)
- Allocate all storage to the disk
- The system should automatically reboot.
- Select an Administrator password for the VM.
If the installation process doesn't begin, check if the Windows Server ISO CD-ROM drive is activated in the boot menu.
Windows Server 2019 - Temporary VM configuration
Drivers
We need to install the correct drivers for Windows to function on the OpenStack Cloud.
Fortunately the virtio drivers also come with a program to install the drivers.
Navigate to E:\
and execute virtio-win-gt-x64
.
Deactivate the Spice Agent
.
After that, install the QEMU guest agent
located at E:\guest-agent\qemu-ga-x86_64
RDP
Since you are still on a local virtual machine, jump to the Windows Server 2019 section on this page and copy the commands to the virtual machine.
Enable RDP to make it easier to access the virtual machine, once created in the OpenStack cloud. Open a powershell and enter the following:
Enable-NetFirewallRule -name RemoteDesktop-UserMode-In-TCP
Set RDP to enabled:
Press CTRL-R and enter the following to open the System Properties:
sysdm.cpl
Switch to the remote tab and set "Allow remote connections to this computer".
Windows Update
Update the machine via Windows Update and restart the VM.
- Press
Windows+s
and search for "Check for updates". - Start the update process by clicking on "Check for updates".
- Windows will ask you to reboot the VM once it downloaded all updates.
To prevent reboots at random times, we need to deactivate automated windows updates.
- Press CTRL-R and enter the following to open the local group policy editor:
gpedit.msc
- Move to Computer Configuration -> Administrative Templates -> Windows Components -> Windows Update
- Set Configure Automatic Updates to disabled
Windows Server 2019 - Image conversion
Convert it to raw:
qemu-img convert -p -O raw win2k19.qcow2 win2k19.raw
Windows Server 2019 - Image upload (with QEMU Guest Agent support)
source /home/os-prov/provisioning-data/openrc-files/sst-domain/openrc_sst-domain.sh
We upload the image as private, since we want to test it, before releasing it to the public.
file=win2k19.raw
imageName="Windows Server 2019 Standard"
openstack image create \
--disk-format raw \
--min-ram 1 \
--file $(realpath ./${file}) \
--protected \
--private \
--project openstack \
--project-domain default \
--property hw_qemu_guest_agent=yes \
--property os_require_quiesce=yes \
--property os_type=windows \
--property os_distro=windows \
--property hw_machine_type=q35 \
--property hw_vif_model=e1000 \
"${imageName}"
The output:
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum | 2be987dc1107e06515ad5f5de5f18411 |
| container_format | bare |
| created_at | 2020-06-25T10:26:53Z |
| disk_format | raw |
| file | /v2/images/4c56a79b-a2f5-47be-9de0-ce808f5b77cc/file |
| id | 4c56a79b-a2f5-47be-9de0-ce808f5b77cc |
| min_disk | 0 |
| min_ram | 1 |
| name | Windows Server 2019 Standard new |
| owner | 32f959d2f3bb4249a7c989aadadb377d |
| properties | direct_url='rbd://a8606920-4830-45ba-8704-34b98a09c779/ost-dp1-image/4c56a79b-a2f5-47be-9de0-ce808f5b77cc/snap', hw_machine_type='q35', hw_qemu_guest_agent='yes', hw_vif_model='e1000', os_distro='windows', os_require_quiesce='yes', os_type='windows' |
| protected | True |
| schema | /v2/schemas/image |
| size | 16106127360 |
| status | active |
| tags | |
| updated_at | 2020-06-25T11:11:10Z |
| virtual_size | None |
| visibility | private |
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Windows Server 2019 - Image clean-up
rm win2k19.raw.tar.gz
rm win2k19.raw
rm win2k19.qcow2