Ubuntu 24.04
Sponsored Link

OpenStack Dalmatian : Create Instances (Windows)2024/10/04

 

Create and Start Virtual Machine Instance that Windows is installed.

[1] Create Windows image on a Compute Node and add it to Glance.
For example on here, it creates Windows Server 2022 image.
Download Windows Server 2022 installation ISO beforehand.
# download VirtIO driver for Windows

root@dlp ~(keystone)#
wget https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso -O /home/virtio-win.iso
# install Windows

root@dlp ~(keystone)# virt-install \
--name Win2k22 \
--ram 6144 \
--disk path=/var/lib/libvirt/images/Win2k22.img,size=40,bus=virtio \
--disk path=/home/virtio-win.iso,device=cdrom \
--vcpus 4 \
--os-variant win2k22 \
--network default,model=virtio \
--graphics vnc,listen=0.0.0.0,password=password \
--video vga \
--cdrom /home/Win2022_EN-US_20348.169.210806-2348.fe.iso 


# if enable secure boot, specify like follows

root@dlp ~(keystone)# virt-install \
--name Win2k22 \
--ram 6144 \
--disk path=/var/lib/libvirt/images/Win2k22.img,size=40,bus=virtio \
--disk path=/home/virtio-win.iso,device=cdrom \
--cpu host-passthrough \
--vcpus=4 \
--os-variant win2k22 \
--network default,model=virtio \
--graphics vnc,listen=0.0.0.0,password=password \
--video virtio \
--cdrom /home/Win2022_EN-US_20348.169.210806-2348.fe.iso \
--features kvm_hidden=on,smm=on \
--boot loader=/usr/share/OVMF/OVMF_CODE_4M.secboot.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/OVMF/OVMF_VARS_4M.fd 
[2] During the installation, load VirtIO driver to detect disks.
Click the [Load driver] link.
[3] Specify a folder under the [virtio-win.iso].
For the case of x64 System, specify the folder [amd64] - [2k22].
After that, proceed installation steps with common procedure.
[4] After finishing installation, logon to the Windows and apply VirtIO driver to the network device.
For others, if you need, apply VirtIO driver to display device and PCI device.
[5] Run PowerShell with admin privilege and change ExecutionPolicy to Unrestricted.
PS > Set-ExecutionPolicy Unrestricted
[6] Download and Install CloudbaseInit.
PS > curl.exe -L https://cloudbase.it/downloads/CloudbaseInitSetup_Stable_x64.msi -o cloudbaseinit.msi
PS > ./cloudbaseinit.msi
[7] Check boxes all to shutdown Windows after running Sysprep and Click the [Finish] button.
[8] Add Windows image to Glance.
root@dlp ~(keystone)#
openstack image create "Win2k22" --file /var/lib/libvirt/images/Win2k22.img --disk-format qcow2 --container-format bare --public
# if you installed Windows with secure boot, add properties like follows

root@dlp ~(keystone)#
openstack image create "Win2k22" --file /var/lib/libvirt/images/Win2k22.img --disk-format qcow2 --container-format bare --public \
--property hw_firmware_type=uefi --property hw_machine_type=q35 --property os_secure_boot=optional

[9] Create Windows instance with an Openstack user.
ubuntu@dlp ~(keystone)$
openstack flavor list

+----+-----------+-------+------+-----------+-------+-----------+
| ID | Name      |   RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+-------+------+-----------+-------+-----------+
| 1  | m1.tiny   |  2048 |   10 |         0 |     1 | True      |
| 2  | m1.small  |  4096 |   10 |         0 |     2 | True      |
| 3  | m1.medium |  8192 |   10 |         0 |     4 | True      |
| 4  | m1.large  | 16384 |   10 |         0 |     8 | True      |
| 5  | m2.medium |  8192 |   10 |        10 |     4 | True      |
| 6  | m3.medium |  8192 |   50 |         0 |     4 | True      |
+----+-----------+-------+------+-----------+-------+-----------+

ubuntu@dlp ~(keystone)$
openstack image list

+--------------------------------------+------------+--------+
| ID                                   | Name       | Status |
+--------------------------------------+------------+--------+
| a9d10f1d-d836-424d-8117-ff3fc8c5e966 | Ubuntu2404 | active |
| 0fd95652-9cb5-49c9-9fe6-8e9c53a76b00 | Win2k22    | active |
+--------------------------------------+------------+--------+

ubuntu@dlp ~(keystone)$
openstack security group list

+------------------+------------+------------------+--------------------+------+
| ID               | Name       | Description      | Project            | Tags |
+------------------+------------+------------------+--------------------+------+
| e7031ca4-f693-   | default    | Default security | 84e315c8d65e4b3cb3 | []   |
| 4184-87f8-       |            | group            | 3aaf69c9eed0c3     |      |
| 9099b24faef7     |            |                  |                    |      |
| f1f9a564-53aa-   | secgroup01 | secgroup01       | 84e315c8d65e4b3cb3 | []   |
| 4c02-b302-       |            |                  | 3aaf69c9eed0c3     |      |
| d89928deef8b     |            |                  |                    |      |
+------------------+------------+------------------+--------------------+------+

ubuntu@dlp ~(keystone)$
openstack network list

+--------------------------------+------------+--------------------------------+
| ID                             | Name       | Subnets                        |
+--------------------------------+------------+--------------------------------+
| 7398c285-1333-4aa7-a487-       | sharednet1 | 7097c0b5-34be-4179-8316-       |
| 1d37e5e27eb9                   |            | 7b9131d61308                   |
+--------------------------------+------------+--------------------------------+

ubuntu@dlp ~(keystone)$
netID=$(openstack network list | grep sharednet1 | awk '{ print $2 }')
# [admin_pass=***] : set any Administrator password

ubuntu@dlp ~(keystone)$
openstack server create --flavor m3.medium --image Win2k22 --security-group secgroup01 --nic net-id=$netID --property admin_pass="P@ssw0rd01" Windows-2022
ubuntu@dlp ~(keystone)$
openstack server list

+-------------+-------------+---------+---------------+------------+-----------+
| ID          | Name        | Status  | Networks      | Image      | Flavor    |
+-------------+-------------+---------+---------------+------------+-----------+
| 54701617-   | Windows-    | ACTIVE  | sharednet1=10 | Win2k22    | m3.medium |
| f16f-460e-  | 2022        |         | .0.0.237      |            |           |
| a9ce-       |             |         |               |            |           |
| 25fbcba68f9 |             |         |               |            |           |
| d           |             |         |               |            |           |
| 885b6f1a-   | Ubuntu-2404 | SHUTOFF | sharednet1=10 | Ubuntu2404 | m1.small  |
| 3e80-4e0d-  |             |         | .0.0.224      |            |           |
| b6a7-       |             |         |               |            |           |
| 9781ac46bd1 |             |         |               |            |           |
| a           |             |         |               |            |           |
+-------------+-------------+---------+---------------+------------+-----------+

ubuntu@dlp ~(keystone)$
openstack console url show Windows-2022

+----------+-------------------------------------------------------------------+
| Field    | Value                                                             |
+----------+-------------------------------------------------------------------+
| protocol | vnc                                                               |
| type     | novnc                                                             |
| url      | https://dlp.srv.world:6080/vnc_auto.html?path=%3Ftoken%3D88986ca7 |
|          | -8106-4e30-8d86-4aed678e85b8                                      |
+----------+-------------------------------------------------------------------+
[10] It needs to change admin password when initial logon.
The current password is the one you set on [openstack server create] command.
[11] That's OK if you logon successfully after changing password.
Matched Content