openstack-manuals/doc/image-guide/source/windows-image.rst
KATO Tomoyuki 79aa72b0cb [image-guide] Publish RST Vitual Machine Image Guide
Change-Id: I694301758f7f85290d4c9f9b01fbd1924b02b476
Implements: blueprint image-guide-rst
2015-11-23 19:49:51 +01:00

3.2 KiB

Example: Microsoft Windows image

This example creates a Windows Server 2012 qcow2 image, using virt-install and the KVM hypervisor.

  1. Follow these steps to prepare the installation:

    1. Download a Windows Server 2012 installation ISO. Evaluation images are available on the Microsoft website <http://www.microsoft.com/en-us/evalcenter/ evaluate-windows-server-2012> (registration required).

    2. Download the signed VirtIO drivers ISO from the Fedora website <https://fedoraproject.org/wiki/ Windows_Virtio_Drivers#Direct_download>.

    3. Create a 15 GB qcow2 image:

      $ qemu-img create -f qcow2 ws2012.qcow2 15G
  2. Start the Windows Server 2012 installation with the virt-install command:

    # virt-install --connect qemu:///system \
      --name ws2012 --ram 2048 --vcpus 2 \
      --network network=default,model=virtio \
      --disk path=ws2012.qcow2,format=qcow2,device=disk,bus=virtio \
      --cdrom /path/to/en_windows_server_2012_x64_dvd.iso \
      --disk path=/path/to/virtio-win-0.1-XX.iso,device=cdrom \
      --vnc --os-type windows --os-variant win2k8

    Use virt-manager or virt-viewer to connect to the VM and start the Windows installation.

  3. Enable the VirtIO drivers.

    The disk is not detected by default by the Windows installer. When requested to choose an installation target, click Load driver and browse the file system to select the E:\WIN8\AMD64 folder. The Windows installer displays a list of drivers to install. Select the VirtIO SCSI and network drivers, and continue the installation.

    Once the installation is completed, the VM restarts. Define a password for the administrator when prompted.

  4. Log in as administrator and start a command window.

  5. Complete the VirtIO drivers installation by running the following command:

    C:\pnputil -i -a E:\WIN8\AMD64\*.INF
  6. To allow Cloudbase-Init to run scripts during an instance boot, set the PowerShell execution policy to be unrestricted:

    C:\powershell
    C:\Set-ExecutionPolicy Unrestricted
  7. Download and install Cloudbase-Init:

    C:\Invoke-WebRequest -UseBasicParsing http://www.cloudbase.it/downloads/CloudbaseInitSetup_Stable_x64.msi -OutFile cloudbaseinit.msi
    C:\.\cloudbaseinit.msi

    In the configuration options window, change the following settings:

    • Username: Administrator
    • Network adapter to configure: Red Hat VirtIO Ethernet Adapter
    • Serial port for logging: COM1

    When the installation is done, in the Complete the Cloudbase-Init Setup Wizard window, select the Run Sysprep and Shutdown check boxes and click Finish.

    Wait for the machine shutdown.

Your image is ready to upload to the Image service:

$ glance image-create --name WS2012 --disk-format qcow2 \
  --container-format bare --is-public true \
  --file ws2012.qcow2