• Stars
    star
    579
  • Rank 77,126 (Top 2 %)
  • Language
    PowerShell
  • License
    Apache License 2.0
  • Created about 11 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tools to automate the creation of a Windows image for OpenStack, supporting KVM, Hyper-V, ESXi and more.

Windows Imaging Tools

Master branch

Windows OpenStack Imaging Tools automates the generation of Windows images.
The tools are a bundle of PowerShell modules and scripts.

The supported target environments for the Windows images are:

  • OpenStack with KVM, Hyper-V, VMware and baremetal hypervisor types
  • MAAS with KVM, Hyper-V, VMware and baremetal

The generation environment needs to be a Windows one, with Hyper-V virtualization enabled.
If you plan to run the online Windows setup step on another system / hypervisor, the Hyper-V virtualization is not required.

The following versions of Windows images (both x86 / x64, if existent) to be generated are supported:

  • Windows Server 2008 / 2008 R2
  • Windows Server 2012 / 2012 R2
  • Windows Server 2016
  • Windows Server 2019
  • Windows Server 2022
  • Windows 7 / 8 / 8.1 / 10 / 11

To generate Windows Nano Server 2016, please use the following repository:

https://github.com/cloudbase/cloudbase-init-offline-install

Workflow of Windows imaging tools

Fast path to create a Windows image

Requirements:

  • A Windows host, with Hyper-V virtualization enabled, PowerShell >=v4 support
    and Windows Assessment and Deployment Kit (ADK)
  • A Windows installation ISO or DVD
  • Windows compatible drivers, if required by the target environment
  • Git environment

Steps to generate the Windows image

  • Clone this repository
  • Mount or extract the Windows ISO file
  • Download and / or extract the Windows compatible drivers
  • If the target environment is MAAS or the image generation is configured to install updates,
    the windows-curtin-hooks and WindowsUpdates git submodules are required.
    Run git submodule update --init to retrieve them
  • Import the WinImageBuilder.psm1 module
  • Use the New-WindowsCloudImage or New-WindowsOnlineCloudImage methods with
    the appropriate configuration file

PowerShell image generation example for OpenStack KVM (host requires Hyper-V enabled)

git clone https://github.com/cloudbase/windows-openstack-imaging-tools.git
pushd windows-openstack-imaging-tools
Import-Module .\WinImageBuilder.psm1
Import-Module .\Config.psm1
Import-Module .\UnattendResources\ini.psm1
# Create a config.ini file using the built in function, then set them accordingly to your needs
$ConfigFilePath = ".\config.ini"
New-WindowsImageConfig -ConfigFilePath $ConfigFilePath

# To automate the config options setting:
Set-IniFileValue -Path (Resolve-Path $ConfigFilePath) -Section "DEFAULT" `
                                      -Key "wim_file_path" `
                                      -Value "D:\Sources\install.wim"
# Use the desired command with the config file you just created

New-WindowsOnlineImage -ConfigFilePath $ConfigFilePath

popd

Image generation workflow

New-WindowsCloudImage

This command does not require Hyper-V to be enabled, but the generated image
is not ready to be deployed, as it needs to be started manually on another hypervisor.
The image is ready to be used when it shuts down.

You can find a PowerShell example to generate a raw OpenStack Ironic image that also works on KVM
in Examples/create-windows-cloud-image.ps1

New-WindowsOnlineImage

This command requires Hyper-V to be enabled, a VMSwitch to be configured for external
network connectivity if the updates are to be installed, which is highly recommended.

This command uses internally the New-WindowsCloudImage to generate the base image and
start a Hyper-V instance using the base image. After the Hyper-V instance shuts down,
the resulting VHDX is shrinked to a minimum size and converted to the required format.

You can find a PowerShell example to generate a raw OpenStack Ironic image that also works on KVM
in Examples/create-windows-online-cloud-image.ps1

Frequently Asked Questions (FAQ)

The image generation never stops

  • Make sure that the Hyper-V VMSwitch is correctly configured and it allows Internet connectivity
    if you have configured the image generation to install the Windows updates.
  • Check in the associated Hyper-V VM that the Logon.ps1 script has not failed.
    If the script failed, there should be a PowerShell window showing the error message.

I booted an instance with the image and I got a BSOD

  • This is the most common scenario that one can encounter and it is easily fixable.
  • If you boot on KVM hypervisor, make sure that you configure the correct path for the ISO/folder with VirtIO drivers.
    The configuration options are virtio_iso_path and virtio_base_path.
  • On the KVM hypervisor side, make sure you start the KVM vm process with the --enable-kvm flag.
  • If you boot on a baremetal machine, make sure that either the basic Windows installation has the storage drivers builtin
    or that you specify the proper path to drivers folder for the drivers_path configuration option.

