Update Image Builder documentation

Update formatting.
Fix multiple inconsistiences.
Rewrite some chapters.

Change-Id: Idda8f2849f966617f3c5d3ea9e2dec2da4850ef3
This commit is contained in:
Dmitry Teselkin 2014-08-14 17:26:00 +04:00
parent cf995586e0
commit 363db312ee
3 changed files with 500 additions and 488 deletions

View File

@ -17,210 +17,67 @@
Linux Image
===========
**Create a VM**
At the moment the best way to build a Linux image with Murano agent is
to use disk image builder.
This section describes steps required to build an image of Linux 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**
.. note::
Run all commands as root.
Disk image builder requires sudo rights
**Way 1: Using CLI Tools**
This section describes the required step to launch a VM using CLI tools
only.
The process is quite simple. Let's assume that you use a directory ~/git
for cloning git repositories:
1. Preallocate disk image
.. code-block:: console
::
$ export GITDIR=~/git
$ mkdir -p $GITDIR
># qemu-img create -f qcow2 /var/lib/libvirt/images/cloud-linux.img 10G
Clone the components required to build an image to that directory:
2. Start the VM
.. code-block:: console
::
$ cd $GITDIR
$ git clone https://github.com/stackforge/murano
$ git clone https://github.com/stachforge/murano-agent
$ git clone https://github.com/openstack/diskimage-builder
># virt-install --connect qemu:///system --hvm --name cloud-linux \
--ram 2048 --vcpus 2 --cdrom /PATH_TO_YOUR_LINUX.ISO \
--disk path=/var/lib/libvirt/images/cloud-linux.img, \
format=qcow2,bus=virtio,cache=none \
--network network=default,model=virtio \
--memballoon model=virtio --vnc --os-type=linux \
--accelerate --noapic --keymap=en-us --video=cirrus --force
**Way 2: Using virt-manager UI**
Checkout a change request that allows to build an image using disk image builder
completely installed to virtual environment:
A VM also could be lauched via GUI tools like virt-manager.
.. code-block:: console
1. Launch *virt-manager* from shell as root
$ cd $GITDIR/diskimage-builder
$ git fetch https://review.openstack.org/openstack/diskimage-builder refs/changes/02/168002/2 && git checkout FETCH_HEAD
2. Set a name for VM and select Local install media
3. Add one cdrom and attach your linux ISO image to it
Install additional packages required by disk image builder:
4. Select OS type **Linux** and it's version **choose yours**
.. code-block:: console
5. Set CPU and RAM amount
$ sudo apt-get install qemu-utils curl python-tox
6. Deselect option **Enable storage for this virtual machine**
7. Select option **Customize configuration before install**
Export paths where additional dib elements are located:
8. Add (or create new) HDD image with Disk bus **VirtIO** and storage
format **QCOW2**
.. code-block:: console
9. Set network device model **VirtIO**
$ export ELEMENTS_PATH=$GITDIR/murano/contrib/elements:$GITDIR/murano-agent/contrib/elements
10. Start installation process and open guest vm screen through
**Console** button
Guest VM Linux OS preparation
=============================
And build Ubuntu-based image with Murano agent:
**Ubuntu 12.04 LTS x86\_64**
.. code-block:: console
::
$ cd $GITDIR/diskimage-builder
$ tox -e venv -- disk-image-create vm ubuntu murano-agent -o ../murano-agent.qcow2
># for action in update upgrade dist-upgrade;do apt-get -y $action;done
># apt-get install -y git unzip make cmake gcc python-dev python-pip openssh-server sudo
If you need Fedora based image replace 'ubuntu' to 'fedora' in the last command.
**CentOS 6.4 x86\_64**
::
># rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
># for action in update upgrade;do yum -y $action; done
># yum install -y git unzip make cmake gcc python-devel python-pip openssh-server openssh-clients sudo
**murano-agent installation steps**
::
># mkdir -p /opt/git
># cd /opt/git
># git clone https://github.com/stackforge/murano-agent.git
># cd murano-agent/python-agent
># git checkout release-0.5
># chmod a+x setup*.sh
# To install Murano Agent on run the following command:
- **Ubuntu**
># ./setup.sh install
- **CentOS**
># ./setup-centos.sh install
**cloud-init installation steps**
- **Ubuntu**
::
># apt-get install -y cloud-init cloud-initramfs-growroot
- **CentOS**
::
># yum install -y cloud-init
**Note**
**Ubuntu only**
::
># dpkg-reconfigure cloud-init
Mark **EC2** data source support, save and exit or add manualy
**Ec2** to the datasource\_list variable in the
/etc/cloud/cloud.cfg.d/90\_dfkg.cfg
- **Minimal cloud-init configuration options**
::
># vi /etc/cloud/cloud.cfg:
user: ec2-user
disable_root: 1
preserve_hostname: False
**Security setup**
Create user and make it able to run commands through sudo without
password prompt.
- **Ubuntu**
::
># useradd -m -G sudo -s /bin/bash ec2-user
># passwd ec2-user
- **CentOS**
::
># useradd -m -G wheel -s /bin/bash ec2-user
># passwd ec2-user
- **Sudo**
::
># echo "ec2-user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ec2-user
># chmod 440 /etc/sudoers.d/ec2-user
**Disable SSH password-based logins in the /etc/ssh/sshd\_config.**
::
...
GSSAPIAuthentication no
PasswordAuthentication no
PermitRootLogin no
...
</itemizedlist> </para>
**Network handling**
- **Ubuntu**
::
># rm -rf /etc/udev/rules.d/70-persistent-net.rules
- **CentOS** Remove or comment out HWADDR and UUID in
/etc/sysconfig/network-scripts/ifcfg-eth\*
::
># rm -rf /etc/udev/rules.d/70-persistent-net.rules
**Shutdown VM**
**Convert the image from RAW to QCOW2 format if you made it as RAW.**
The image must be converted from RAW format to QCOW2 before being
imorted into Glance.
::
># qemu-img convert -O qcow2 /var/lib/libvirt/images/cloud-linux.img \
/var/lib/libvirt/images/cloud-linux.img.qcow2
It'll take a while (up to 30 minutes if your hard drive and internet connection are slow).
When done upload murano-agent.qcow2 image to Glance and play :)

