It is possible to use Hyper-V as a compute node within an OpenStack
Deployment. The nova-compute
service runs as openstack-compute
,
a 32-bit service directly upon the Windows platform with the Hyper-V
role enabled. The necessary Python components as well as the
nova-compute
service are installed directly onto the Windows
platform. Windows Clustering Services are not needed for functionality
within the OpenStack infrastructure.
The use of the Windows Server 2012 platform is recommend for the best
experience and is the platform for active development.
The following Windows platforms have been tested as compute nodes:
The only OpenStack services required on a Hyper-V node are nova-compute
and neutron-hyperv-agent
. Regarding the resources needed for this
host you have to consider that Hyper-V will require 16 GB - 20 GB of
disk space for the OS itself, including updates. Two NICs are required,
one connected to the management network and one to the guest data network.
The following sections discuss how to prepare the Windows Hyper-V node for operation as an OpenStack compute node. Unless stated otherwise, any configuration information should work for the Windows 2012 and 2012 R2 platforms.
The Hyper-V compute node needs to have ample storage for storing the virtual machine images running on the compute nodes. You may use a single volume for all, or partition it into an OS volume and VM volume.
Network time services must be configured to ensure proper operation of the OpenStack nodes. To set network time on your Windows host you must run the following commands:
C:\>net stop w32time
C:\>w32tm /config /manualpeerlist:pool.ntp.org,0x8 /syncfromflags:MANUAL
C:\>net start w32time
Keep in mind that the node will have to be time synchronized with the other nodes of your OpenStack environment, so it is important to use the same NTP server. Note that in case of an Active Directory environment, you may do this only for the AD Domain Controller.
Information regarding the Hyper-V virtual Switch can be located here: Hyper-V Virtual Switch Overview.
To quickly enable an interface to be used as a Virtual Interface the following PowerShell may be used:
PS C:\> $if = Get-NetIPAddress -IPAddress 192* | Get-NetIPInterface
PS C:\> New-VMSwitch -NetAdapterName $if.ifAlias -Name YOUR_BRIDGE_NAME -AllowManagementOS $false
Note
It is very important to make sure that when you are using a Hyper-V
node with only 1 NIC the -AllowManagementOS option is set on True
,
otherwise you will lose connectivity to the Hyper-V node.
To prepare the Hyper-V node to be able to attach to volumes provided by cinder you must first make sure the Windows iSCSI initiator service is running and started automatically.
PS C:\> Set-Service -Name MSiSCSI -StartupType Automatic
PS C:\> Start-Service MSiSCSI
To enable ‘shared nothing live’ migration, run the 3 instructions below on each Hyper-V host:
PS C:\> Enable-VMMigration
PS C:\> Set-VMMigrationNetwork IP_ADDRESS
PS C:\> Set-VMHost -VirtualMachineMigrationAuthenticationTypeKerberos
Note
Please replace the IP_ADDRESS
with the address of the interface
which will provide live migration.
This article clarifies the various live migration options in Hyper-V:
In case you want to avoid all the manual setup, you can use Cloudbase Solutions’ installer. You can find it here:
The tool installs an independent Python environment in order to avoid
conflicts with existing applications, and dynamically generates a
nova.conf
file based on the parameters provided by you.
The tool can also be used for an automated and unattended mode for deployments on a massive number of servers. More details about how to use the installer and its features can be found here:
Python 2.7 32bit must be installed as most of the libraries are not working properly on the 64bit version.
Setting up Python prerequisites
Download and install Python 2.7 using the MSI installer from here:
PS C:\> $src = "https://www.python.org/ftp/python/2.7.3/python-2.7.3.msi"
PS C:\> $dest = "$env:temp\python-2.7.3.msi"
PS C:\> Invoke-WebRequest –Uri $src –OutFile $dest
PS C:\> Unblock-File $dest
PS C:\> Start-Process $dest
Make sure that the Python
and Python\Scripts
paths are set up
in the PATH
environment variable.
PS C:\> $oldPath = [System.Environment]::GetEnvironmentVariable("Path")
PS C:\> $newPath = $oldPath + ";C:\python27\;C:\python27\Scripts\"
PS C:\> [System.Environment]::SetEnvironmentVariable("Path", $newPath, [System.EnvironmentVariableTarget]::User
The following packages need to be downloaded and manually installed:
The following packages must be installed with pip:
PS C:\> pip install ecdsa
PS C:\> pip install amqp
PS C:\> pip install wmi
qemu-img
is required for some of the image related operations.
You can get it from here: http://qemu.weilnetz.de/.
You must make sure that the qemu-img
path is set in the
PATH environment variable.
Some Python packages need to be compiled, so you may use MinGW or
Visual Studio. You can get MinGW from here:
http://sourceforge.net/projects/mingw/.
You must configure which compiler is to be used for this purpose by using the
distutils.cfg
file in $Python27\Lib\distutils
, which can contain:
[build]
compiler = mingw32
As a last step for setting up MinGW, make sure that the MinGW binaries’ directories are set up in PATH.
Use Git to download the necessary source code. The installer to run Git on Windows can be downloaded here:
Download the installer. Once the download is complete, run the installer and follow the prompts in the installation wizard. The default should be acceptable for the purposes of this guide.
PS C:\> $src = "https://github.com/msysgit/msysgit/releases/download/Git-1.9.2-preview20140411/Git-1.9.2-preview20140411.exe"
PS C:\> $dest = "$env:temp\Git-1.9.2-preview20140411.exe"
PS C:\> Invoke-WebRequest –Uri $src –OutFile $dest
PS C:\> Unblock-File $dest
PS C:\> Start-Process $dest
Run the following to clone the nova code.
PS C:\> git.exe clone https://git.openstack.org/openstack/nova
To install nova-compute
, run:
PS C:\> cd c:\nova
PS C:\> python setup.py install
The nova.conf
file must be placed in C:\etc\nova
for running
OpenStack on Hyper-V. Below is a sample nova.conf
for Windows:
[DEFAULT]
auth_strategy = keystone
image_service = nova.image.glance.GlanceImageService
compute_driver = nova.virt.hyperv.driver.HyperVDriver
volume_api_class = nova.volume.cinder.API
fake_network = true
instances_path = C:\Program Files (x86)\OpenStack\Instances
glance_api_servers = IP_ADDRESS:9292
use_cow_images = true
force_config_drive = false
injected_network_template = C:\Program Files (x86)\OpenStack\Nova\etc\interfaces.template
policy_file = C:\Program Files (x86)\OpenStack\Nova\etc\policy.json
mkisofs_cmd = C:\Program Files (x86)\OpenStack\Nova\bin\mkisofs.exe
allow_resize_to_same_host = true
running_deleted_instance_action = reap
running_deleted_instance_poll_interval = 120
resize_confirm_window = 5
resume_guests_state_on_host_boot = true
rpc_response_timeout = 1800
lock_path = C:\Program Files (x86)\OpenStack\Log\
rpc_backend = nova.openstack.common.rpc.impl_kombu
rabbit_host = IP_ADDRESS
rabbit_port = 5672
rabbit_userid = guest
rabbit_password = Passw0rd
logdir = C:\Program Files (x86)\OpenStack\Log\
logfile = nova-compute.log
instance_usage_audit = true
instance_usage_audit_period = hour
use_neutron = True
[neutron]
url = http://IP_ADDRESS:9696
auth_strategy = keystone
admin_tenant_name = service
admin_username = neutron
admin_password = Passw0rd
admin_auth_url = http://IP_ADDRESS:35357/v2.0
[hyperv]
vswitch_name = newVSwitch0
limit_cpu_features = false
config_drive_inject_password = false
qemu_img_cmd = C:\Program Files (x86)\OpenStack\Nova\bin\qemu-img.exe
config_drive_cdrom = true
dynamic_memory_ratio = 1
enable_instance_metrics_collection = true
[rdp]
enabled = true
html5_proxy_base_url = https://IP_ADDRESS:4430
The table Description of hyperv configuration options contains a reference of all options for hyper-v.
Hyper-V currently supports only the VHD and VHDX file format for virtual machine instances. Detailed instructions for installing virtual machines on Hyper-V can be found here:
Once you have successfully created a virtual machine, you can then upload the image to glance using the openstack-client:
PS C:\> openstack image create --name "VM_IMAGE_NAME" --property hypervisor_type=hyperv --public \
--container-format bare --disk-format vhd
Note
VHD and VHDX files sizes can be bigger than their maximum internal size, as such you need to boot instances using a flavor with a slightly bigger disk size than the internal size of the disk file. To create VHDs, use the following PowerShell cmdlet:
PS C:\> New-VHD DISK_NAME.vhd -SizeBytes VHD_SIZE
The interfaces.template
file describes the network interfaces and routes
available on your system and how to activate them. You can specify the
location of the file with the injected_network_template
configuration
option in /etc/nova/nova.conf
.
injected_network_template = PATH_TO_FILE
A default template exists in nova/virt/interfaces.template
.
To start the nova-compute
service, run this command from a console
in the Windows server:
PS C:\> C:\Python27\python.exe c:\Python27\Scripts\nova-compute --config-file c:\etc\nova\nova.conf
I ran the nova-manage service list command from my controller; however, I’m not seeing smiley faces for Hyper-V compute nodes, what do I do?
Verify that you are synchronized with a network time source. For instructions about how to configure NTP on your Hyper-V compute node, see Configure NTP.
How do I restart the compute service?
PS C:\> net stop nova-compute && net start nova-compute
How do I restart the iSCSI initiator service?
PS C:\> net stop msiscsi && net start msiscsi
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.