I booted an instance with the image and I got a forever Windows loading screen

Useful links on ask.cloudbase.it

For developers

Running unit tests

You will need PowerShell Pester package installed on your system.

It should already be installed on your system if you are running Windows 10.
If it is not installed you can install it on Windows 10 or greater:

Install-Package Pester

or you can clone it from: https://github.com/pester/Pester

Running the tests in a closed environment:

cmd /c 'powershell.exe -NonInteractive { Invoke-Pester }'

This will run all tests without polluting your current shell environment.
This is not needed if you run it in a Continuous Integration environment.

More Repositories

1

powershell-yaml

PowerShell CmdLets for YAML format manipulation
PowerShell
420
star
2

cloudbase-init

Cross-platform instance initialization
Python
363
star
3

garm

GitHub Actions Runner Manager
Go
122
star
4

unattended-setup-scripts

Various unattended setup scripts and configuration files. Note: the content of this repo is mostly WiP for R&D. When scripts are ready they are usually moved to a dedicated repo.
PowerShell
100
star
5

coriolis

Cloud Migration as a Service
Python
98
star
6

qemu

Fork of git://git.qemu.org/qemu.git
C
80
star
7

FreeRDP-Windows-Build

FreeRDP Windows build scripts
PowerShell
74
star
8

salt-openstack

SaltStack
61
star
9

wnbd

Windows Ceph RBD NBD driver
C++
59
star
10

go-winrm

Golang WinRM package
Go
51
star
11

cloudbase-init-offline-install

PowerShell
41
star
12

vdi-broker

OpenStack VDI broker
Python
34
star
13

winrm-scripts

Scripts to configure and use WinRM certificate authentication
Python
23
star
14

PyMI

A blazing fast replacement for the Python WMI module
C++
20
star
15

aurora

A fresh OpenStack dashboard
CSS
18
star
16

WindowsUpdateCLI

Windows Update PowerShell tools
PowerShell
17
star
17

openvswitch-hyperv

Open vSwitch Hyper-V porting
C
17
star
18

kubinstaller

A desktop GUI for simplifying the deployment of Kubernetes clusters
JavaScript
15
star
19

windows-heat-templates

Windows OpenStack Heat templates
Shell
13
star
20

ceph-windows-installer

Ceph Windows Installer
PowerShell
13
star
21

openstack-rdo-scripts

RDO automation scripts
Shell
12
star
22

HyperVPCapExt

Hyper-V virtual switch packet capturing extension with libpcap / Wireshark format
C
12
star
23

VSKubernetes

Kubernetes extension for Visual Studio
C#
11
star
24

python-ovmclient

Python Oracle VM Client
Python
8
star
25

openstack-puppet-samples

OpenStack Puppet samples
Puppet
8
star
26

openvswitch-hyperv-kernel

Hyper-V Open vSwitch forwarding extension
C
7
star
27

v-magine

The easiest way to deploy OpenStack on Windows
JavaScript
7
star
28

cloudbase-init-ci

Continuous integration testing framework for Cloudbase-Init
Python
7
star
29

checkhypervisor

Utility to detect if the OS is running as a guest on a known hypervisor
C
7
star
30

cloudbase-init-installer

Cloudbase-Init MSI installer
Python
7
star
31

heat2arm

OpenStack Heat to Azure ARM template conversion tool
Python
7
star
32

adk-tools-maas

ADK tools for automated WinPE provisioning in MaaS
PowerShell
7
star
33

wmi

Python WMI module, clone from SVN repository: http://svn.timgolden.me.uk/wmi/trunk
Python
6
star
34

windows-curtin-hooks

Python
6
star
35

maas-hacks

Python
6
star
36

openstack-dashboard-cloudbase-theme

CSS
5
star
37

kolla-resources

OpenStack Kolla scripts and other resources
Shell
5
star
38

python-coriolisclient

Cloud Migration as a Service
Python
5
star
39

hyper-c

Hyper-Converged OpenStack Nano Server deployment tools
Python
5
star
40

cloudbase-init-test-resources

PowerShell
5
star
41

garm-provider-incus

Incus external provider for GARM
Go
5
star
42

EHS

Embedded HTTP Server (EHS) is a C++ class library which can be inherited from to add HTTP(S) server functionality to any class or application. It is easily extendable (samples included) and supports SSL, form data via POST or GET, uploads via multi-part form attachments and WebSockets. Operation modes include single- and multi-threaded operation. Forked from: http://sourceforge.net/projects/ehs/
C++
5
star
43

openvswitch-windows-port

Port of Open vSwitch 1.9.x to Microsoft Windows
C
5
star
44