View File

@ -13,69 +13,93 @@
License for the specific language governing permissions and limitations
under the License.
========================
Upload Image Into Glance
========================
To deploy applications with Murano, virtual machine images should be uploaded into Glance in a special way - *murano_image_info* property should be set
To deploy applications with Murano, virtual machine images should be uploaded into Glance in a special way - *murano_image_info* property should be set.
1. Use the glance image-create command to import your disk image to
Glance:
1. Use the glance image-create command to import your disk image to Glance:
::
.. code-block:: console
>$ glance image-create --name <NAME> --is-public true --disk-format qcow2 --container-format bare --file <IMAGE_FILE> --property <IMAGE_METADATA>
$ glance image-create --name <NAME> --is-public true \
> --disk-format qcow2 --container-format bare \
> --file <IMAGE_FILE> --property <IMAGE_METADATA>
..
Replace the command line arguments to glance image-create with the
appropriate values for your environment and disk image:
Replace the command line arguments to glance image-create with the appropriate values for your environment and disk image:
* Replace **<NAME>** with the name that users will refer to the disk
image by. E.g. '**ws-2012-std**\ '
* Replace **<NAME>** with the name that users will refer to the disk image by. E.g. **ws-2012-std**
* Replace **<IMAGE\_FILE>** with the local path to the image file to
upload. E.g. '**ws-2012-std.qcow2**\ '.
* Replace **<IMAGE_FILE>** with the local path to the image file to upload. E.g. **ws-2012-std.qcow2**.
* Replace **<IMAGE\_METADATA>** with the following property string
* Replace **<IMAGE_METADATA>** with the following property string
::
.. code-block:: text
murano_image_info='{"title": "Windows 2012 Standart Edition", "type": "windows.2012"}'
..
where
where:
* title - user-friendly description of the image
* type - is a image type, for example 'windows.2012'
* **title** - user-friendly description of the image
* **type** - murano image type, see :ref:`murano_image_types`
2. To update metadata of the existing image run the command:
::
.. code-block:: console
>$ glance image-update <IMAGE-ID> --property <IMAGE_MATADATA>
$ glance image-update <IMAGE_ID> --property <IMAGE_MATADATA>
..
* Replace **<IMAGE-ID>** with image id from the previous command
output.
* Replace **<IMAGE_ID>** with image id from the previous command output.
* Replace **<IMAGE\_METADATA>** with murano\_image\_info property, e.g.
* Replace **<IMAGE_METADATA>** with murano_image_info property, e.g.
::
.. code-block:: text
murano_image_info='{"title": "Windows 2012 Standart Edition", "type": "windows.2012"}'
..
**Warning**
.. warning::
The value of the **--property** argument named
**murano\_image\_info** is a JSON string. Only double quotes are
valid in JSON, so please type the string exactly as in the example
above.
The value of the **--property** argument (named **murano_image_info**) is a JSON string.
Only double quotes are valid in JSON, so please type the string exactly as in the example above.
..
**Note**
.. note::
Already existing image could be marked in a simple way in Horizon UI with Murano dashboard installed. Navigate to *Murano -> Manage -> Images -> Mark Image* and fill up a form:
Already existing image could be marked in a simple way in Horizon UI with Murano dashboard installed.
Navigate to *Murano -> Manage -> Images -> Mark Image* and fill up a form:
- **Image** - ws-2012-std
- **Title** - My Prepared Image
- **Type** - Windows Server 2012
* **Image** - ws-2012-std
* **Title** - My Prepared Image
* **Type** - Windows Server 2012
..
After these steps desired image can be chosen in application creation wizard.
.. _murano_image_types:
Murano Image Types
------------------
.. list-table::
:header-rows: 1
* - Type Name
- Description
* - windows.2012
- Windows Server 2012
* - linux
- Generic Linux images, Ubuntu / Debian, RedHat / Centos, etc
* - cirrus.demo
- Murano demo image, based on CirrOS
..

