Skip to content

Virtual Machine Image Guide

An OpenStack Compute cloud needs to have virtual machine images in order to launch an instance. A virtual machine image is a single file which contains a virtual disk that has a bootable operating system installed on it.

Very Important

The provided Windows Server 2022 R2 image is for evaluation only. This evaluation edition expires in 180 days. This is intended to evaluate if the product is right for you. This is on user discretion to update, extend, and handle licensing issues for future usages.

How to extend activation grace period for another 180 days?

Remote desktop to your running Windows VM. Using the search function in your taskbar, look up Command Prompt. When you see it in the results, right-click on it and choose Run as Administrator. Your VM's current activation grace period can be reset by running: slmgr -rearm. Once this command is run successfully, restart your instance for the changes to take effect. This command typically resets the activation timer to 180 days and can be performed only for a limited number of times. For more about this read here.

Existing Microsoft Windows Image

Cloudbase Solutions provides Microsoft Windows Server 2022 R2 Standard Evaluation for OpenStack. This includes the required support for hypervisor-specific drivers (Hyper-V / KVM). Also integrated are the guest initialization tools (Cloudbase-Init), security updates, proper performance, and security configurations as well as the final Sysprep.

How to Build and Upload your custom Microsoft Windows Image

Overall Process

To create a new image, you will need the installation CD or DVD ISO file for the guest operating system. You will also need access to a virtualization tool. You can use KVM hypervisor for this. Or, if you have a GUI desktop virtualization tool (such as, virt-manager, VMware Fusion or VirtualBox), you can use that instead. Convert the file to QCOW2 (KVM, Xen) once you are done.

You can customize and build the new image manually on your own system and then upload the image to the NERC's OpenStack Compute cloud. Please follow the following steps which describes how to obtain, create, and modify virtual machine images that are compatible with the NERC's OpenStack.

1. Prerequisite

Follow these steps to prepare the installation

a. Download a Windows Server 2022 installation ISO file. Evaluation images are available on the Microsoft website (registration required).

b. Download the signed VirtIO drivers ISO file from the Fedora website.

c. Install Virtual Machine Manager on your local Windows 10 machine using WSL:

  • Enable WSL on your local Windows 10 subsystem for Linux:

    The steps given here are straightforward, however, before following them make sure on Windows 10, you have WSL enabled and have at least Ubuntu 20.04 or above LTS version running over it. If you don’t know how to do that then see our tutorial on how to enable WSL and install Ubuntu over it.

  • Download and install MobaXterm:

    MobaXterm is a free application that can be downloaded using this link. After downloading, install it like any other normal Windows software.

  • Open MobaXterm and run WSL Linux:

    As you open this advanced terminal for Windows 10, WSL installed Ubuntu app will show on the left side panel of it. Double click on that to start the WSL session.

    MobaXterm WSL Ubuntu-20.04 LTS

  • Install Virt-Manager:

    sudo apt update
    sudo apt install virt-manager
    
  • Run Virtual Machine Manager:

    Start the Virtual Machine Manager running this command on the opened terminal: virt-manager as shown below:

    MobaXterm start Virt-Manager

    This will open Virt-Manager as following:

    Virt-Manager interface

  • Connect QEMU/KVM user session on Virt-Manager:

    Virt-Manager Add Connection

    Virt-Manager QEMU/KVM user session

    Virt-Manager Connect

2. Create a virtual machine

Create a virtual machine with the storage set to a 15 GB qcow2 disk image using Virtual Machine Manager

Virt-Manager New Virtual Machine

Virt-Manager Local install media

Virt-Manager Browse Win ISO

Virt-Manager Browse Local

Virt-Manager Select the ISO file

Virt-Manager Selected ISO

Virt-Manager default Memory and CPU

Please set 15 GB disk image size as shown below:

Virt-Manager disk image size

Set the virtual machine name and also make sure "Customize configuration before install" is selected as shown below:

Virt-Manager Virtual Machine Name

3. Customize the Virtual machine

Virt-Manager Customize Image

Enable the VirtIO driver. By default, the Windows installer does not detect the disk.

Virt-Manager Disk with VirtIO driver

Virt-Manager Add Hardware

Click Add Hardware > select CDROM device and attach to downloaded virtio-win-* ISO file:

Virt-Manager Add CDROM with virtio ISO

Virt-Manager Browse virtio ISO

Virt-Manager Select virtio ISO

Make sure the NIC is using the virtio Device model as shown below:

Virt-Manager Modify  NIC

Virt-Manager Apply Change on NIC

Make sure to set proper order of Boot Options as shown below, so that CDROM with Windows ISO is set on the first and Apply the order change. After this please begin windows installation by clicking on "Begin Installation" button.

Windows Boot Options

Click "Apply" button.

4. Continue with the Windows installation

You need to continue with the Windows installation process.

When prompted you can choose "Windows Server 2022 Standard Evaluation (Desktop Experinece)" option as shown below:

Windows Desktop Installation

Windows Custom Installation

Load VirtIO SCSI drivers and network drivers by choosing an installation target when prompted. Click Load driver and browse the file system.

Windows Custom Load Driver

Browse Local Attached Drives

