Inicial > Virtualização - XenServer > Criar templates no XenServer

Criar templates no XenServer

Algumas versões do XenServer não possuem templates prontos para Distros mais novas. Em alguns casos, baseado em templates já existentes no sistema, é possível criar templates para as Distros mais novas sem necessidade de paravirtualizar a nova instalação, segue alguns exemplos:

 

– Template Debian Wheezy

 

#!/bin/bash

SQUEEZE=$(xe template-list name-label=Debian\ Squeeze\ 6.0\ \(32-bit\) –minimal)

if [[ -z $SQUEEZE ]] ; then
echo “Cant find squeeze 32bit template, is this on 6.0″
exit 1
fi

distro=”Debian Wheezy”
arches=(“32-bit” “64-bit”)
for arch in ${arches[@]} ; do
echo “Attempting $distro ($arch)”
if [[ -n $(xe template-list name-label=”$distro ($arch)” params=uuid –minimal) ]] ; then
echo “$distro ($arch)” already exists, Skipping
else

NEWUUID=$(xe vm-clone uuid=$SQUEEZE new-name-label=”$distro ($arch)”)
xe template-param-set uuid=$NEWUUID other-config:install-methods=http,ftp \
other-config:install-repository=http://ftp.debian.org/debian \
PV-args=”– quiet console=hvc0″ \
other-config:debian-release=wheezy \
other-config:default_template=true

if [[ “$arch” == “32-bit” ]] ; then
xe template-param-set uuid=$NEWUUID other-config:install-arch=”i386″
else
xe template-param-set uuid=$NEWUUID other-config:install-arch=”amd64″
fi
echo “Success”
fi

done

echo “Done”

 

– Template Ubuntu 

 

#!/bin/bash

LENNY=$(xe template-list name-label=Debian\ Lenny\ 5.0\ \(32-bit\) –minimal)

if [[ -z $LENNY ]] ; then
echo “Cant find lenny 32bit template, is this on 5.6?”
exit 1
fi

distro=”Ubuntu 10.04″
arches=(“32-bit” “64-bit”)
for arch in ${arches[@]} ; do
echo “Attempting $distro ($arch)”
if [[ -n $(xe template-list name-label=”$distro ($arch)” params=uuid –minimal) ]] ; then
echo “$distro ($arch)” already exists, Skipping
else

NEWUUID=$(xe vm-clone uuid=$LENNY new-name-label=”$distro ($arch)”)
xe template-param-set uuid=$NEWUUID other-config:install-methods=http,ftp \
other-config:install-repository=http://archive.ubuntu.net/ubuntu \
PV-args=”– quiet console=hvc0 partman/default_filesystem=ext3″ \
other-config:debian-release=lucid \
other-config:default_template=true

if [[ “$arch” == “32-bit” ]] ; then
xe template-param-set uuid=$NEWUUID other-config:install-arch=”i386″
else
xe template-param-set uuid=$NEWUUID other-config:install-arch=”amd64″
fi
echo “Success”
fi

done

echo “Done”

  1. Nenhum comentário ainda.
  1. No trackbacks yet.

Deixe um comentário