To have your OpenStack environment on Hyper-V, the computer must meet some requirements:
- Operating System: Windows 8.1+
- Processor with at least 4 cores
- Memory: 8GB (For Testing)
- Hardware-assisted virtualization enabled (IVT)
- Windows with Hyper-V Support
- Operating System: Windows 8.1+
- Processor: Processor with at least 16 cores
- Memory: 32GB (To run multiple instances simultaneously)
- Hardware-assisted virtualization enabled (IVT)
- Windows with Hyper-V Support
Before starting the actual deployment of OpenStack on your Windows you must perform all the operations in the Administrator account and not in a normal account even if it is administrator
Open a Powershell window as administrator and run these commands:
net user administrator /active:yesFinally, set a password for it
net user administrator <Password>After performing these commands, log out of your local account and log in to the new Administrator account
⚠️ Warning: Administrator account is required otherwise the FreeRDP console will not work on OpenStack and you will not be able to use instances from the browser
The first thing you need to do, if you don't have Hyper-V already enabled
Open Windows PowerShell as administrator and type this command to enable Hyper-V
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -AllAt the end of the command restart your computer
After restarting your computer, reach this link to download Multipass: https://multipass.run/download/windows
At the end of the download, run setup as administrator and install Multipass and use the Hyper-V hypervisor
Open a Powershell window as administrator and start a virtual machine where the OpenStack controller will sit with:
multipass launch 22.04 --name openstack-controller --cpus 4 --memory 6G --disk 100GYou can also change the number of VCPUs and the allocated memory and also the virtual disk capacity allocated to the VM
Before shutting down the virtual machine, you ABSOLUTELY need to set a root password otherwise you will not be able to use the OpenStack controller
multipass exec openstack-controller -- sudo passwd rootSince we should be configuring the OpenStack controller VM, it will be necessary to shutdown:
multipass stop openstack-controllerFinally, as a last thing, delete the virtual machine from Multipass
multipass delete openstack-controller
⚠️ Notice: this will NOT delete the virtual machine from Hyper-V but this will make it unusable from Multipass, the VM on Hyper-V will still remain
The first Switch we will have to create is the external one that connects to the physical network card of the Computer
So we will use this command:
New-VMSwitch -Name os-ext -NetAdapterName Wi-FiNow we will create an internal switch that will only use the OpenStack Controller to configure the OpenStack services:
New-VMSwitch -SwitchName "os-int" -SwitchType InternalNow we are going to configure a Gateway for our Internal switch: (The Private IP address you assign to the internal switch will be the same one you will need to use to access the OpenStack from Windows)
New-NetIPAddress -IPAddress <IPAddress> -PrefixLength 24 -InterfaceIndex <ifIndex>You can enter any Private IP Address that has these ranges: from 10.0.0.0 to 10.255.255.255, remembering to enter the number 1 at the end to set a Gateway
Example: 10.68.76.136 ---> 10.68.76.1 (This will be the Gateway of your Private IP address)
You can also generate Private IP addresses from this web page by entering the Range specified above: https://www.browserling.com/tools/random-ip
While to find the IfIndex value you just need to write the command: Get-NetAdapter
Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
---- -------------------- ------- ------ ---------- ---------
vEthernet (os-int) Hyper-V Virtual Ethernet Adapter *n 00 Up 00-15-5D-01-54-0A 10 GbpsAnd in the ifIndex column you can get the value to assign to the private IP address.
Finally we are going to create one last Virtual Switch that will be used for the internal OpenStack network
New-VMSwitch -SwitchName "os-int-net" -SwitchType Internal
New-NetIPAddress -IPAddress 10.0.0.1 -PrefixLength 16 -InterfaceIndex <ifIndex>The very last thing to do that is important is to create a NAT for the IP address of the OpenStack internal network
We will use this command to create it
New-NetNat -Name OpenStackInternalNetwork -InternalIPInterfaceAddressPrefix 10.0.0.1/16Notices:
⚠️ Note!: In general, when adding internal networks with private IP addresses to OpenStack on Hyper-V, to obtain internet access on the instances it is necessary to create NATs otherwise we would be forced to also connect the external network, If this NAT is not created, all the instances launched ONLY with the internal network will not have access to the internet, the only way will be to also use the external network
The result will be this:
Assign all virtual switches to the OpenStack controller
Add-VMNetworkAdapter -VMName openstack-controller -SwitchName os-ext
Add-VMNetworkAdapter -VMName openstack-controller -SwitchName os-int
Add-VMNetworkAdapter -VMName openstack-controller -SwitchName os-int-netAnd from the settings disable checkpoints, and if the Default Switch is assigned, remove it from the OpenStack Controller settings
And the openstack-controller VM setting tab should look like this:
Now that we have finished configuring the VM let's start it with:
Start-VM -Name openstack-controllerOnce the VM has started, log in with the root user and the password you previously set from Multipass
Now set a hostname to identify the OpenStack Controller:
sudo hostnamectl set-hostname openstack
And after logging out and logging in again you should see the new hostname
Go to the folder cd /etc/netplan/
Delete the default file rm -rf 50-cloud-init.yaml
And now go configure all the interfaces by writing this new netplan file
enter the command:
nano interfaces.yamland paste this
network:
ethernets:
eth0:
addresses:
- <PhysicalNetworkIPAddress>/24
gateway4: <PhysicalNetworkGateway>
nameservers:
addresses: [<PhysicalNetworkGateway>, 8.8.8.8]
match:
macaddress: <MacAddressInterface1>
set-name: os-ext
eth1:
addresses:
- <YourPrivateIPAddress>/24
gateway4: <YourPrivateIPAddressGateway>
match:
macaddress: <MacAddressInterface2>
set-name: os-int
eth2:
match:
macaddress: <MacAddressInterface3>
set-name: os-int-netObviously replace all the values with the gateway and the IP address of your physical network that has access to the Internet and your Private IP address created previously with its Gateway
Make sure you do not enter the gateway of the Private IP, as a Private IP address to enter you can go from the range from 2 to 254
Example: 10.68.76.1 --> 10.68.76.4 (This is an example of the IP address you can assign)
Most of the IP addresses you need to enter can be found by typing ipconfig from Windows
To get the MAC addresses of all interfaces type this: lshw -C network
Finally apply the changes with netplan apply
Finally, to see the changes, install the ifconfig command
apt install net-tools -y
now by typing the ifconfig command you will be able to see all the interfaces configured correctly:
Lastly we will configure SSH
Open the file /etc/ssh/sshd_config with nano
And go and uncomment the following lines:
Port 22
AddressFamily any
PermitRootLogin yes
PubKeyAuthentication yesAnd finally go and modify the following value:
PasswordAuthentication yesSave the file and restart the sshd service: systemctl restart sshd
And now you will be able to connect via SSH to the OpenStack controller, you can log out inside the Hyper-V VM and connect externally using the external IP address from PuTTY
You may notice that by going to the Networking tab from your OpenStack controller that your IP addresses are not detected
To solve this small visual problem we just need to make a small configuration to the controller:
Open the following file /etc/initramfs-tools/modules
nano /etc/initramfs-tools/modulesAnd at the bottom copy these additional modules, save the file
hv_vmbus
hv_storvsc
hv_blkvsc
hv_netvscNow we need to install some virtual tools, at the end of the installation update the initramfs and restart the controller
apt-get install linux-virtual linux-cloud-tools-virtual linux-tools-virtual
update-initramfs -u
rebootAnd when you restart the controller you should see the IP addresses that they didn't see before and the problem will be solved
Access the /root folder
cd /root
git clone https://github.com/Sorecchione07435/Debian-OpenStack-Installer.gitEnter the newly cloned folder and configure the installer
cd Debian-OpenStack-Installer/open the openstack.conf file
#This is a small configuration file for configuring OpenStack
#Set passwords for all OpenStack services, databases
#
# Configuration of all passwords
ADMIN_PASSWORD=<AdminPassword>
SERVICE_PASSWORD=$ADMIN_PASSWORD
RABBITMQ_PASSWORD=$ADMIN_PASSWORD
DATABASE_PASSWORD=$ADMIN_PASSWORD
DEMO_PASSWORD=<DemoPassword>
#
#Network Configuration
#Enter the IP address of your controller node where all OpenStack services will be installed
HOST_IP=<PrivateIP>
#Specifies the physical interface that will be used for Neutron
HOST_IP_INTERFACE_NAME=os-ext
#Here you need to enter all the values for the public network, such as Allocation Pool, Gateway and DNS
#It is recommended to enter a larger IP address as Range Start to HOST_IP
PUBLIC_SUBNET_CIDR=<PublicIPCIDR>
PUBLIC_SUBNET_RANGE_START=<PublicIPCIDRRangeStart>
PUBLIC_SUBNET_RANGE_END=PublicIPCIDRRangeEnd>
PUBLIC_SUBNET_GATEWAY=PublicIPCIDRGateway
PUBLIC_SUBNET_DNS_SERVERS=8.8.8.8
#Enter the type of mechanism that Neutron's ML2 plugin will use (OpenvSwitch (Release Yoga and up) recommended)
NEUTRON_ML2_MECHANISM_TYPE=linuxbridge
#
#Choose whether to install the Block Storage service (Cinder) (Yes or No)
INSTALL_CINDER=no
#Only in releases higher than Xena
#
#Set the type of Hypervisor where the instances will run, KVM is the default
NOVA_COMPUTE_VIRT_TYPE=qemu
#Specifies the OpenStack release to install, the default is Yoga
OPENSTACK_RELEASE=yoga
Enter all the IP addresses you configured, the administrator password and the demo password and when you are finished save the file
Finally start the OpenStack installation:
chmod +x openstack-install.sh
./openstack-install.shAnd wait for the OpenStack installation to finish
To use the hyperv network on Neutron you need a package called networking-hyperv
This package contains the Hyper-V Neutron Agent, Security Groups Driver, and ML2 Mechanism Driver, which are used to properly bind neutron ports on a Hyper-V host.
It can be installed in two ways:
Direct installation from APT
apt install python3-networking-hypervFirst of all install pip with:
apt install python3-pipAnd here we can enter the actual command to install this package
If you are using OpenStack Yoga:
pip3 install networking-hyperv==12.0.0If you are using OpenStack Xena:
pip3 install networking-hyperv==11.0.0If you are using OpenStack Wallaby:
pip3 install networking-hyperv==10.0.0If you are using OpenStack Victoria:
pip3 install networking-hyperv==9.0.0If you are using OpenStack Ussuri:
pip3 install networking-hyperv==8.0.0NOTICE: Remember that installing this package is essential!
Open the /etc/neutron/neutron.conf file and look for the [DEFAULT] section and select the ML2 plugin:
core_plugin = neutron.plugins.ml2.plugin.Ml2PluginOpen the file /etc/neutron/plugins/ml2/ml2_conf.ini, look for the [ml2] section and set the proper configuration,
[ml2]
tenant_network_types = vlan,local,flat
type_drivers = local,flat,vlan,gre,vxlan
mechanism_drivers = linuxbridge,hypervIn the [ml2_type_flat] section set:
flat_networks = os-ext,os-int-netFinally after making these changes to Neutron, you need to restart the neutron-server service
systemctl restart neutron-serverNow that we have successfully configured Neutron, we need to create an external network where the instances will run
Create the Public Network
Delete existing networks created from installer:
source admin-openrc.sh
openstack network delete public
openstack network delete internalCreate an external public flat network with:
neutron net-create --provider:network_type flat --provider:physical_network os-ext --router:external publicNow create a subnet for the newly created network
neutron subnet-create --name public_subnet public <PhysicalNetworkIPAddress>/24 --disable-dhcpNow you will need to configure the subnet for the range allocation pool and also assigning a gateway and DNS:
neutron subnet-update public_subnet --allocation-pool start=<PhysicalNetworkIPAddressRangeStart>,end= <PhysicalNetworkIPAddressRangeEnd>
neutron subnet-update public_subnet --gateway <PhysicalNetworkIPAddressGateway>
neutron subnet-update public_subnet --dns-nameserver 8.8.8.8NOTE! : The address of the public subnet may differ from the address of the network card, do not use the same IP address mentioned above because it may be different from yours
Create the Internal Network
Create an internal network with:
neutron net-create --provider:network_type flat --provider:physical_network os-int-net --router:external internal
neutron subnet-create --name internal_subnet internal 10.0.0.0/16 --disable-dhcp
neutron subnet-update internal_subnet --allocation-pool start=10.0.0.2,end=10.0.0.200
neutron subnet-update internal_subnet --gateway 10.0.0.1
neutron subnet-update internal_subnet --dns-nameserver 8.8.8.8We have completed configuring Neutron and setting up the networks
Download the OpenStack Hyper-V Nova Compute Yoga Driver from here:
https://cloudbase.it/downloads/HyperVNovaCompute_Yoga_25_0_0.msi
And also download the FreeRDP Web Connect console
https://cloudbase.it/downloads/FreeRDPWebConnect.msi
After downloading the Setups run them with Windows Powershell, and on the Hyper-V Nova Compute Driver specify the external switch where the OpenStack controller is connected, and fill in all the required fields such as (AMQP Transport Url, FreeRDP Console, Placement, Neutron), you can find all this information in the Nova configuration inside the OpenStack controller, finally also install the FreeRDP console by specifying your Windows IP address and to use it in OpenStack enter your Identity Url and the administrator password, even that of the host
Installing OpenStack Hyper-V Nova Compute Driver
Remember to check the two checkboxes "Always attach a ConfigDrive to new instances" and "Inject password in ConfigDrive" to ensure that the started instances get their configuration drive to get their IP addresses of the associated networks, inject the passwords set by the hypervisor etc..
Installing the FreeRDP Web Connect Console
Enter all the IP addresses related to your PC and the OpenStack controller node
After successfully installing these 2 installers
To ensure that the Neutron Hyper-V agent recognizes the Virtual Switches with their physical interfaces and connects the switch assigned to a specific network to the launched instances, a small configuration must be done
Open the file with a text editor from Windows: C:\Program Files\Cloudbase Solutions\OpenStack\Nova\etc\neutron_hyperv_agent.conf
And set this directive with the name of the virtual switches and physical interfaces connected to the OpenStack controller:
[AGENT]
physical_network_vswitch_mappings = os-ext:os-ext,os-int-net:os-int-netFinally restart the Neutron Hyperv Agent service:
net stop neutron-hyperv-agent
net start neutron-hyperv-agentBy default the OpenStack installer installs and configures a QEMU or KVM hypervisor, to use the Hyperv hypervisor that we have installed on Windows we must disable it
source admin-openrc.sh
openstack compute service set --disable openstack nova-computeAnd finally disable the startup of the nova-compute service
systemctl disable nova-compute
systemctl stop nova-computeNow in OpenStack Controller check if the hyperv hypervisor is been recognized with
openstack compute service list --service nova-compute
+--------------------------------------+--------------+-----------------+------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+--------------------------------------+--------------+-----------------+------+---------+-------+----------------------------+
| xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | nova-compute | your-hostname | nova | enabled | up | 0000-00-00T00:00:00.000000 |
+--------------------------------------+--------------+-----------------+------+---------+-------+----------------------------+
⚠️ Warning: If in this case nothing is returned to you, and the table below is not displayed you may want to check the nova-compute logs, This means that the Hyperv hypervisor was not started successfully, This could also be caused by a misconfiguration of nova-compute, make sure you have entered the correct information!
Finally, as a last thing, let's discover the compute host in Nova
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" novaThis step can be safely skipped as Nova has already set an interval to discover hosts
To create flavors run:
source admin-openrc.sh
nova flavor-create m1.nano 0 128 5 1
nova flavor-create m1.micro 1 256 5 1
nova flavor-create m1.tiny 2 512 5 1
nova flavor-create m1.small 3 2048 20 2
nova flavor-create m1.medium 4 4096 40 2
nova flavor-create m1.large 5 8192 50 4
⚠️ Warning: Of course you should ONLY create flavors that are good for your computer
Example:
If you have 16GB of RAM and 8 Processors
Let's subtract the RAM allocated to the OpenStack controller
16 - 6 = 10GB
Let's subtract the CPUs allocated to the OpenStack controller
8 - 4 = 4 VCPUs remaining
We will be able to create Flavors as large as 4 VCPUs
We will be able to create Flavors as large as 10 GB of RAM
If you have 32GB of RAM and 16 Processors
Let's subtract the RAM allocated to the OpenStack controller
32 - 6 = 26GB
Let's subtract the CPUs allocated to the OpenStack controller
16 - 4 = 12 VCPUs remaining
We will be able to create Flavors as large as 12 VCPUs
We will be able to create Flavors as large as 26 GB of RAM
⚠️ Warning: Therefore it will not be possible to use all the memory available from the hyperv hypervisor as a quantity is already used by the openstack controller, if these limits are exceeded the instance will fail to launch due to insufficient memory
Well our cloud is finally ready to host a test instance
Download the Cirros test image from Cloudbase from the link below:
https://www.cloudbase.it/downloads/cirros-0.3.4-x86_64.vhdx.gz
Now create a network share from your Downloads folder from Powershell as Administrator:
New-SmbShare -Name Downloads -Path C:\Users\username\Downloads\Login to your OpenStack controller and mount the directory:
sudo su
mount //ipaddress/Downloads /mnt -o username=usernamehost,password=passwordhostFinally upload your image to Glance with:
source admin-openrc.sh
gunzip -cd /mnt/cirros-0.3.4-x86_64.vhdx.gz | glance image-create --name cirros --container-format bare --disk-format vhd --visibility publicWhen the image has been successfully uploaded, launch an instance with:
source admin-openrc.sh
nova boot --flavor m1.tiny --image cirros --nic net-name=internal cirros-testYou can now access the dashboard by pointing any browser to the private IP address you configured http://<PrivateIPAddress>/dashboard
and here you can see the newly created instance
And if you look in Hyper-V Manager you can see a virtual machine named "instance-00000001", the instance is running on Hyper-V
One very last optional thing you can do if you want to use the OpenStack CLI directly from Windows is to export all the environment variables for authentication
Go to Control Panel, Advanced System Settings, and Environment Variables, enter all the names and values of the Keystone RC file
The environment variables to create are:
OS_PROJECT_DOMAIN_NAME=Default
OS_USER_DOMAIN_NAME=Default
OS_PROJECT_NAME=admin
OS_USERNAME=admin
OS_PASSWORD=adminpw
OS_AUTH_URL=http://keystone:5000/v3
OS_IDENTITY_API_VERSION=3
OS_IMAGE_API_VERSION=2Well now you will be able to use the OpenStack CLI from Windows
And that's it, now you can launch instances, create new images etc. from your Windows machine.
Now your OpenStack distribution on Windows is ready to use!
Attention!: It will not be possible to create volumes as the Cinder Volume for Windows would be required
The only flaw in your OpenStack distribution on Windows, in the Hyper V Hypervisor only images in VHD format are supported, if you want to use Linux cloud images or other images with different format you will need to convert them to VHD
Follow this other guide on how to convert images to run on Hyper-V: How to convert cloud images to VHD to run on Hyper-V
If you also want to use volumes follow this other guide: How to Install Cinder Volume for Windows
If you want to use an instance with nested virtualization: How to enable nested virtualization in OpenStack on Hyper-V
If you want to connect to the instance via RDP: How to connect to RDP to OpenStack instances (Hyper-V)
To upload the Cloudbase Windows Server 2012 R2 image: How to upload Windows Server 2012 R2 image to OpenStack Hyper-V
NOTE!: to have OpenStack always available on your computer, the openstack-controller virtual machine must always remain running, the openstack controller will remain running even after a computer restart, or even a system shutdown
However, if the computer is suddenly turned off, the operating system contained in the OpenStack controller will also restart, you will have to wait for all OpenStack services to start
Remember that this distribution of OpenStack on Windows Hyper-V will not be 100% functional, but quite usable for that is always strongly recommended to use OpenStack with all the performance of your computer by installing it on a Linux machine (Ubuntu, RHEL,SLES etc..)



