Skip to content

Instantly share code, notes, and snippets.

@DavidWittman
Last active January 1, 2020 22:41
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidWittman/7191804 to your computer and use it in GitHub Desktop.
Save DavidWittman/7191804 to your computer and use it in GitHub Desktop.

Create a Windows OpenStack VM with VirtualBox

0. Obtain Windows ISO

  • Use an existing ISO or copy from a CD with dd if=/dev/cdrom of=image.iso

1. Boot VirtualBox VM from Windows ISO

  • Qcow disk type
  • 40GB Root Disk
  • Load your Windows ISO to the Primary CD drive
  • Add a secondary CD drive and attach the VirtIO ISO to it

2. Proceed with Windows installation

  • Load VirtIO drivers from the attached ISO during the installation

3. Install Cloudbase-Init

[DEFAULT]
username=Admin
groups=Administrators
inject_user_password=true
plugins=cloudbaseinit.plugins.windows.sethostname.SetHostNamePlugin,cloudbaseinit.plugins.windows.createuser.CreateUserPlugin,cloudbaseinit.plugins.windows.networkconfig.NetworkConfigPlugin,cloudbaseinit.plugins.windows.sshpublickeys.SetUserSSHPublicKeysPlugin,cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,cloudbaseinit.plugins.windows.userdata.UserDataPlugin
network_adapter=
config_drive_raw_hhd=true
config_drive_cdrom=true
verbose=true
logdir=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\log\
logfile=cloudbase-init.log

4. Disable Windows Firewall

Firewall rules should be managed at the hypervisor with Security Groups.

5. Apply customizations to image

Install packages, add users, modify configurations, etc.

6. Run Windows Update

7. Run sysprep

C:\Windows\System32\sysprep\sysprep.exe /generalize /oobe /shutdown

8. Convert disk image

VirtualBox only supports Qcow images, not Qcow2, so we'll use qemu-img to convert the image to Qcow2 for use with OpenStack.

qemu-img convert -f qcow -O qcow2 windows.qcow windows.qcow2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment