Warning
Please note that the preferred way to build images is to use Automated Build described in the previous chapter.
Get Post-Install Scripts
There are a few scripts which perform all the required post-installation tasks.
Package installation tasks are performed by script named wpi.ps1.
Download it from https://raw.github.com/stackforge/murano-deployment/master/image-builder/share/scripts/ws-2012-std/wpi.ps1
Note
There are a few scripts named wpi.ps1, each supports only one version of Windows image. The script above is intended to be used to create Windows Server 2012 Standard. To build other version of Windows please use appropriate script from scripts folder.
Clean-up actions to finish image preparation are performed by Start-Sysprep.ps1 script.
Download it from https://raw.github.com/stackforge/murano-deployment/master/image-builder/share/scripts/ws-2012-std/Start-Sysprep.ps1
These scripts should be copied to the shared resource folder, subfolder Scripts.
Create a VM
This section describes steps required to build an image of Windows Virtual Machine which could be used with Murano. There are two possible ways to create it - from CLI or using GUI tools. We describe both in this section.
Note
Run all commands as root.
Way 1: Using CLI Tools
This section describes the required step to launch a VM using CLI tools only.
Preallocate disk image
># qemu-img create -f raw /var/lib/libvirt/images/ws-2012.img 40G
Start the VM
># virt-install --connect qemu:///system --hvm --name WinServ \ --ram 2048 --vcpus 2 --cdrom /opt/samba/share/9200.16384.WIN8_RTM\ .120725-1247_X64FRE_SERVER_EVAL_EN-US-HRM_SSS_X64FREE_EN-US_DV5.ISO \ --disk path=/opt/samba/share/virtio-win-0.1-52.iso,device=cdrom \ --disk path=/opt/samba/share/floppy.img,device=floppy \ --disk path=/var/lib/libvirt/images/ws-2012.qcow2\ ,format=qcow2,bus=virtio,cache=none \ --network network=default,model=virtio \ --memballoon model=virtio --vnc --os-type=windows \ --os-variant=win2k8 --noautoconsole \ --accelerate --noapic --keymap=en-us --video=cirrus --force
Way 2: Using virt-manager UI
A VM also could be lauched via GUI tools like virt-manager.
Launch virt-manager from shell as root
Set a name for VM and select Local install media
Add one cdrom and attach Windows Server ISO image to it
Select OS type Windows and it's version Windows Server 2008
Set CPU and RAM amount
Deselect option Enable storage for this virtual machine
Select option Customize configuration before install
Add second cdrom for ISO image with virtio drivers
Add a floppy drive and attach our floppy image to it
Add (or create new) HDD image with Disk bus VirtIO and storage format RAW
Set network device model VirtIO
Start installation process and open guest vm screen through Console button
Convert the image from RAW to QCOW2 format. The image must be converted from RAW format to QCOW2 before being imorted into Glance.
># qemu-img convert -O qcow2 /var/lib/libvirt/images/ws-2012.raw \ /var/lib/libvirt/images/ws-2012-ref.qcow2