Select VirtIO CDROM

Select the E:\virtio-win-*\viostor\2k22\amd64 folder. When converting an image file with Windows, ensure the virtio driver is installed. Otherwise, you will get a blue screen when launching the image due to lack of the virtio driver.

Select Appropriate Win Version viostor driver

The Windows installer displays a list of drivers to install. Select the VirtIO SCSI drivers.

Windows viostor driver Installation

Click Load driver again and browse the file system, and select the E:\NetKVM\2k22\amd64 folder.

Select Appropriate Win Version NetKVM driver

Select the network drivers, and continue the installation.

Windows NetKVM driver Installation

Windows Ready for Installation

Windows Continue Installation

5. Restart the installed virtual machine (VM)

Once the installation is completed, the VM restarts

Define a password for the Adminstrator when prompted and click on "Finish" button:

Windows Administrator Login

Send the "Ctrl+Alt+Delete" key using Send Key Menu, this will unlock the windows and then prompt login for the Administrator - please login using the password you set on previous step:

Windows Send Key

Administrator Login

Administrator Profile Finalize

Windows Installation Successful

6. Go to device manager and install all unrecognized devices

Device Manager View

Device Manager Update Driver

Device Manager Browse Driver

Browse To Attached vitio-win CDROM

Select Attached vitio-win CDROM

Successfully Installed Driver

Similarly as shown above repeat and install all missing drivers.

7. Enable Remote Desktop Protocol (RDP) login

Explicitly enable RDP login and uncheck "Require computers to use Network Level Authentication to connect" option

Enable RDP

Disable Network Level Authentication

8. Delete the recovery parition

Delete the recovery parition which will allow expanding the Image as required running the following commands on Command Prompt (Run as Adminstrator)

diskpart
select disk 0
list partition
select partition 3
delete partition override
list partition

Disk Partition 3 Delete using CMD

and then extend C: drive to take up the remaining space using "Disk Management".

C Drive Extended using Disk Management

C Drive Extended to Take all Unallocated Space

C Drive on DIsk Management

9. Install any new Windows updates. (Optional)

10. Setup cloudbase-init to generate QCOW2 image

Download and install stable version of cloudbase-init (A Windows project providing guest initialization features, similar to cloud-init) by browsing the Download Page on the web browser on virtual machine running Windows, you can escape registering and just click on "No. just show me the downloads" to navigate to the download page as shown below:

Download Cloudbase-init

During Installation, set Serial port for logging to COM1 as shown below:

Download Cloudbase-init setup for Admin

When the installation is done, in the Complete the Cloudbase-Init Setup Wizard window, select the Run Sysprep and Shutdown check boxes and click "Finish" as shown below:

Cloudbase-init Final Setup Options

Wait for the machine to shutdown.

Sysprep Setup in Progress

11. Where is the newly generated QCOW2 image?

The Sysprep will generate QCOW2 image i.e. win2k22.qcow2 on /home/<YourUserName>/.local/share/libvirt/images/

Windows QCOW2 Image

12. Create OpenStack image and push to NERC's image list

You can copy/download this windows image to the folder where you configured your OpenStack CLI as described Here and upload to the NERC's OpenStack running the following OpenStack Image API command:

openstack image create --disk-format qcow2 --file win2k22.qcow2 MS-Windows-2022

You can verify the uploaded image is available by running:

openstack image list

+--------------------------------------+---------------------+--------+
| ID                                   | Name                | Status |
+--------------------------------------+---------------------+--------+
| a9b48e65-0cf9-413a-8215-81439cd63966 | MS-Windows-2022     | active |
| ...                                  | ...                 | ...    |
+--------------------------------------+---------------------+--------+

13. Launch an instance using newly uploaded MS-Windows-2022 image

Login to the NERC's OpenStack and verify the uploaded MS-Windows-2022 is there also available on the NERC's OpenStack Images List for your project as shown below:

MS-Windows-2022 OpenStack Image

Create a Volume using that Windows Image:

MS-Winodws-2022 Image to Volume Create

Create Volume

Once successfully Volume is created, we can use the Volume to launch an instance as shown below:

Launch Instance from Volume

Add other information and setup a Security Group that allows RDP (port: 3389) as shown below:

Launch Instance Security Group for RDP

After some time the instance will be Active in Running state as shown below:

Running Windows Instance

Attach a Floating IP to your instance:

Associate Floating IP

More About Floating IP

If you don't have any available floating IPs, please refer to this documentation on how to allocate a new Floating IP to your project.

Click on detail view of the Instance and then click on Console tab menu and click on "Send CtrlAltDel" button located on the top right side of the console as shown below:

View Console of Instance

Administrator Sign in Prompt

Administrator Prompted to Change Password

Set Administrator Password

Proceed Changed Administrator Password

Administrator Password Changed Successful

14. How to have Remote Desktop login to your Windows instance

Remote Desktop login should work with the Floating IP associated with the instance:

Search Remote Desktop Protocol locally

Connect to Remote Instance using Floating IP

Prompted Administrator Login

Prompted RDP connection

Successfully Remote Connected Instance

For more detailed information about OpenStack's image management, the OpenStack image creation guide provides further references and details.