rct-service

REST Service for the Hyper-V RCT API
Rust
4
star
45

gitpoll

Easy way to poll for changes on remote git repositories and execute url based actions
Python
4
star
46

maas

MaaS + Hyper-V
Python
4
star
47

garm-provider-aws

Garm external provider for EC2
Go
4
star
48

juju-powershell-modules

Juju Powershell utilities
HTML
4
star
49

nova-vix-driver

OpenStack Nova compute driver for VMware Workstation or Player (Windows, Linux) and Fusion (Mac OS X).
Python
4
star
50

nova-virtualbox

Nova VirtualBox driver
Python
3
star
51

coriolis-logger

Coriolis Logging
Go
3
star
52

neutron-virtualbox

Neutron VirtualBox agent
Python
3
star
53

libuuid

MinGW compatible libuuid
Shell
3
star
54

os-windows

Python
3
star
55

vdi-web

VDI web frontend
Java
3
star
56

puppet-nano-server

Puppet for Windows Nano Server
Ruby
3
star
57

garm-provider-lxd

LXD external provider for GARM
Go
3
star
58

openvswitch-hyperv-installer

Open vSwitch Hyper-V installer
PowerShell
3
star
59

FreeRDP-WebConnect-Installer

FreeRDP-WebConnect Windows installer
JavaScript
3
star
60

reBot

Plastic as a Service
Java
3
star
61

garm-provider-azure

Garm external provider for Azure
Go
3
star
62

VSSSnapshotCopy

Windows VSS backup file copy utility
C#
3
star
63

StackCraft

OpenStack on MineCraft!
Java
3
star
64

job-runner

Lightweight application created for running jobs on demand with a RESTful API interface and a scalable backend. Job queues are based on Zeromq.
Python
3
star
65

openstack-hyperv-release-tests

OpenStack Hyper-V integration testing tools
PowerShell
2
star
66

active-directory-charm

Active Directory Charm
PowerShell
2
star
67

arestor

Python
2
star
68

rpi-tensorflow-build

Raspberry Pi Dockerfiles for TensorFlow & co.
HCL
2
star
69

coriolis-web

Web UI for Coriolis
TypeScript
2
star
70

garm-provider-openstack

Garm external provider for OpenStack
Go
2
star
71

BMK

Shell
2
star
72

horizon-cloudbase

Cloudbase CSS and settings for Horizon
CSS
2
star
73

coriolis-ovm-exporter

Tools for Oracle VM snapshot management
Go
2
star
74

nova-ci

Hyper-V Nova CI
Shell
2
star
75

ovs-windows-installer

Open vSwitch Windows installer
JavaScript
2
star
76

FreeRDP-WebConnect-Packages

Binary packages and scripts for FreeRDP-WebConnect
2
star
77

ci-overcloud-init-scripts

Shell
2
star
78

SetUserAccountRights

Simple CLI for managing Windows user account rights, including Nano Server support
C++
2
star
79

hyperv-networking-ci

CI for networking-hyperv project
Shell
1
star
80

gh-auto-labeler

1
star
81

freerdp-charm

PowerShell
1
star
82

python-hnvclient

Python client for the HNV (Hyper-V Network Virtualization) REST API
Python
1
star
83

coriolis-snapshot-agent

Go
1
star
84

oswin-ci

OS-Win CI
Shell
1
star
85

coriolis-resources

PowerShell
1
star
86

nova-hyperv-charm

OpenStack Nova Hyper-V juju charm
PowerShell
1
star
87

k8s-operator-garm

1
star
88

aurora-core

TypeScript
1
star
89

cinder-ci

Cinder CI for iSCSI support on Microsoft Windows and SMB3 support on Windows and Linux
PowerShell
1
star
90

magnum-charm

Magnum Charm
Python
1
star
91

openstack-kolla-arm64-scripts

Deploy OpenStack with Kolla on ARM64
Shell
1
star
92

adk-tools

ADK image build automation scripts for Windows Server 2012 and Hyper-V Server 2012
PowerShell
1
star
93

android-emulator-ci

PowerShell
1
star
94

hyperv-compute-ci

CI for compute-hyperv project
Shell
1
star
95

garm-provider-equinix

Equinix Metal external provider for GARM
Go
1
star
96

garm-provider-common

Common functionality for GARM providers
Go
1
star
97

cloudbase-init-packer-scripts

Packer scripts for creation of Windows images with cloudbase-init
PowerShell
1
star
98

nova-guest-agent

Python
1
star
99

windows-charms-boilerplate

Boilerplate template for Windows Juju charms
PowerShell
1
star
100

openstack-dev-scripts

Some basic time saving scripts
Shell
1
star