View File

@ -13,283 +13,98 @@
License for the specific language governing permissions and limitations
under the License.
=============
Windows Image
=============
Murano requires a Windows Image in QCOW2 format to be builded and
uploaded into Glance.
Murano requires a Windows Image in QCOW2 format to be built and uploaded into Glance.
The easiest way to build Windows image for Murano is to build it on the
host where your OpenStack is installed.
The easiest way to build Windows image for Murano is to build it on the host where your OpenStack is installed.
Install Required Packages
=========================
**Note**
Please check that hardware virtualization supported and enabled in
BIOS.
Prepare Image Builder Host
==========================
The following packages should be installed on any host which will be
used to build Windows Image:
* ipxe-qemu
* kvm-ipxe
* qemu-kvm
* munin-libvirt-plugins
* python-libvirt
* virt-goodies
* virt-manager
* virt-top
* virt-what
* virtinst
* python
Install KVM
-----------
On Ubuntu you could install them using the command below:
.. note::
::
This guide was tested on Ubuntu Server 12.04 x64.
..
KVM is a default hypervisor in OpenStack, so our build scripts are targeted to this hypervisor only. It may change in future, though.
Install KVM and some additional packages that are required by our scripts
.. code-block:: console
# apt-get install qemu-kvm virtinst virt-manager
..
Check that your hardware supports hardware virtualization.
.. code-block:: console
$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
..
If your output differs, check that harware virtualization is enabled in your BIOS settings. You also could try import KVM kernel module
.. code-block:: console
$ sudo modprobe kvm-intel
..
or
.. code-block:: cosole
$ sudo modprobe kvm-amd
..
It might be helpful to add an appropriate module name into **/etc/modules** file to auto-load it during system boot. Sometimes it is required on Ubuntu systems.
># apt-get install ipxe-qemu kvm-ipxe qemu-kvm virt-goodies \
virtinst virt-manager libvirt0 libvirt-bin \
munin-libvirt-plugins python python-libvirt \
python-libxml2 python-minimal python-pycurl \
python-pyorbit python-requests python-six \
samba samba-common openssh-server virt-top virt-what
Configure Shared Resource
=========================
**Configure samba based share.**
Murano Image Builder uses a shared folder located on the host system as an installation source for components.
Makefile from image builder will copy required files to their locations, but you have to manually configure samba share.
To do this, use the steps below.
::
* Install samba
># mkdir -p /opt/samba/share
># chown -R nobody:nogroup /opt/samba/share
.. code-block:: console
**Configure samba server (/etc/samba/smb.conf).**
# apt-get install samba
..
::
* Create folder that will be shared
.. code-block:: console
# mkdir -p /opt/samba/share
# chown -R nobody:nogroup /opt/samba/share
..
* Configure samba server (/etc/samba/smb.conf)
.. code-block:: text
:linenos:
...
[global]
...
security = user
security = share
...
[share]
comment = Deployment Share
path = /opt/samba/share
browsable = yes
read only = no
create mask = 0755
guest ok = yes
guest account = nobody
...
**Restart services.**
::
># service smbd restart
># service nmbd restart
Prerequisites
===============
Download the files below and copy them into their places in your
**${SHARE\_PATH}** folder (we usually use **/opt/samba/share** as
**${SHARE\_PATH}**):
* *Windows 2012 Server ISO evaluation version*
* ${SHARE\_PATH}/libvirt/images/ws-2012-eval.iso
* `http://technet.microsoft.com/en-us/evalcenter/hh670538.aspx`_
* *VirtIO drivers for Windows*
* ${SHARE\_PATH}/libvirt/images/virtio-win-0.1-74.iso
* `http://alt.fedoraproject.org/pub/alt/virtio-win/stable/virtio-win-0.1-74.iso`_
* *CloudBase-Init for Windows*
* ${SHARE\_PATH}/share/files/CloudbaseInitSetup\_Beta.msi
* `https://www.cloudbase.it/downloads/CloudbaseInitSetup_Beta.msi`_
* *Far Manager*
* ${SHARE\_PATH}/share/files/Far30b3367.x64.20130717.msi
* `http://www.farmanager.com/files/Far30b3525.x64.20130717.msi`_
* Git client
* ${SHARE\_PATH}/share/files/Git-1.8.1.2-preview20130601.exe
* `https://msysgit.googlecode.com/files/Git-1.8.3-preview20130601.exe`_
* *Sysinternals Suite*
* ${SHARE\_PATH}/share/files/SysinternalsSuite.zip
* `http://download.sysinternals.com/files/SysinternalsSuite.zip`_
* *unzip.exe tool*
* ${SHARE\_PATH}/share/files/unzip.exe
* `https://www.dropbox.com/sh/zthldcxnp6r4flm/AACwiyfcrlGDt3ygCFHrbwMra/unzip.exe`_
* *PowerShell v3*
* ${SHARE\_PATH}/share/files/Windows6.1-KB2506143-x64.msu
* `http://www.microsoft.com/en-us/download/details.aspx?id=34595`_
* *.NET 4.0*
* ${SHARE\_PATH}/share/files/dotNetFx40\_Full\_x86\_x64.exe
* `http://www.microsoft.com/en-us/download/details.aspx?id=17718`_
* *.NET 4.5*
* ${SHARE\_PATH}/share/files/dotNetFx45\_Full\_setup.exe
* `http://www.microsoft.com/en-us/download/details.aspx?id=30653`_
* *Murano Agent*
* ${SHARE\_PATH}/share/files/MuranoAgent.zip
* `https://www.dropbox.com/sh/zthldcxnp6r4flm/AADh6LkVkcw2j8nKZevqedHja/MuranoAgent.zip`_
.. _`http://technet.microsoft.com/en-us/evalcenter/hh670538.aspx`: http://technet.microsoft.com/en-us/evalcenter/hh670538.aspx
.. _`http://alt.fedoraproject.org/pub/alt/virtio-win/stable/virtio-win-0.1-74.iso`: http://alt.fedoraproject.org/pub/alt/virtio-win/stable/virtio-win-0.1-74.iso
.. _`https://www.cloudbase.it/downloads/CloudbaseInitSetup_Beta.msi`: https://www.cloudbase.it/downloads/CloudbaseInitSetup_Beta.msi
.. _`http://www.farmanager.com/files/Far30b3525.x64.20130717.msi`: http://www.farmanager.com/files/Far30b3525.x64.20130717.msi
.. _`https://msysgit.googlecode.com/files/Git-1.8.3-preview20130601.exe`: https://msysgit.googlecode.com/files/Git-1.8.3-preview20130601.exe
.. _`http://download.sysinternals.com/files/SysinternalsSuite.zip`: http://download.sysinternals.com/files/SysinternalsSuite.zip
.. _`https://www.dropbox.com/sh/zthldcxnp6r4flm/AACwiyfcrlGDt3ygCFHrbwMra/unzip.exe`: https://www.dropbox.com/sh/zthldcxnp6r4flm/AACwiyfcrlGDt3ygCFHrbwMra/unzip.exe
.. _`http://www.microsoft.com/en-us/download/details.aspx?id=34595`: http://www.microsoft.com/en-us/download/details.aspx?id=34595
.. _`http://www.microsoft.com/en-us/download/details.aspx?id=17718`: http://www.microsoft.com/en-us/download/details.aspx?id=17718
.. _`http://www.microsoft.com/en-us/download/details.aspx?id=30653`: http://www.microsoft.com/en-us/download/details.aspx?id=30653
.. _`https://www.dropbox.com/sh/zthldcxnp6r4flm/AADh6LkVkcw2j8nKZevqedHja/MuranoAgent.zip`: https://www.dropbox.com/sh/zthldcxnp6r4flm/AADh6LkVkcw2j8nKZevqedHja/MuranoAgent.zip
Additional Software
===================
This section describes additional software which is required to build an
Windows Image.
**Windows ADK**
*Windows Assessment and Deployment Kit (ADK) for Windows® 8* is required
to build your own answer files for auto unattended Windows installation.
You can dowload it from `http://www.microsoft.com/en-us/download/details.aspx?id=30652`_.
**PuTTY**
PuTTY is a useful tool to manage your Linux boxes via SSH.
You can download it from
`http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html`_.
**Windows Server ISO image**
We use the following Windows installation images:
* Windows Server 2008 R2
* Image Name:
7601.17514.101119-1850\_x64fre\_server\_eval\_en-us-GRMSXEVAL\_EN\_DVD.iso
* URL:
`http://www.microsoft.com/en-us/download/details.aspx?id=11093`_
* Windows Server 2012
* Image Name:
9200.16384.WIN8\_RTM.120725-1247\_X64FRE\_SERVER\_EVAL\_EN-US-HRM\_SSS\_X64FREE\_EN-US\_DV5.iso
* URL:
`http://technet.microsoft.com/en-US/evalcenter/hh670538.aspx?ocid=&wt.mc\_id=TEC\_108\_1\_33`_
**VirtIO Red Hat drivers ISO image**
**Warning**
Please, choose stable version instead of latest, Weve got errors
with unstable drivers during guest unattended install.
Download drivers from
`http://alt.fedoraproject.org/pub/alt/virtio-win/stable/`_
**Floppy Image With Unattended File**
Run following commands as root:
1. Create emtpy floppy image in your home folder
::
># dd bs=512 count=2880 \
if=/dev/zero of=~/floppy.img \
mkfs.msdos ~/floppy.img
2. Mount the image to **/media/floppy**
::
># mkdir /media/floppy mount -o loop \
~/floppy.img /media/floppy
3. Download **autounattend.xml** file from
`https://raw.githubusercontent.com/stackforge/murano-deployment/master/image-builder/share/files/ws-2012-std/autounattend.xml.template`_
::
># cd ~
># wget https://raw.githubusercontent.com/stackforge/murano-deployment/master/image-builder/share/files/ws-2012-std/autounattend.xml.template
4. Copy our **autounattend.xml** to **/media/floppy**
::
># cp ~/autounattend.xml /media/floppy
5. Unmount the image
::
># umount /media/floppy
.. _`http://www.microsoft.com/en-us/download/details.aspx?id=30652`: http://www.microsoft.com/en-us/download/details.aspx?id=30652
.. _`http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html`: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
.. _`http://www.microsoft.com/en-us/download/details.aspx?id=11093`: http://www.microsoft.com/en-us/download/details.aspx?id=11093
.. _`http://technet.microsoft.com/en-US/evalcenter/hh670538.aspx?ocid=&wt.mc\_id=TEC\_108\_1\_33`: http://technet.microsoft.com/en-US/evalcenter/hh670538.aspx?ocid=&wt.mc\_id=TEC\_108\_1\_33
.. _`http://alt.fedoraproject.org/pub/alt/virtio-win/stable/`: http://alt.fedoraproject.org/pub/alt/virtio-win/stable/
.. _`https://raw.githubusercontent.com/stackforge/murano-deployment/master/image-builder/share/files/ws-2012-std/autounattend.xml.template`: https://raw.githubusercontent.com/stackforge/murano-deployment/master/image-builder/share/files/ws-2012-std/autounattend.xml.template
Build Windows Image (Automatic Way)
===================================
1. Clone **murano-deployment** repository
::
># git clone git://github.com/stackforge/murano-deployment.git
2. Change directory to **murano-deployment/image-builder** folder.
3. Create folder structure for image builder
::
># make build-root
4. Create shared resource
**Add to /etc/samba/smb.conf.**
::
[image-builder-share]
comment = Image Builder Share
browsable = yes
@ -298,109 +113,355 @@ Build Windows Image (Automatic Way)
guest user = nobody
read only = no
create mask = 0755
...
..
**Restart samba services.**
* Restart samba services
::
.. code-block:: console
># restart smbd && restart nmbd
# service smbd restart
# service nmbd restart
..
5. Test that all required files are in place
::
># make test-build-files
Download Prerequisites
======================
6. Get list of available images
::
.. _windows_installation_iso:
># make
Windows Server Installation ISO
-------------------------------
7. Run image build process
.. list-table::
:header-rows: 1
:widths: 30, 15, 55
::
* - Windows Version
- Version String
- Save to
># make ws-2012-std
* - Windows Server 2008 R2 [#win2k8r2_link]_
- 6.1.7601
- /opt/image-builder/share/libvirt/images/ws-2008-eval.iso
8. Wait until process finishes
* - Windows Server 2012 [#win2k12_link]_
- 6.3.9200
- /opt/image-builder/share/libvirt/images/ws-2012-eval.iso
..
9. The image file **ws-2012-std.qcow2** should be stored under
**/opt/image-builder/share/images** folder.
.. warning::
Build Windows Image (Manual Way)
================================
Windows Server 2008 R2 must include Service Pack 1 updates. This is required to install PowerShell V3 which is required by Murano Agent.
..
**Warning**
|
.. [#win2k8r2_link] http://www.microsoft.com/en-us/download/details.aspx?id=11093
.. [#win2k12_link] http://technet.microsoft.com/en-US/evalcenter/hh670538.aspx?ocid=&wt.mc_id=TEC_108_1_33
Please note that the preferred way to build images is to use
**Automated Build** described in the previous chapter.
**Get Post-Install Scripts**
.. _required_prerequisites:
There are a few scripts which perform all the required post-installation
tasks.
Required Components
-------------------
Package installation tasks are performed by script named **wpi.ps1**.
.. list-table::
:header-rows: 1
:widths: 30, 70
Download it from `https://raw.github.com/stackforge/murano-deployment/master/image-builder/share/scripts/ws-2012-std/wpi.ps1`_
* - Component
- Save to
**Note**
* - VirtIO drivers for Windows [#virtio_iso_link]_
- /opt/image-builder/share/libvirt/images/virtio-win-0.1-74.iso
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.
* - CloudBase-Init for Windows [#cloudbase_init_link]_
- /opt/image-builder/share/files/CloudbaseInitSetup_Beta.msi
Clean-up actions to finish image preparation are performed by
**Start-Sysprep.ps1** script.
* - .NET 4.0 [#dot_net_40_link]_
- /opt/image-builder/share/files/dotNetFx40_Full_x86_x64.exe
Download it from `https://raw.github.com/stackforge/murano-deployment/master/image-builder/share/scripts/ws-2012-std/Start-Sysprep.ps1`_
* - PowerShell v3 [#powershell_v3_link]_
- /opt/image-builder/share/files/Windows6.1-KB2506143-x64.msu
These scripts should be copied to the shared resource folder, subfolder
**Scripts**.
* - Murano Agent [#murano_agent_link]_
- /opt/image-builder/share/files/MuranoAgent.zip
**Create a VM**
* - Git client [#msysgit_link]_
- /opt/image-builder/share/files/Git-1.8.1.2-preview20130601.exe
..
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.
.. warning::
**Note**
PowerShell V3 is a **mandatory** prerequisite. It is required by Murano Agent. To check your PowerShell version use PowerShell command *Get-Host*.
..
Run all commands as root.
.. warning::
**Way 1: Using CLI Tools**
When downloading VirtIO drivers choose only stable versions.
Unstable versions might lead to errors during guest unattended installation.
You can check the latest version avaible here: http://alt.fedoraproject.org/pub/alt/virtio-win/stable
..
This section describes the required step to launch a VM using CLI tools
only.
|
.. [#ws2012iso_link] http://technet.microsoft.com/en-us/evalcenter/hh670538.aspx
.. [#virtio_iso_link] http://alt.fedoraproject.org/pub/alt/virtio-win/stable/virtio-win-0.1-74.iso
.. [#cloudbase_init_link] https://www.cloudbase.it/downloads/CloudbaseInitSetup_Beta.msi
.. [#dot_net_40_link] http://www.microsoft.com/en-us/download/details.aspx?id=17718
.. [#powershell_v3_link] http://www.microsoft.com/en-us/download/details.aspx?id=34595
.. [#murano_agent_link] https://www.dropbox.com/sh/zthldcxnp6r4flm/AADh6LkVkcw2j8nKZevqedHja/MuranoAgent.zip
.. [#msysgit_link] https://msysgit.googlecode.com/files/Git-1.8.3-preview20130601.exe
.. _optional_prerequisites:
Optional Components
-------------------
These components are not mandatory for Murano Agent to function properly.
However, they may help you work with the image after deployment.
.. list-table::
:header-rows: 1
:widths: 30, 70
* - Component
- Save to
* - Far Manager [#far_manager_link]_
- /opt/image-builder/share/files/Far30b3367.x64.20130717.msi
* - Sysinternals Suite [#sysinternals_link]_
- /opt/image-builder/share/files/SysinternalsSuite.zip
* - unzip.exe [#unzip_link]_
- /opt/image-builder/share/files/unzip.exe
* - .NET 4.5 [#dot_net_45_link]_
- /opt/image-builder/share/files/dotNetFx45_Full_setup.exe
..
|
.. [#far_manager_link] http://www.farmanager.com/files/Far30b3525.x64.20130717.msi
.. [#sysinternals_link] http://download.sysinternals.com/files/SysinternalsSuite.zip
.. [#unzip_link] https://www.dropbox.com/sh/zthldcxnp6r4flm/AACwiyfcrlGDt3ygCFHrbwMra/unzip.exe
.. [#dot_net_45_link] http://www.microsoft.com/en-us/download/details.aspx?id=30653
Additional Tools
================
Tools from this section are not necessary to build an image.
However, they may be helpful if you want to create an image with different configuration.
Windows Assessment and Deployment Kit (ADK)
-------------------------------------------
*Windows ADK* is required if you want to build your own answer files for auto unattended Windows installation.
Download it from http://www.microsoft.com/en-us/download/details.aspx?id=30652
Floppy Image With Unattended File
---------------------------------
Floppy image with answer file for unattended installation is needed to automate Windows installation process.
* Create emtpy floppy image in your home folder
.. code-block:: console
$ mkdir ~/flp/files
$ mkdir ~/flp/mnt
..
.. code-block:: console
$ dd bs=512 count=2880 if=/dev/zero of=~/flp/floppy.img
$ mkfs.msdos ~/flp/floppy.img
..
* Mount the image
.. code-block:: console
$ mkdir ~/flp/mnt
$ sudo mount -o loop ~/floppy.img ~/flp/mnt
..
* Download **autounattend.xml.template** file from https://github.com/stackforge/murano-deployment/tree/master/contrib/windows/image-builder/share/files
This folder contains unatteded files for several Windows versions, choose one that matches your Windows version.
* Copy that file to mounted floppy image
.. code-block:: console
$ cp ~/autounattend.xml.template ~/flp/mnt/autounattend.xml
..
* Replace string **%_IMAGE_BUILDER_IP_%** in that file with **192.168.122.1**
* Unmount the image
.. code-block:: console
$ sudo umount ~/flp/mnt
..
Build Windows Image with Murano
===============================
.. _build_image_using_image_builder_scripts:
Build Windows Image Using Image Builder Script
----------------------------------------------
* Clone **murano-deployment** repository
.. code-block:: console
$ git clone git://github.com/stackforge/murano-deployment.git
..
* Change directory to image-builder folder
.. code-block:: console
$ cd murano-deployment/contrib/windows/image-builder
..
* Create folder structure for image builder
.. code-block:: console
$ sudo make build-root
..
* Download build prerequisites, and copy them to correct folders
* :ref:`windows_installation_iso`
* :ref:`required_prerequisites`
* :ref:`optional_prerequisites` (Optional)
* Test that all required files are in place
.. code-block:: console
$ sudo make test-build-files
..
* Get list of available images
.. code-block:: console
$ make
..
* Run image build process (e.g. to build Windows Server 2012)
.. code-block:: console
$ sudo make ws-2012-std
..
* Wait until process finishes
* The image file **ws-2012-std.qcow2** should be stored inside **/opt/image-builder/share/images** folder.
Build Windows Image Manualy
---------------------------
.. note::
Please note that the preferred way to build images is to use Image Builder scripts, see :ref:`build_image_using_image_builder_scripts`
..
Get Post-Install Scripts
------------------------
There are a few scripts which perform all the required post-installation tasks.
They all are located in https://github.com/stackforge/murano-deployment/tree/master/contrib/windows/image-builder/share/scripts
.. note::
There are subfolders for each supported Windows Version.
Choose one that matches Windows Version you are building.
..
This folder contains several scripts
.. list-table::
:header-rows: 1
:widths: 20, 80
* - Script Name
- Description
* - wpi.ps1
- Handles component installation and system configuration tasks
* - Start-Sysprep.ps1
- Prepares system to be syspreped (cleans log files, stops some services and so on), and starts sysprep
* - Start-AtFirstBoot.ps1
- Performes basic after-installation tasks
..
Download these scripts and save them into /opt/image-builder/share/scripts
Create a VM
-----------
Now you need a virtual machine instance. There are two possible ways to create it - using CLI or GUI tools. We describe both in this section.
Using CLI Tools
^^^^^^^^^^^^^^^
1. Preallocate disk image
::
.. code-block:: console
># qemu-img create -f raw /var/lib/libvirt/images/ws-2012.img 40G
$ qemu-img create -f raw /var/lib/libvirt/images/ws-2012.img 40G
..
2. Start the VM
::
.. code-block:: console
># 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
# 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.
Using virt-manager UI
^^^^^^^^^^^^^^^^^^^^^
1. Launch *virt-manager* from shell as root
@ -424,15 +485,85 @@ A VM also could be lauched via GUI tools like virt-manager.
11. 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
imported into Glance.
Install OS
----------
::
Launch your virtual machine, connect to its virtual console and complete OS installation. At the end of this step you should have Windows Server system that you are able to log into.
># qemu-img convert -O qcow2 /var/lib/libvirt/images/ws-2012.raw \
/var/lib/libvirt/images/ws-2012-ref.qcow2
Install Prerequisites and Murano
--------------------------------
.. _`https://raw.github.com/stackforge/murano-deployment/master/image-builder/share/scripts/ws-2012-std/wpi.ps1`: https://raw.github.com/stackforge/murano-deployment/master/image-builder/share/scripts/ws-2012-std/wpi.ps1
.. _`https://raw.github.com/stackforge/murano-deployment/master/image-builder/share/scripts/ws-2012-std/Start-Sysprep.ps1`: https://raw.github.com/stackforge/murano-deployment/master/image-builder/share/scripts/ws-2012-std/Start-Sysprep.ps1
* Create folders where Murano components will be installed
.. list-table::
:header-rows: 1
:widths: 20, 80
* - Path
- Description
* - C:\\Murano
- Root directory for Murano
* - C:\\Murano\\Agent
- Murano Agent installation directory
* - C:\\Murano\\Modules
- PowerShell modules required by Murano
* - C:\\Murano\\Scripts
- PowerShell scrtips and other files required by Murano
..
* Open **Explorer** and navigate to **\\192.168.122.1\share** **192.168.122.1** is an IP address of KVM hypervisor assigned by default.
* Copy Murano Agent files into C:\Murano\Agent
* Copy CoreFunctions directory (entire directory!) into C:\Murano\Modules
* Install .NET 4.0
* Register Murano Agent
.. code-block:: cmd
> cd C:\Murano\Agent
> .\WindowsMuranoAgent.exe /install
..
* Change PowerShell execution policy to less restricted
.. code-block:: powershell
Set-ExecutionPolicy RemoteSigned
..
* Register CoreFunctions modules
.. code-block:: powershell
Import-Module C:\Murano\Modules\CoreFunctions\CoreFunctions.psm1 -ArgumentList register
..
* Install CloudInit
* Run Sysprep
.. code-block:: powershell
C:\Murano\Scripts\Start-Sysprep.ps1 -BatchExecution
..
* Wait until sysprep phase finishes and system powers off.
Convert the image from RAW to QCOW2 format
------------------------------------------
The image must be converted from RAW format to QCOW2 before being imported into Glance.
.. code-block:: console
# qemu-img convert -O qcow2 /var/lib/libvirt/images/ws-2012.raw \
> /var/lib/libvirt/images/ws-2012-ref.qcow2
..