diff options
author | Stefan K. Berg <stefan.k.berg@ericsson.com> | 2015-04-14 14:48:11 +0200 |
---|---|---|
committer | Stefan Berg <stefan.k.berg@ericsson.com> | 2015-04-16 15:18:47 +0000 |
commit | d2b1e4628ae701c5c220ff7dc98560af7d9855ae (patch) | |
tree | 657f2affd353a55aa625a42ae3ca13857d1d385d /fuel/prototypes | |
parent | 101550e036ca0dd7cc5bab0fc8e635062ac32138 (diff) |
Prototype of automated libvirt installation
This is a prototype to experiment with the DEA concept and
how to use it to automatically deploy a KVM environment using
libvirt.
It is now possible to perform a fully automated deploy from
an ISO file.
Highlights:
- Fully automated Fuel deploy installing three controllers,
two computes in full HA mode including Ceilometer
- create_dea.sh will create a DEA YAML file with an
existing deployment as template.
- The install will configure settings, networks and the
interface config of all nodes.
JIRA:
Change-Id: Icc8922afca8508c9062aa5be95e2482086a4f624
Signed-off-by: Stefan K. Berg <stefan.k.berg@ericsson.com>
Diffstat (limited to 'fuel/prototypes')
33 files changed, 2778 insertions, 0 deletions
diff --git a/fuel/prototypes/libvirt/README.rst b/fuel/prototypes/libvirt/README.rst new file mode 100644 index 0000000..e0ceb6f --- /dev/null +++ b/fuel/prototypes/libvirt/README.rst @@ -0,0 +1,43 @@ +**DEA libvirt deployment prototype** + +This is an example of how to deploy a libvirt KVM setup with a DEA +YAML file. + +The file is created from an already deployed Fuel installation using +the create_dea script and helper files which are to be present on the +Fuel master and run from there. + +The install is kicked off from the host by running deploy.sh and +providing the ISO file to deploy and (optionally) an DEA file name as +an argument. If the DEA file is omitted the example one will be used +instead. + +Pre-condition 1: The host needs to be Ubuntu 14.x + +Pre-condition 2: Necessary packages installed by running +genesis/fuel/prototypes/libvirt/setup_vms/setup-vm-host.sh + +Pre-condition 3: Example VM configuration deployed by running +genesis/fuel/prototypes/libvirt/setup_vms/apply_setup.sh The VMs and +networks to be setup are in genesis/fuel/prototypes/libvirt/examples: +"vms" and "networks" + +In order to run the automated install, it's just a matter of running +genesis/fuel/prototypes/libvirt/deploy.sh <isofile> [<deafile>] The +deafile will be optional, if not specified the example one in +genesis/fuel/prototypes/libvirt/examples/libvirt_dea.yaml will be +used. + +Now either this will succeed (return code 0) or fail. I'll have a +three hours safety catch to kill off things if something is hanging, +may need to be adjusted for slow environments (see deploy.sh). + +All the steps above should be run with sudo. + +In principle the deploy.sh is assuming the example vm setup (one fuel, +three controllers, two computes) and will always deploy with full HA +and Ceilometer. + +TODO: Copy also the deployment mode in my dea.yaml creation script +genesis/fuel/prototypes/libvirt/create_dea/create_dea.sh so it's a +real xerox of the running deploy. diff --git a/fuel/prototypes/libvirt/create_dea/create_dea.sh b/fuel/prototypes/libvirt/create_dea/create_dea.sh new file mode 100755 index 0000000..87587a5 --- /dev/null +++ b/fuel/prototypes/libvirt/create_dea/create_dea.sh @@ -0,0 +1,86 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +cleanup () { + if [ -n "$tmpDir" ]; then + rm -Rf $tmpDir + fi +} + +trap cleanup exit + +error_exit () { + echo "Error: $@" >&2 + exit 1 +} + +tmpDir=`mktemp -d /tmp/deaXXXX` + +export PATH=`dirname $0`:$PATH + +if [ $# -lt 1 ]; then + error_exit "Argument error" +fi +deafile=$1 +shift + +if [ $# -ne 0 ]; then + comment="$@" +fi + +if [ -f "$deafile" ]; then + error_exit "$deafile already exists" +fi + +if [ `fuel env | tail -n +3 | grep -v '^$' | wc -l` -ne 1 ]; then + error_exit "Not exactly one environment" +fi +envId=`fuel env | tail -n +3 | grep -v '^$' | awk '{ print $1 }'` + +computeId=`fuel node | grep compute | grep True | head -1 | awk '{ print $1}'` +controllerId=`fuel node | grep controller | grep True | head -1 | awk '{ print $1}'` + +if [ -z "$computeId" ]; then + error_exit "Could not find any compute node" +elif [ -z "$controllerId" ]; then + error_exit "Could not find any controller node" +fi + +fuel deployment --env $envId --download --dir $tmpDir > /dev/null || \ + error_exit "Could not get deployment info" +fuel settings --env $envId --download --dir $tmpDir > /dev/null || \ + error_exit "Could not get settings" +fuel network --env $envId --download --dir $tmpDir > /dev/null || \ + error_exit "Could not get network settings" + +echo "version: 1.0" > $deafile +echo "created: `date`" >> $deafile +if [ -n "$comment" ]; then + echo "comment: $comment" >> $deafile +fi + +reap_network_scheme.py $tmpDir/deployment_${envId}/*controller_${controllerId}.yaml $deafile controller || \ + error_exit "Could not extract network scheme for controller" +reap_network_scheme.py $tmpDir/deployment_${envId}/compute_${computeId}.yaml $deafile compute || \ + error_exit "Could not extract network scheme for controller" +reap_network_settings.py $tmpDir/network_${envId}.yaml $deafile network || \ + error_exit "Could not extract network settings" +reap_settings.py $tmpDir/settings_${envId}.yaml $deafile settings || \ + error_exit "Could not extract settings" + +fuel node --node-id $controllerId --network --download --dir $tmpDir || \ + error_exit "Could not get network info for node $controllerId" +reap_interfaces.py $tmpDir/node_${controllerId}/interfaces.yaml $deafile || \ + error_exit "Could not extract interfaces" + + +echo "DEA file is available at $deafile" + diff --git a/fuel/prototypes/libvirt/create_dea/reap_interfaces.py b/fuel/prototypes/libvirt/create_dea/reap_interfaces.py new file mode 100755 index 0000000..20a34f0 --- /dev/null +++ b/fuel/prototypes/libvirt/create_dea/reap_interfaces.py @@ -0,0 +1,45 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import yaml +import re +import sys +import os + +if len(sys.argv) != 3: + sys.stderr.write("Usage: "+sys.argv[0]+" <infile> <outfile>\n") + sys.exit(1) + +infile = sys.argv[1] +if not os.path.exists(infile): + sys.stderr.write("ERROR: The file "+infile+" could not be opened\n") + sys.exit(1) + +outfile = sys.argv[2] + +f1 = open(infile, 'r') +doc = yaml.load(f1) +f1.close() + +out = {} +out["interfaces"] = {} + +for interface in doc: + iface = {} + networks = [] + for network in interface["assigned_networks"]: + networks.append(network["name"]) + out["interfaces"][interface["name"]] = networks + +f2 = open(outfile, 'a') +f2.write(yaml.dump(out, default_flow_style=False)) +f2.close() + diff --git a/fuel/prototypes/libvirt/create_dea/reap_network_scheme.py b/fuel/prototypes/libvirt/create_dea/reap_network_scheme.py new file mode 100755 index 0000000..19c18bf --- /dev/null +++ b/fuel/prototypes/libvirt/create_dea/reap_network_scheme.py @@ -0,0 +1,38 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import yaml +import re +import sys +import os + +if len(sys.argv) != 4: + sys.stderr.write("Usage: "+sys.argv[0]+" <infile> <outfile> <outnamespace>\n") + sys.exit(1) + +infile = sys.argv[1] +if not os.path.exists(infile): + sys.stderr.write("ERROR: The file "+infile+" could not be opened\n") + sys.exit(1) + +outfile = sys.argv[2] +namespace = sys.argv[3] + +f1 = open(infile, 'r') +doc = yaml.load(f1) +f1.close() + +out = {} +out[namespace] = doc["network_scheme"]["transformations"] +f2 = open(outfile, 'a') +f2.write(yaml.dump(out, default_flow_style=False)) +f2.close() + diff --git a/fuel/prototypes/libvirt/create_dea/reap_network_settings.py b/fuel/prototypes/libvirt/create_dea/reap_network_settings.py new file mode 100755 index 0000000..bbd1fd0 --- /dev/null +++ b/fuel/prototypes/libvirt/create_dea/reap_network_settings.py @@ -0,0 +1,41 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import yaml +import re +import sys +import os + +if len(sys.argv) != 4: + sys.stderr.write("Usage: "+sys.argv[0]+" <infile> <outfile> <outnamespace>\n") + sys.exit(1) + +infile = sys.argv[1] +if not os.path.exists(infile): + sys.stderr.write("ERROR: The file "+infile+" could not be opened\n") + sys.exit(1) + +outfile = sys.argv[2] +namespace = sys.argv[3] + +f1 = open(infile, 'r') +doc = yaml.load(f1) +f1.close() + +for nw in doc["networks"]: + del nw["id"] + del nw["group_id"] + +out = {} +out[namespace] = doc +f2 = open(outfile, 'a') +f2.write(yaml.dump(out, default_flow_style=False)) +f2.close() diff --git a/fuel/prototypes/libvirt/create_dea/reap_settings.py b/fuel/prototypes/libvirt/create_dea/reap_settings.py new file mode 100755 index 0000000..22794d2 --- /dev/null +++ b/fuel/prototypes/libvirt/create_dea/reap_settings.py @@ -0,0 +1,37 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import yaml +import re +import sys +import os + +if len(sys.argv) != 4: + sys.stderr.write("Usage: "+sys.argv[0]+" <infile> <outfile> <outnamespace>\n") + sys.exit(1) + +infile = sys.argv[1] +if not os.path.exists(infile): + sys.stderr.write("ERROR: The file "+infile+" could not be opened\n") + sys.exit(1) + +outfile = sys.argv[2] +namespace = sys.argv[3] + +f1 = open(infile, 'r') +doc = yaml.load(f1) +f1.close() + +out = {} +out[namespace] = doc +f2 = open(outfile, 'a') +f2.write(yaml.dump(out, default_flow_style=False)) +f2.close() diff --git a/fuel/prototypes/libvirt/deploy/deploy.sh b/fuel/prototypes/libvirt/deploy/deploy.sh new file mode 100755 index 0000000..7eff3da --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/deploy.sh @@ -0,0 +1,98 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# Setup locations +topdir=$(cd `dirname $0`; pwd) +exampledir=$(cd $topdir/../examples; pwd) +functions=${topdir}/functions +tmpdir=$HOME/fueltmp +deployiso=${tmpdir}/deploy.iso + +# Define common functions +. ${functions}/common.sh + +exit_handler() { + # Remove safety catch + kill $killpid +} + +####### MAIN ######## + +if [ "`whoami`" != "root" ]; then + error_exit "You need be root to run this script" +fi + +if [ $# -eq 0 -o $# -gt 2 ]; then + error_exit "Argument error" +fi + +# Setup tmpdir +if [ -d $tmpdir ]; then + rm -Rf $tmpdir || error_exit "Coul not remove tmpdir $tmpdir" +fi + +mkdir $tmpdir || error_exit "Could not create tmpdir $tmpdir" + +if [ ! -f $1 ]; then + error_exit "Could not find ISO file $1" +else + isofile=$(cd `dirname $1`; echo `pwd`/`basename $1`) +fi + +# If no DEA specified, use the example one +if [ $# -eq 1 ]; then + deafile=${exampledir}/libvirt_dea.yaml +else + deafile=$(cd `dirname $2`; echo `pwd`/`basename $2`) +fi + +if [ ! -f $deafile ]; then + error-exit "Could not find DEA file $deafile" +fi + + +# Enable safety catch at three hours +(sleep 3h; kill $$) & +killpid=$! + +# Enable exit handler +trap exit_handler exit + + +# Stop all VMs +for node in controller1 controller2 controller3 compute4 compute5 fuel-master +do + virsh destroy $node >/dev/null 2>&1 +done + +# Install the Fuel master +# (Convert to functions at later stage) +echo "Patching iso file" +${functions}/patch-iso.sh $isofile $deployiso $tmpdir || error_exit "Failed to patch ISO" +# Swap isofiles from now on +isofile=$deployiso +. ${functions}/install_iso.sh +. ${functions}/deploy_env.sh + +echo "Waiting for two minutes for deploy to stabilize" +sleep 2m + +echo "Verifying node status after deployment" +set -o pipefail +# Any node with non-ready status? +ssh root@10.20.0.2 fuel node | tail -n +3 | cut -d "|" -f 2 | \ + sed 's/ //g' | grep -v ready | wc -l | grep -q "^0$" +if [ $? -ne 0 ]; then + error_exit "Deployment failed verification" +else + echo "Deployment verified" +fi + diff --git a/fuel/prototypes/libvirt/deploy/functions/common.sh b/fuel/prototypes/libvirt/deploy/functions/common.sh new file mode 100755 index 0000000..f6cceb4 --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/functions/common.sh @@ -0,0 +1,109 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# Common functions + +error_exit () { + echo "Error: $@" >&2 + exit 1 +} + +ssh() { + SSHPASS="r00tme" sshpass -e ssh -o UserKnownHostsFile=/dev/null \ + -o StrictHostKeyChecking=no -o ConnectTimeout=15 "$@" +} + +scp() { + SSHPASS="r00tme" sshpass -e scp -o UserKnownHostsFile=/dev/null \ + -o StrictHostKeyChecking=no -o ConnectTimeout=15 "$@" +} + +noNodesUp () { + fuel node | grep True | wc -l +} + +fuel () { + ssh root@10.20.0.2 "fuel $@" +} + +# Return MAC id for virsh node +getNodeId() { + virsh dumpxml $1 | grep "mac address" | head -1 | sed "s/.*'..:..:..:..:\(.*\)'.*/\1/" +} + +# Wait for node with virtid name to come up +waitForHost() { + mac=`getNodeId $1` + + while true + do + fuel node --node-id $mac 2>/dev/null | grep -q True && break + sleep 3 + echo -n "." + done + echo -e "\n" +} + +# Currently not used! +# Wait for node count to increase +waitForNode() { + local cnt + local initCnt + local expectCnt + + initCnt=`noNodesUp` + expectCnt=$[initCnt+1] + while true + do + cnt=`noNodesUp` + if [ $cnt -eq $expectCnt ]; then + break + elif [ $cnt -lt $initCnt ]; then + error_exit "Node count decreased while waiting, $initCnt -> $cnt" + elif [ $cnt -gt $expectCnt ]; then + error_exit "Node count exceeded expect count, $cnt > $expectCnt" + fi + sleep 3 + echo -n "." + done + echo -e "\n" +} + +bootorder_dvdhd() { + virsh dumpxml $1 | grep -v "<boot.*>" | \ + sed "/<\/os>/i\ + <boot dev='cdrom'/\>\n\ + <boot dev='hd'/\>\n\ + <bootmenu enable='no'/\>" > $tmpdir/vm.xml || error_exit "Could not set bootorder" + virsh define $tmpdir/vm.xml || error_exit "Could not set bootorder" +} + +bootorder_hddvd() { + virsh dumpxml $1 | grep -v "<boot.*>" | \ + sed "/<\/os>/i\ + <boot dev='hd'/\>\n\ + <boot dev='cdrom'/\>\n\ + <bootmenu enable='no'/\>" > $tmpdir/vm.xml || error_exit "Could not set bootorder" + virsh define $tmpdir/vm.xml || error_exit "Could not set bootorder" +} + +addisofile() { + virsh dumpxml $1 | grep -v '\.iso' | sed "s/<.*device='cdrom'.*/<disk type='file' device='cdrom'>/" | \ + sed "/<.*device='cdrom'.*/a <source file='$2'/>" > $tmpdir/vm.xml \ + || error_exit "Could not add isofile" + virsh define $tmpdir/vm.xml || error_exit "Could not add isofile" +} + +removeisofile() { + virsh dumpxml $1 | grep -v '\.iso' | sed "s/<.*device='cdrom'.*/<disk type='block' device='cdrom'>/" \ + > $tmpdir/vm.xml \ + || error_exit "Could not remove isofile" + virsh define $tmpdir/vm.xml || error_exit "Could not remove isofile" +} diff --git a/fuel/prototypes/libvirt/deploy/functions/deploy_env.sh b/fuel/prototypes/libvirt/deploy/functions/deploy_env.sh new file mode 100755 index 0000000..6fb26c4 --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/functions/deploy_env.sh @@ -0,0 +1,81 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# Deploy! + +scp -q $deafile root@10.20.0.2:. || error_exit "Could not copy DEA file to Fuel" +echo "Uploading build tools to Fuel server" +ssh root@10.20.0.2 rm -rf tools || error_exit "Error cleaning old tools structure" +scp -qrp $topdir/tools root@10.20.0.2:. || error_exit "Error copying tools" + +# Refuse to run if environment already present +envcnt=`fuel env | tail -n +3 | grep -v '^$' | wc -l` +if [ $envcnt -ne 0 ]; then + error_exit "Environment count is $envcnt" +fi + +# Refuse to run if any nodes are up +nodeCnt=`noNodesUp` +if [ $nodeCnt -ne 0 ]; then + error_exit "Nodes are up (node count: $nodeCnt)" +fi + +# Extract release ID for Ubuntu environment +ubuntucnt=`fuel release | grep Ubuntu | wc -l` +if [ $ubuntucnt -ne 1 ]; then + error_exit "Not exacly one Ubuntu release found" +fi + +ubuntuid=`fuel release | grep Ubuntu | awk '{ print $1 }'` + +# Create environment +fuel env create --name Foobar --rel $ubuntuid --mode ha --network-mode neutron --net-segment-type vlan || error_exit "Error creating environment" +envId=`ssh root@10.20.0.2 fuel env | tail -n +3 | awk '{ print $1 }'` || error_exit "Could not get environment id" + + +echo "Running transplant #1" +ssh root@10.20.0.2 "cd tools; ./transplant1.sh ../`basename $deafile`" || error_exit "Error running transplant sequence #1" + +# Spin up VMs +for node in controller1 controller2 controller3 compute4 compute5 +do + echo "Starting VM $node" + virsh start $node >/dev/null 2>&1 || error_exit "Could not virsh start $node" + sleep 10 +done + +for node in controller1 controller2 controller3 +do + echo -n "Waiting for Fuel to detect $node" + waitForHost $node + echo "Setting role for $node" + fuel node set --node-id `getNodeId $node` --role controller,mongo --env $envId || error_exit "Could not set role for $node" +done + +for node in compute4 compute5 +do + echo -n "Waiting for Fuel to detect $node" + waitForHost $node + echo "Setting role for $node" + fuel node set --node-id `getNodeId $node` --role compute --env $envId || error_exit "Could not set role for $node" +done + +# Inject node network config +echo "Running transplant #2" +ssh root@10.20.0.2 "cd tools; ./transplant2.sh ../`basename $deafile`" || error_exit "Error running transplant sequence #2" + +# Run pre-deploy with default input +# Need to set terminal as script does "clear" +ssh root@10.20.0.2 "TERM=vt100 /opt/opnfv/pre-deploy.sh < /dev/null" || error_exit "Pre-deploy failed" + +# Deploy +echo "Deploying!" +ssh root@10.20.0.2 "fuel deploy-changes --env $envId" >/dev/null 2>&1 || error_exit "Deploy failed" +echo "Deployment completed" diff --git a/fuel/prototypes/libvirt/deploy/functions/install_iso.sh b/fuel/prototypes/libvirt/deploy/functions/install_iso.sh new file mode 100755 index 0000000..0a92cd5 --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/functions/install_iso.sh @@ -0,0 +1,62 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# Recreate disk - needed for the reboot to work +fueldisk=`virsh dumpxml fuel-master | \ + grep fuel-master.raw | sed "s/.*'\(.*\)'.*/\1/"` +disksize=`ls -l $fueldisk | awk '{ print $5 }'` +rm -f $fueldisk +fallocate -l $disksize $fueldisk + +bootorder_hddvd fuel-master +sleep 3 +addisofile fuel-master $isofile +sleep 3 +virsh start fuel-master + +# wait for node up +echo "Waiting for Fuel master to accept SSH" +while true +do + ssh root@10.20.0.2 date 2>/dev/null + if [ $? -eq 0 ]; then + break + fi + sleep 10 +done + +# Wait until fuelmenu is up +echo "Waiting for fuelmenu to come up" +menuPid="" +while [ -z "$menuPid" ] +do + menuPid=`ssh root@10.20.0.2 "ps -ef" 2>&1 | grep fuelmenu | grep -v grep | awk '{ print $2 }'` + sleep 10 +done + +# This is where we would inject our own astute.yaml + +echo "Found menu as PID $menuPid, now killing it" +ssh root@10.20.0.2 "kill $menuPid" 2>/dev/null + +# Wait until installation complete +echo "Waiting for bootstrap of Fuel node to complete" +while true +do + ssh root@10.20.0.2 "ps -ef" 2>/dev/null \ + | grep -q /usr/local/sbin/bootstrap_admin_node + if [ $? -ne 0 ]; then + break + fi + sleep 10 +done + +echo "Waiting two minutes for Fuel to stabilize" +sleep 2m diff --git a/fuel/prototypes/libvirt/deploy/functions/isolinux.cfg.patch b/fuel/prototypes/libvirt/deploy/functions/isolinux.cfg.patch new file mode 100644 index 0000000..298a057 --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/functions/isolinux.cfg.patch @@ -0,0 +1,14 @@ +*** isolinux/isolinux.cfg.orig 2015-04-15 08:29:52.026868322 -0400 +--- isolinux/isolinux.cfg 2015-04-15 08:30:34.350868343 -0400 +*************** +*** 19,22 **** + menu label Fuel Install (^Static IP) + menu default + kernel vmlinuz +! append initrd=initrd.img biosdevname=0 ks=cdrom:/ks.cfg ip=10.20.0.2 gw=10.20.0.1 dns1=10.20.0.1 netmask=255.255.255.0 hostname=fuel.domain.tld showmenu=no +--- 19,22 ---- + menu label Fuel Install (^Static IP) + menu default + kernel vmlinuz +! append initrd=initrd.img biosdevname=0 ks=cdrom:/ks.cfg ip=10.20.0.2 gw=10.20.0.1 dns1=10.20.0.1 netmask=255.255.255.0 hostname=fuel.domain.tld showmenu=yes + diff --git a/fuel/prototypes/libvirt/deploy/functions/ks.cfg.patch b/fuel/prototypes/libvirt/deploy/functions/ks.cfg.patch new file mode 100644 index 0000000..1896957 --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/functions/ks.cfg.patch @@ -0,0 +1,19 @@ +*** ks.cfg.orig Wed Apr 15 21:47:09 2015 +--- ks.cfg Wed Apr 15 21:47:24 2015 +*************** +*** 35,41 **** + default_drive=`echo ${drives} ${removable_drives} | awk '{print $1}'` + + installdrive="undefined" +! forceformat="no" + for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done + + set ${drives} ${removable_drives} +--- 35,41 ---- + default_drive=`echo ${drives} ${removable_drives} | awk '{print $1}'` + + installdrive="undefined" +! forceformat="yes" + for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done + + set ${drives} ${removable_drives} diff --git a/fuel/prototypes/libvirt/deploy/functions/patch-iso.sh b/fuel/prototypes/libvirt/deploy/functions/patch-iso.sh new file mode 100755 index 0000000..782737e --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/functions/patch-iso.sh @@ -0,0 +1,69 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# This is a temporary script - this should be rolled into a separate +# build target "make ci-iso" instead! + +exit_handler() { + rm -Rf $tmpnewdir + fusermount -u $tmporigdir 2>/dev/null + test -d $tmporigdir && mdir $tmporigdir +} + +trap exit_handler exit + +error_exit() { + echo "$@" + exit 1 +} + + +top=$(cd `dirname $0`; pwd) +origiso=$(cd `dirname $1`; echo `pwd`/`basename $1`) +newiso=$(cd `dirname $2`; echo `pwd`/`basename $2`) +tmpdir=$3 +tmporigdir=/${tmpdir}/origiso +tmpnewdir=/${tmpdir}/newiso + +test -f $origiso || error_exit "Could not find origiso $origiso" +test -d $tmpdir || error_exit "Could not find tmpdir $tmpdir" + + +if [ "`whoami`" != "root" ]; then + error_exit "You need be root to run this script" +fi + +echo "Copying..." +rm -Rf $tmporigdir $tmpnewdir +mkdir -p $tmporigdir $tmpnewdir +fuseiso $origiso $tmporigdir || error_exit "Failed fuseiso" +cd $tmporigdir +find . | cpio -pd $tmpnewdir +cd $tmpnewdir +fusermount -u $tmporigdir +rmdir $tmporigdir +chmod -R 755 $tmpnewdir + +echo "Patching..." +cd $tmpnewdir +# Patch ISO to make it suitable for automatic deployment +cat $top/ks.cfg.patch | patch -p0 || error_exit "Failed patch 1" +cat $top/isolinux.cfg.patch | patch -p0 || error_exit "Failed patch 2" +rm -rf .rr_moved + +echo "Creating iso $newiso" +mkisofs -quiet -r \ + -J -R -b isolinux/isolinux.bin \ + -no-emul-boot \ + -boot-load-size 4 -boot-info-table \ + --hide-rr-moved \ + -x "lost+found" -o $newiso . || error_exit "Failed making iso" + diff --git a/fuel/prototypes/libvirt/deploy/tools/transplant1.sh b/fuel/prototypes/libvirt/deploy/tools/transplant1.sh new file mode 100755 index 0000000..9cead7a --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/tools/transplant1.sh @@ -0,0 +1,67 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +cleanup () { + if [ -n "$tmpDir" ]; then + rm -Rf $tmpDir + fi +} + +trap cleanup exit + +error_exit () { + echo "Error: $@" >&2 + exit 1 +} + +tmpDir=`mktemp -d /tmp/deaXXXX` + +export PATH=`dirname $0`:$PATH + +if [ $# -lt 1 ]; then + error_exit "Argument error" +fi +deafile=$1 +shift + +if [ $# -ne 0 ]; then + comment="$@" +fi + +if [ ! -f "$deafile" ]; then + error_exit "Can't find $deafile" +fi + +if [ `fuel env | tail -n +3 | grep -v '^$' | wc -l` -ne 1 ]; then + error_exit "Not exactly one environment" +fi +envId=`fuel env | tail -n +3 | grep -v '^$' | awk '{ print $1 }'` + +fuel settings --env $envId --download --dir $tmpDir > /dev/null || \ + error_exit "Could not get settings" +fuel network --env $envId --download --dir $tmpDir > /dev/null || \ + error_exit "Could not get network settings" + +cp $tmpDir/network_${envId}.yaml network_before.yaml +transplant_network_settings.py $tmpDir/network_${envId}.yaml $deafile || \ + error_exit "Could not transplant network settings" +fuel network --env $envId --upload --dir $tmpDir || \ + error_exit "Could not update network settings" +cp $tmpDir/network_${envId}.yaml network_after.yaml + +cp $tmpDir/settings_${envId}.yaml settings_before.yaml +transplant_settings.py $tmpDir/settings_${envId}.yaml $deafile || \ + error_exit "Could not transplant settings" +fuel settings --env $envId --upload --dir $tmpDir || \ + error_exit "Could not update settings" +cp $tmpDir/settings_${envId}.yaml settings_after.yaml + + diff --git a/fuel/prototypes/libvirt/deploy/tools/transplant2.sh b/fuel/prototypes/libvirt/deploy/tools/transplant2.sh new file mode 100755 index 0000000..5049f88 --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/tools/transplant2.sh @@ -0,0 +1,80 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +cleanup () { + if [ -n "$tmpDir" ]; then + rm -Rf $tmpDir + fi +} + +trap cleanup exit + +error_exit () { + echo "Error: $@" >&2 + exit 1 +} + +tmpDir=`mktemp -d /tmp/deaXXXX` + +export PATH=`dirname $0`:$PATH + +if [ $# -ne 1 ]; then + error_exit "Argument error" +fi +deaFile=$1 + +if [ ! -f "$deaFile" ]; then + error_exit "Can't find $deaFile" +fi + + +if [ `fuel env | tail -n +3 | grep -v '^$' | wc -l` -ne 1 ]; then + error_exit "Not exactly one environment" +fi +envId=`fuel env | tail -n +3 | grep -v '^$' | awk '{ print $1 }'` + +# Phase 1: Graft deployment information +if [ "a" == "b" ]; then +fuel deployment --env $envId --default --dir $tmpDir || \ + error_exit "Could not dump environment" + +for controller in `find $tmpDir -type f | grep -v compute` +do + transplant_network_scheme.py $controller $deaFile controller || \ + error_exit "Failed to graft `basename $controller`" +done + +for compute in `find $tmpDir -type f | grep compute` +do + transplant_network_scheme.py $compute $deaFile compute || \ + error_exit "Failed to graft `basename $compute`" +done + +fuel deployment --env $envId --upload --dir $tmpDir || \ + error_exit "Could not upload environment" +fi +# Phase 2: Graft interface information + +for nodeId in `fuel node | grep True | awk '{ print $1}'` +do + echo "Node $nodeId" + fuel node --node-id $nodeId --network --download --dir $tmpDir || \ + error_exit "Could not download node $nodeId" + + transplant_interfaces.py ${tmpDir}/node_${nodeId}/interfaces.yaml $deaFile || \ + error_exit "Failed to graft interfaces" + + fuel node --node-id $nodeId --network --upload --dir $tmpDir || \ + error_exit "Could not upload node $nodeId" +done + + + diff --git a/fuel/prototypes/libvirt/deploy/tools/transplant_interfaces.py b/fuel/prototypes/libvirt/deploy/tools/transplant_interfaces.py new file mode 100755 index 0000000..8d076ff --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/tools/transplant_interfaces.py @@ -0,0 +1,66 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import yaml +import re +import sys +import os + +if len(sys.argv) != 3: + sys.stderr.write("Usage: "+sys.argv[0]+" <infile> <deafile>\n") + sys.exit(1) + +infile = sys.argv[1] +if not os.path.exists(infile): + sys.stderr.write("ERROR: The file "+infile+" could not be opened\n") + sys.exit(1) + +deafile = sys.argv[2] +if not os.path.exists(deafile): + sys.stderr.write("ERROR: The file "+deafile+" could not be opened\n") + sys.exit(1) +deafile = sys.argv[2] + +namespace = "interfaces" + +f1 = open(infile, 'r') +doc1 = yaml.load(f1) +f1.close() + +f2 = open(deafile, 'r') +doc2 = yaml.load(f2) +f2.close() + +# Create lookup table network name -> id for current setup +nwlookup = {} +for interface in doc1: + iface = {} + networks = [] + for network in interface["assigned_networks"]: + nwlookup[network["name"]] = network["id"] + + +out = {} +out["interfaces"] = {} + +for interface in doc1: + assigned = [] + nw = {} + interface["assigned_networks"] = [] + for nwname in doc2["interfaces"][interface["name"]]: + iface = {} + iface["id"] = nwlookup[nwname] + iface["name"] = nwname + interface["assigned_networks"].append(iface) + +f3 = open(infile, 'w') +f3.write(yaml.dump(doc1, default_flow_style=False)) +f3.close() diff --git a/fuel/prototypes/libvirt/deploy/tools/transplant_network_scheme.py b/fuel/prototypes/libvirt/deploy/tools/transplant_network_scheme.py new file mode 100755 index 0000000..7d50cbe --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/tools/transplant_network_scheme.py @@ -0,0 +1,42 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import yaml +import re +import sys +import os + +if len(sys.argv) != 4: + sys.stderr.write("Usage: "+sys.argv[0]+" <file> <deafile> [compute|controller]\n") + sys.exit(1) + +file = sys.argv[1] +if not os.path.exists(file): + sys.stderr.write("ERROR: The file "+file+" could not be opened\n") + sys.exit(1) + +deafile = sys.argv[2] +namespace = sys.argv[3] + +f1 = open(file, 'r') +doc1 = yaml.load(f1) +f1.close() + +f2 = open(deafile, 'r') +doc2 = yaml.load(f2) +f1.close() + +doc1["network_scheme"]["transformations"] = doc2[namespace] + +f2 = open(file, 'w') +f2.write(yaml.dump(doc1, default_flow_style=False)) +f2.close() + diff --git a/fuel/prototypes/libvirt/deploy/tools/transplant_network_settings.py b/fuel/prototypes/libvirt/deploy/tools/transplant_network_settings.py new file mode 100755 index 0000000..c0a46be --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/tools/transplant_network_settings.py @@ -0,0 +1,52 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import yaml +import re +import sys +import os + +if len(sys.argv) != 3: + sys.stderr.write("Usage: "+sys.argv[0]+" <file> <deafile>\n") + sys.exit(1) + +file = sys.argv[1] +if not os.path.exists(file): + sys.stderr.write("ERROR: The file "+file+" could not be opened\n") + sys.exit(1) + +deafile = sys.argv[2] +if not os.path.exists(deafile): + sys.stderr.write("ERROR: The file "+deafile+" could not be opened\n") + sys.exit(1) + +f1 = open(file, 'r') +doc1 = yaml.load(f1) +f1.close() + +f2 = open(deafile, 'r') +doc2 = yaml.load(f2) +f2.close() + +# Grab IDs from Fuel version, graft onto DEA version and save +id = [] +groupid = [] +for nw in doc1["networks"]: + id.append(nw["id"]) + groupid.append(nw["group_id"]) + +for nw in doc2["network"]["networks"]: + nw["id"] = id.pop(0) + nw["group_id"] = groupid.pop(0) + +f3 = open(file, 'w') +f3.write(yaml.dump(doc2["network"], default_flow_style=False)) +f3.close() diff --git a/fuel/prototypes/libvirt/deploy/tools/transplant_settings.py b/fuel/prototypes/libvirt/deploy/tools/transplant_settings.py new file mode 100755 index 0000000..7f5c0d8 --- /dev/null +++ b/fuel/prototypes/libvirt/deploy/tools/transplant_settings.py @@ -0,0 +1,36 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import yaml +import re +import sys +import os + +if len(sys.argv) != 3: + sys.stderr.write("Usage: "+sys.argv[0]+" <file> <deafile>\n") + sys.exit(1) + +file = sys.argv[1] +if not os.path.exists(file): + sys.stderr.write("ERROR: The file "+file+" could not be opened\n") + sys.exit(1) + +deafile = sys.argv[2] + +f1 = open(deafile, 'r') +doc = yaml.load(f1) +f1.close() + +out = doc["settings"] +f2 = open(file, 'w') +f2.write(yaml.dump(out, default_flow_style=False)) +f2.close() + diff --git a/fuel/prototypes/libvirt/examples/libvirt_dea.yaml b/fuel/prototypes/libvirt/examples/libvirt_dea.yaml new file mode 100644 index 0000000..eafbacf --- /dev/null +++ b/fuel/prototypes/libvirt/examples/libvirt_dea.yaml @@ -0,0 +1,927 @@ +version: 1.0 +created: Tue Apr 14 12:04:01 UTC 2015 +comment: The first experimental libvirt DEA +controller: +- action: add-br + name: br-eth0 +- action: add-port + bridge: br-eth0 + name: eth0 +- action: add-br + name: br-eth1 +- action: add-port + bridge: br-eth1 + name: eth1 +- action: add-br + name: br-eth2 +- action: add-port + bridge: br-eth2 + name: eth2 +- action: add-br + name: br-eth3 +- action: add-port + bridge: br-eth3 + name: eth3 +- action: add-br + name: br-ex +- action: add-br + name: br-mgmt +- action: add-br + name: br-storage +- action: add-br + name: br-fw-admin +- action: add-patch + bridges: + - br-eth1 + - br-storage + tags: + - 102 + - 0 + vlan_ids: + - 102 + - 0 +- action: add-patch + bridges: + - br-eth0 + - br-mgmt + tags: + - 101 + - 0 + vlan_ids: + - 101 + - 0 +- action: add-patch + bridges: + - br-eth0 + - br-fw-admin + trunks: + - 0 +- action: add-patch + bridges: + - br-eth3 + - br-ex + trunks: + - 0 +- action: add-br + name: br-prv +- action: add-patch + bridges: + - br-eth2 + - br-prv +compute: +- action: add-br + name: br-eth0 +- action: add-port + bridge: br-eth0 + name: eth0 +- action: add-br + name: br-eth1 +- action: add-port + bridge: br-eth1 + name: eth1 +- action: add-br + name: br-eth2 +- action: add-port + bridge: br-eth2 + name: eth2 +- action: add-br + name: br-eth3 +- action: add-port + bridge: br-eth3 + name: eth3 +- action: add-br + name: br-mgmt +- action: add-br + name: br-storage +- action: add-br + name: br-fw-admin +- action: add-patch + bridges: + - br-eth1 + - br-storage + tags: + - 102 + - 0 + vlan_ids: + - 102 + - 0 +- action: add-patch + bridges: + - br-eth0 + - br-mgmt + tags: + - 101 + - 0 + vlan_ids: + - 101 + - 0 +- action: add-patch + bridges: + - br-eth0 + - br-fw-admin + trunks: + - 0 +- action: add-br + name: br-prv +- action: add-patch + bridges: + - br-eth2 + - br-prv +network: + management_vip: 192.168.0.2 + networking_parameters: + base_mac: fa:16:3e:00:00:00 + dns_nameservers: + - 8.8.4.4 + - 8.8.8.8 + floating_ranges: + - - 172.16.0.130 + - 172.16.0.254 + gre_id_range: + - 2 + - 65535 + internal_cidr: 192.168.111.0/24 + internal_gateway: 192.168.111.1 + net_l23_provider: ovs + segmentation_type: vlan + vlan_range: + - 1000 + - 1200 + networks: + - cidr: 172.16.0.0/24 + gateway: 172.16.0.1 + ip_ranges: + - - 172.16.0.2 + - 172.16.0.126 + meta: + assign_vip: true + cidr: 172.16.0.0/24 + configurable: true + floating_range_var: floating_ranges + ip_range: + - 172.16.0.2 + - 172.16.0.126 + map_priority: 1 + name: public + notation: ip_ranges + render_addr_mask: public + render_type: null + use_gateway: true + vlan_start: null + name: public + vlan_start: null + - cidr: 192.168.0.0/24 + gateway: null + ip_ranges: + - - 192.168.0.2 + - 192.168.0.254 + meta: + assign_vip: true + cidr: 192.168.0.0/24 + configurable: true + map_priority: 2 + name: management + notation: cidr + render_addr_mask: internal + render_type: cidr + use_gateway: false + vlan_start: 101 + name: management + vlan_start: 101 + - cidr: 192.168.1.0/24 + gateway: null + ip_ranges: + - - 192.168.1.2 + - 192.168.1.254 + meta: + assign_vip: false + cidr: 192.168.1.0/24 + configurable: true + map_priority: 2 + name: storage + notation: cidr + render_addr_mask: storage + render_type: cidr + use_gateway: false + vlan_start: 102 + name: storage + vlan_start: 102 + - cidr: null + gateway: null + ip_ranges: [] + meta: + assign_vip: false + configurable: false + map_priority: 2 + name: private + neutron_vlan_range: true + notation: null + render_addr_mask: null + render_type: null + seg_type: vlan + use_gateway: false + vlan_start: null + name: private + vlan_start: null + - cidr: 10.20.0.0/24 + gateway: null + ip_ranges: + - - 10.20.0.3 + - 10.20.0.254 + meta: + assign_vip: false + configurable: false + map_priority: 0 + notation: ip_ranges + render_addr_mask: null + render_type: null + unmovable: true + use_gateway: true + name: fuelweb_admin + vlan_start: null + public_vip: 172.16.0.2 +settings: + editable: + access: + email: + description: Email address for Administrator + label: email + type: text + value: admin@localhost + weight: 40 + metadata: + label: Access + weight: 10 + password: + description: Password for Administrator + label: password + type: password + value: admin + weight: 20 + tenant: + description: Tenant (project) name for Administrator + label: tenant + regex: + error: Invalid tenant name + source: ^(?!services$)(?!nova$)(?!glance$)(?!keystone$)(?!neutron$)(?!cinder$)(?!swift$)(?!ceph$)(?![Gg]uest$).* + type: text + value: admin + weight: 30 + user: + description: Username for Administrator + label: username + regex: + error: Invalid username + source: ^(?!services$)(?!nova$)(?!glance$)(?!keystone$)(?!neutron$)(?!cinder$)(?!swift$)(?!ceph$)(?![Gg]uest$).* + type: text + value: admin + weight: 10 + additional_components: + ceilometer: + description: If selected, Ceilometer component will be installed + label: Install Ceilometer + type: checkbox + value: true + weight: 40 + heat: + description: '' + label: '' + type: hidden + value: true + weight: 30 + metadata: + label: Additional Components + weight: 20 + murano: + description: If selected, Murano component will be installed + label: Install Murano + restrictions: + - cluster:net_provider != 'neutron' + type: checkbox + value: false + weight: 20 + sahara: + description: If selected, Sahara component will be installed + label: Install Sahara + type: checkbox + value: false + weight: 10 + common: + auth_key: + description: Public key(s) to include in authorized_keys on deployed nodes + label: Public Key + type: text + value: '' + weight: 70 + auto_assign_floating_ip: + description: If selected, OpenStack will automatically assign a floating IP + to a new instance + label: Auto assign floating IP + restrictions: + - cluster:net_provider == 'neutron' + type: checkbox + value: false + weight: 40 + compute_scheduler_driver: + label: Scheduler driver + type: radio + value: nova.scheduler.filter_scheduler.FilterScheduler + values: + - data: nova.scheduler.filter_scheduler.FilterScheduler + description: Currently the most advanced OpenStack scheduler. See the OpenStack + documentation for details. + label: Filter scheduler + - data: nova.scheduler.simple.SimpleScheduler + description: This is 'naive' scheduler which tries to find the least loaded + host + label: Simple scheduler + weight: 40 + debug: + description: Debug logging mode provides more information, but requires more + disk space. + label: OpenStack debug logging + type: checkbox + value: false + weight: 20 + disable_offload: + description: If set, generic segmentation offload (gso) and generic receive + offload (gro) on physical nics will be disabled. See ethtool man. + label: Disable generic offload on physical nics + restrictions: + - action: hide + condition: cluster:net_provider == 'neutron' and networking_parameters:segmentation_type + == 'gre' + type: checkbox + value: true + weight: 80 + libvirt_type: + label: Hypervisor type + type: radio + value: kvm + values: + - data: kvm + description: Choose this type of hypervisor if you run OpenStack on hardware + label: KVM + restrictions: + - settings:common.libvirt_type.value == 'vcenter' + - data: qemu + description: Choose this type of hypervisor if you run OpenStack on virtual + hosts. + label: QEMU + restrictions: + - settings:common.libvirt_type.value == 'vcenter' + - data: vcenter + description: Choose this type of hypervisor if you run OpenStack in a vCenter + environment. + label: vCenter + restrictions: + - settings:common.libvirt_type.value != 'vcenter' or cluster:net_provider + == 'neutron' + weight: 30 + metadata: + label: Common + weight: 30 + nova_quota: + description: Quotas are used to limit CPU and memory usage for tenants. Enabling + quotas will increase load on the Nova database. + label: Nova quotas + type: checkbox + value: false + weight: 25 + resume_guests_state_on_host_boot: + description: Whether to resume previous guests state when the host reboots. + If enabled, this option causes guests assigned to the host to resume their + previous state. If the guest was running a restart will be attempted when + nova-compute starts. If the guest was not running previously, a restart + will not be attempted. + label: Resume guests state on host boot + type: checkbox + value: false + weight: 60 + use_cow_images: + description: For most cases you will want qcow format. If it's disabled, raw + image format will be used to run VMs. OpenStack with raw format currently + does not support snapshotting. + label: Use qcow format for images + type: checkbox + value: true + weight: 50 + corosync: + group: + description: '' + label: Group + type: text + value: 226.94.1.1 + weight: 10 + metadata: + label: Corosync + restrictions: + - action: hide + condition: 'true' + weight: 50 + port: + description: '' + label: Port + type: text + value: '12000' + weight: 20 + verified: + description: Set True only if multicast is configured correctly on router. + label: Need to pass network verification. + type: checkbox + value: false + weight: 10 + external_dns: + dns_list: + description: List of upstream DNS servers, separated by comma + label: DNS list + type: text + value: 8.8.8.8, 8.8.4.4 + weight: 10 + metadata: + label: Upstream DNS + weight: 90 + external_ntp: + metadata: + label: Upstream NTP + weight: 100 + ntp_list: + description: List of upstream NTP servers, separated by comma + label: NTP servers list + type: text + value: 0.pool.ntp.org, 1.pool.ntp.org + weight: 10 + kernel_params: + kernel: + description: Default kernel parameters + label: Initial parameters + type: text + value: console=ttyS0,9600 console=tty0 rootdelay=90 nomodeset + weight: 45 + metadata: + label: Kernel parameters + weight: 40 + neutron_mellanox: + metadata: + enabled: true + label: Mellanox Neutron components + toggleable: false + weight: 50 + plugin: + label: Mellanox drivers and SR-IOV plugin + type: radio + value: disabled + values: + - data: disabled + description: If selected, Mellanox drivers, Neutron and Cinder plugin will + not be installed. + label: Mellanox drivers and plugins disabled + restrictions: + - settings:storage.iser.value == true + - data: drivers_only + description: If selected, Mellanox Ethernet drivers will be installed to + support networking over Mellanox NIC. Mellanox Neutron plugin will not + be installed. + label: Install only Mellanox drivers + restrictions: + - settings:common.libvirt_type.value != 'kvm' + - data: ethernet + description: If selected, both Mellanox Ethernet drivers and Mellanox network + acceleration (Neutron) plugin will be installed. + label: Install Mellanox drivers and SR-IOV plugin + restrictions: + - settings:common.libvirt_type.value != 'kvm' or not (cluster:net_provider + == 'neutron' and networking_parameters:segmentation_type == 'vlan') + weight: 60 + vf_num: + description: Note that one virtual function will be reserved to the storage + network, in case of choosing iSER. + label: Number of virtual NICs + restrictions: + - settings:neutron_mellanox.plugin.value != 'ethernet' + type: text + value: '16' + weight: 70 + nsx_plugin: + connector_type: + description: Default network transport type to use + label: NSX connector type + type: select + value: stt + values: + - data: gre + label: GRE + - data: ipsec_gre + label: GRE over IPSec + - data: stt + label: STT + - data: ipsec_stt + label: STT over IPSec + - data: bridge + label: Bridge + weight: 80 + l3_gw_service_uuid: + description: UUID for the default L3 gateway service to use with this cluster + label: L3 service UUID + regex: + error: Invalid L3 gateway service UUID + source: '[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}' + type: text + value: '' + weight: 50 + metadata: + enabled: false + label: VMware NSX + restrictions: + - action: hide + condition: cluster:net_provider != 'neutron' or networking_parameters:net_l23_provider + != 'nsx' + weight: 20 + nsx_controllers: + description: One or more IPv4[:port] addresses of NSX controller node, separated + by comma (e.g. 10.30.30.2,192.168.110.254:443) + label: NSX controller endpoint + regex: + error: Invalid controller endpoints, specify valid IPv4[:port] pair + source: ^(([\d]|[1-9][\d]|1[\d]{2}|2[0-4][\d]|25[0-5])\.){3}([\d]|[1-9][\d]|1[\d]{2}|2[0-4][\d]|25[0-5])(:(6553[0-5]|655[0-2][\d]|65[0-4][\d]{2}|6[0-4][\d]{3}|5[\d]{4}|[\d][\d]{0,3}))?(,(([\d]|[1-9][\d]|1[\d]{2}|2[0-4][\d]|25[0-5])\.){3}([\d]|[1-9][\d]|1[\d]{2}|2[0-4][\d]|25[0-5])(:(6553[0-5]|655[0-2][\d]|65[0-4][\d]{2}|6[0-4][\d]{3}|5[\d]{4}|[\d][\d]{0,3}))?)*$ + type: text + value: '' + weight: 60 + nsx_password: + description: Password for Administrator + label: NSX password + regex: + error: Empty password + source: \S + type: password + value: '' + weight: 30 + nsx_username: + description: NSX administrator's username + label: NSX username + regex: + error: Empty username + source: \S + type: text + value: admin + weight: 20 + packages_url: + description: URL to NSX specific packages + label: URL to NSX bits + regex: + error: Invalid URL, specify valid HTTP/HTTPS URL with IPv4 address (e.g. + http://10.20.0.2/nsx) + source: ^https?://(([\d]|[1-9][\d]|1[\d]{2}|2[0-4][\d]|25[0-5])\.){3}([\d]|[1-9][\d]|1[\d]{2}|2[0-4][\d]|25[0-5])(:(6553[0-5]|655[0-2][\d]|65[0-4][\d]{2}|6[0-4][\d]{3}|5[\d]{4}|[\d][\d]{0,3}))?(/.*)?$ + type: text + value: '' + weight: 70 + replication_mode: + description: '' + label: NSX cluster has Service nodes + type: checkbox + value: true + weight: 90 + transport_zone_uuid: + description: UUID of the pre-existing default NSX Transport zone + label: Transport zone UUID + regex: + error: Invalid transport zone UUID + source: '[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}' + type: text + value: '' + weight: 40 + provision: + metadata: + label: Provision + restrictions: + - action: hide + condition: not ('experimental' in version:feature_groups) + weight: 80 + method: + description: Which provision method to use for this cluster. + label: Provision method + type: radio + value: cobbler + values: + - data: image + description: Copying pre-built images on a disk. + label: Image + - data: cobbler + description: Install from scratch using anaconda or debian-installer. + label: Classic (use anaconda or debian-installer) + public_network_assignment: + assign_to_all_nodes: + description: When disabled, public network will be assigned to controllers + and zabbix-server only + label: Assign public network to all nodes + type: checkbox + value: false + weight: 10 + metadata: + label: Public network assignment + restrictions: + - action: hide + condition: cluster:net_provider != 'neutron' + weight: 50 + storage: + ephemeral_ceph: + description: Configures Nova to store ephemeral volumes in RBD. This works + best if Ceph is enabled for volumes and images, too. Enables live migration + of all types of Ceph backed VMs (without this option, live migration will + only work with VMs launched from Cinder volumes). + label: Ceph RBD for ephemeral volumes (Nova) + restrictions: + - settings:common.libvirt_type.value == 'vcenter' + type: checkbox + value: false + weight: 75 + images_ceph: + description: Configures Glance to use the Ceph RBD backend to store images. + If enabled, this option will prevent Swift from installing. + label: Ceph RBD for images (Glance) + type: checkbox + value: false + weight: 30 + images_vcenter: + description: Configures Glance to use the vCenter/ESXi backend to store images. + If enabled, this option will prevent Swift from installing. + label: VMWare vCenter/ESXi datastore for images (Glance) + restrictions: + - settings:common.libvirt_type.value != 'vcenter' + type: checkbox + value: false + weight: 35 + iser: + description: 'High performance block storage: Cinder volumes over iSER protocol + (iSCSI over RDMA). This feature requires SR-IOV capabilities in the NIC, + and will use a dedicated virtual function for the storage network.' + label: iSER protocol for volumes (Cinder) + restrictions: + - settings:storage.volumes_lvm.value != true or settings:common.libvirt_type.value + != 'kvm' + type: checkbox + value: false + weight: 11 + metadata: + label: Storage + weight: 60 + objects_ceph: + description: Configures RadosGW front end for Ceph RBD. This exposes S3 and + Swift API Interfaces. If enabled, this option will prevent Swift from installing. + label: Ceph RadosGW for objects (Swift API) + restrictions: + - settings:storage.images_ceph.value == false + type: checkbox + value: false + weight: 80 + osd_pool_size: + description: Configures the default number of object replicas in Ceph. This + number must be equal to or lower than the number of deployed 'Storage - + Ceph OSD' nodes. + label: Ceph object replication factor + regex: + error: Invalid number + source: ^[1-9]\d*$ + restrictions: + - settings:common.libvirt_type.value == 'vcenter' + type: text + value: '2' + weight: 85 + vc_datacenter: + description: Inventory path to a datacenter. If you want to use ESXi host + as datastore, it should be "ha-datacenter". + label: Datacenter name + regex: + error: Empty datacenter + source: \S + restrictions: + - action: hide + condition: settings:storage.images_vcenter.value == false or settings:common.libvirt_type.value + != 'vcenter' + type: text + value: '' + weight: 65 + vc_datastore: + description: Datastore associated with the datacenter. + label: Datastore name + regex: + error: Empty datastore + source: \S + restrictions: + - action: hide + condition: settings:storage.images_vcenter.value == false or settings:common.libvirt_type.value + != 'vcenter' + type: text + value: '' + weight: 60 + vc_host: + description: IP Address of vCenter/ESXi + label: vCenter/ESXi IP + regex: + error: Specify valid IPv4 address + source: ^(([\d]|[1-9][\d]|1[\d]{2}|2[0-4][\d]|25[0-5])\.){3}([\d]|[1-9][\d]|1[\d]{2}|2[0-4][\d]|25[0-5])$ + restrictions: + - action: hide + condition: settings:storage.images_vcenter.value == false or settings:common.libvirt_type.value + != 'vcenter' + type: text + value: '' + weight: 45 + vc_image_dir: + description: The name of the directory where the glance images will be stored + in the VMware datastore. + label: Datastore Images directory + regex: + error: Empty images directory + source: \S + restrictions: + - action: hide + condition: settings:storage.images_vcenter.value == false or settings:common.libvirt_type.value + != 'vcenter' + type: text + value: /openstack_glance + weight: 70 + vc_password: + description: vCenter/ESXi admin password + label: Password + regex: + error: Empty password + source: \S + restrictions: + - action: hide + condition: settings:storage.images_vcenter.value == false or settings:common.libvirt_type.value + != 'vcenter' + type: password + value: '' + weight: 55 + vc_user: + description: vCenter/ESXi admin username + label: Username + regex: + error: Empty username + source: \S + restrictions: + - action: hide + condition: settings:storage.images_vcenter.value == false or settings:common.libvirt_type.value + != 'vcenter' + type: text + value: '' + weight: 50 + volumes_ceph: + description: Configures Cinder to store volumes in Ceph RBD images. + label: Ceph RBD for volumes (Cinder) + restrictions: + - settings:storage.volumes_lvm.value == true or settings:common.libvirt_type.value + == 'vcenter' + type: checkbox + value: false + weight: 20 + volumes_lvm: + description: Requires at least one Storage - Cinder LVM node. + label: Cinder LVM over iSCSI for volumes + restrictions: + - settings:storage.volumes_ceph.value == true + type: checkbox + value: false + weight: 10 + volumes_vmdk: + description: Configures Cinder to store volumes via VMware vCenter. + label: VMware vCenter for volumes (Cinder) + restrictions: + - settings:common.libvirt_type.value != 'vcenter' or settings:storage.volumes_lvm.value + == true + type: checkbox + value: false + weight: 15 + syslog: + metadata: + label: Syslog + weight: 50 + syslog_port: + description: Remote syslog port + label: Port + regex: + error: Invalid Syslog port + source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ + type: text + value: '514' + weight: 20 + syslog_server: + description: Remote syslog hostname + label: Hostname + type: text + value: '' + weight: 10 + syslog_transport: + label: Syslog transport protocol + type: radio + value: tcp + values: + - data: udp + description: '' + label: UDP + - data: tcp + description: '' + label: TCP + weight: 30 + vcenter: + cluster: + description: vCenter cluster name. If you have multiple clusters, use comma + to separate names + label: Cluster + regex: + error: Invalid cluster list + source: ^([^,\ ]+([\ ]*[^,\ ])*)(,[^,\ ]+([\ ]*[^,\ ])*)*$ + type: text + value: '' + weight: 40 + datastore_regex: + description: The Datastore regexp setting specifies the data stores to use + with Compute. For example, "nas.*". If you want to use all available datastores, + leave this field blank + label: Datastore regexp + regex: + error: Invalid datastore regexp + source: ^(\S.*\S|\S|)$ + type: text + value: '' + weight: 50 + host_ip: + description: IP Address of vCenter + label: vCenter IP + regex: + error: Specify valid IPv4 address + source: ^(([\d]|[1-9][\d]|1[\d]{2}|2[0-4][\d]|25[0-5])\.){3}([\d]|[1-9][\d]|1[\d]{2}|2[0-4][\d]|25[0-5])$ + type: text + value: '' + weight: 10 + metadata: + label: vCenter + restrictions: + - action: hide + condition: settings:common.libvirt_type.value != 'vcenter' + weight: 20 + use_vcenter: + description: '' + label: '' + type: hidden + value: true + weight: 5 + vc_password: + description: vCenter admin password + label: Password + regex: + error: Empty password + source: \S + type: password + value: '' + weight: 30 + vc_user: + description: vCenter admin username + label: Username + regex: + error: Empty username + source: \S + type: text + value: '' + weight: 20 + vlan_interface: + description: Physical ESXi host ethernet adapter for VLAN networking (e.g. + vmnic1). If empty "vmnic0" is used by default + label: ESXi VLAN interface + restrictions: + - action: hide + condition: cluster:net_provider != 'nova_network' or networking_parameters:net_manager + != 'VlanManager' + type: text + value: '' + weight: 60 + zabbix: + metadata: + label: Zabbix Access + restrictions: + - action: hide + condition: not ('experimental' in version:feature_groups) + weight: 70 + password: + description: Password for Zabbix Administrator + label: password + type: password + value: zabbix + weight: 20 + username: + description: Username for Zabbix Administrator + label: username + type: text + value: admin + weight: 10 +interfaces: + eth0: + - fuelweb_admin + - management + eth1: + - storage + eth2: + - private + eth3: + - public diff --git a/fuel/prototypes/libvirt/examples/networks/fuel1 b/fuel/prototypes/libvirt/examples/networks/fuel1 new file mode 100644 index 0000000..7b2b154 --- /dev/null +++ b/fuel/prototypes/libvirt/examples/networks/fuel1 @@ -0,0 +1,12 @@ +<network> + <name>fuel1</name> + <forward mode='nat'> + <nat> + <port start='1024' end='65535'/> + </nat> + </forward> + <bridge name='fuel1' stp='on' delay='0'/> + <ip address='10.20.0.1' netmask='255.255.255.0'> + </ip> +</network> + diff --git a/fuel/prototypes/libvirt/examples/networks/fuel2 b/fuel/prototypes/libvirt/examples/networks/fuel2 new file mode 100644 index 0000000..615c920 --- /dev/null +++ b/fuel/prototypes/libvirt/examples/networks/fuel2 @@ -0,0 +1,5 @@ +<network> + <name>fuel2</name> + <bridge name='fuel2' stp='on' delay='0'/> +</network> + diff --git a/fuel/prototypes/libvirt/examples/networks/fuel3 b/fuel/prototypes/libvirt/examples/networks/fuel3 new file mode 100644 index 0000000..2383e6c --- /dev/null +++ b/fuel/prototypes/libvirt/examples/networks/fuel3 @@ -0,0 +1,5 @@ +<network> + <name>fuel3</name> + <bridge name='fuel3' stp='on' delay='0'/> +</network> + diff --git a/fuel/prototypes/libvirt/examples/networks/fuel4 b/fuel/prototypes/libvirt/examples/networks/fuel4 new file mode 100644 index 0000000..5b69f91 --- /dev/null +++ b/fuel/prototypes/libvirt/examples/networks/fuel4 @@ -0,0 +1,12 @@ +<network> + <name>fuel4</name> + <forward mode='nat'> + <nat> + <port start='1024' end='65535'/> + </nat> + </forward> + <bridge name='fuel4' stp='on' delay='0'/> + <ip address='172.16.0.1' netmask='255.255.255.0'> + </ip> +</network> + diff --git a/fuel/prototypes/libvirt/examples/vms/compute4 b/fuel/prototypes/libvirt/examples/vms/compute4 new file mode 100644 index 0000000..ec98eab --- /dev/null +++ b/fuel/prototypes/libvirt/examples/vms/compute4 @@ -0,0 +1,101 @@ +<domain type='kvm'> + <name>compute4</name> + <memory unit='KiB'>8388608</memory> + <currentMemory unit='KiB'>8388608</currentMemory> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64' machine='pc-1.0'>hvm</type> + <boot dev='network'/> + <boot dev='hd'/> + <bootmenu enable='yes'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <cpu mode='custom' match='exact'> + <model fallback='allow'>SandyBridge</model> + <vendor>Intel</vendor> + <feature policy='require' name='vme'/> + <feature policy='require' name='dtes64'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='erms'/> + <feature policy='require' name='xtpr'/> + <feature policy='require' name='smep'/> + <feature policy='require' name='pcid'/> + <feature policy='require' name='est'/> + <feature policy='require' name='monitor'/> + <feature policy='require' name='smx'/> + <feature policy='require' name='tm'/> + <feature policy='require' name='acpi'/> + <feature policy='require' name='osxsave'/> + <feature policy='require' name='ht'/> + <feature policy='require' name='pdcm'/> + <feature policy='require' name='fsgsbase'/> + <feature policy='require' name='f16c'/> + <feature policy='require' name='ds'/> + <feature policy='require' name='tm2'/> + <feature policy='require' name='ss'/> + <feature policy='require' name='pbe'/> + <feature policy='require' name='ds_cpl'/> + <feature policy='require' name='rdrand'/> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <devices> + <emulator>/usr/bin/kvm</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='disk.raw'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + </disk> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <interface type='network'> + <source network='fuel1'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel2'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel3'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel4'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> + </interface> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='sv'/> + <sound model='ich6'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </sound> + <video> + <model type='cirrus' vram='9216' heads='1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> + </memballoon> + </devices> +</domain> + diff --git a/fuel/prototypes/libvirt/examples/vms/compute5 b/fuel/prototypes/libvirt/examples/vms/compute5 new file mode 100644 index 0000000..411be64 --- /dev/null +++ b/fuel/prototypes/libvirt/examples/vms/compute5 @@ -0,0 +1,100 @@ +<domain type='kvm'> + <name>compute5</name> + <memory unit='KiB'>8388608</memory> + <currentMemory unit='KiB'>8388608</currentMemory> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64' machine='pc-1.0'>hvm</type> + <boot dev='network'/> + <boot dev='hd'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <cpu mode='custom' match='exact'> + <model fallback='allow'>SandyBridge</model> + <vendor>Intel</vendor> + <feature policy='require' name='vme'/> + <feature policy='require' name='dtes64'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='erms'/> + <feature policy='require' name='xtpr'/> + <feature policy='require' name='smep'/> + <feature policy='require' name='pcid'/> + <feature policy='require' name='est'/> + <feature policy='require' name='monitor'/> + <feature policy='require' name='smx'/> + <feature policy='require' name='tm'/> + <feature policy='require' name='acpi'/> + <feature policy='require' name='osxsave'/> + <feature policy='require' name='ht'/> + <feature policy='require' name='pdcm'/> + <feature policy='require' name='fsgsbase'/> + <feature policy='require' name='f16c'/> + <feature policy='require' name='ds'/> + <feature policy='require' name='tm2'/> + <feature policy='require' name='ss'/> + <feature policy='require' name='pbe'/> + <feature policy='require' name='ds_cpl'/> + <feature policy='require' name='rdrand'/> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <devices> + <emulator>/usr/bin/kvm</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='disk.raw'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + </disk> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <interface type='network'> + <source network='fuel1'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel2'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel3'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel4'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> + </interface> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='sv'/> + <sound model='ich6'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </sound> + <video> + <model type='cirrus' vram='9216' heads='1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> + </memballoon> + </devices> +</domain> + diff --git a/fuel/prototypes/libvirt/examples/vms/controller1 b/fuel/prototypes/libvirt/examples/vms/controller1 new file mode 100644 index 0000000..f82ad28 --- /dev/null +++ b/fuel/prototypes/libvirt/examples/vms/controller1 @@ -0,0 +1,100 @@ +<domain type='kvm'> + <name>controller1</name> + <memory unit='KiB'>2097152</memory> + <currentMemory unit='KiB'>2097152</currentMemory> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64' machine='pc-1.0'>hvm</type> + <boot dev='network'/> + <boot dev='hd'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <cpu mode='custom' match='exact'> + <model fallback='allow'>SandyBridge</model> + <vendor>Intel</vendor> + <feature policy='require' name='vme'/> + <feature policy='require' name='dtes64'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='erms'/> + <feature policy='require' name='xtpr'/> + <feature policy='require' name='smep'/> + <feature policy='require' name='pcid'/> + <feature policy='require' name='est'/> + <feature policy='require' name='monitor'/> + <feature policy='require' name='smx'/> + <feature policy='require' name='tm'/> + <feature policy='require' name='acpi'/> + <feature policy='require' name='osxsave'/> + <feature policy='require' name='ht'/> + <feature policy='require' name='pdcm'/> + <feature policy='require' name='fsgsbase'/> + <feature policy='require' name='f16c'/> + <feature policy='require' name='ds'/> + <feature policy='require' name='tm2'/> + <feature policy='require' name='ss'/> + <feature policy='require' name='pbe'/> + <feature policy='require' name='ds_cpl'/> + <feature policy='require' name='rdrand'/> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <devices> + <emulator>/usr/bin/kvm</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='disk.raw'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + </disk> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <interface type='network'> + <source network='fuel1'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel2'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel3'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel4'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> + </interface> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='sv'/> + <sound model='ich6'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </sound> + <video> + <model type='cirrus' vram='9216' heads='1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> + </memballoon> + </devices> +</domain> + diff --git a/fuel/prototypes/libvirt/examples/vms/controller2 b/fuel/prototypes/libvirt/examples/vms/controller2 new file mode 100644 index 0000000..63ad86a --- /dev/null +++ b/fuel/prototypes/libvirt/examples/vms/controller2 @@ -0,0 +1,100 @@ +<domain type='kvm'> + <name>controller2</name> + <memory unit='KiB'>2097152</memory> + <currentMemory unit='KiB'>2097152</currentMemory> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64' machine='pc-1.0'>hvm</type> + <boot dev='network'/> + <boot dev='hd'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <cpu mode='custom' match='exact'> + <model fallback='allow'>SandyBridge</model> + <vendor>Intel</vendor> + <feature policy='require' name='vme'/> + <feature policy='require' name='dtes64'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='erms'/> + <feature policy='require' name='xtpr'/> + <feature policy='require' name='smep'/> + <feature policy='require' name='pcid'/> + <feature policy='require' name='est'/> + <feature policy='require' name='monitor'/> + <feature policy='require' name='smx'/> + <feature policy='require' name='tm'/> + <feature policy='require' name='acpi'/> + <feature policy='require' name='osxsave'/> + <feature policy='require' name='ht'/> + <feature policy='require' name='pdcm'/> + <feature policy='require' name='fsgsbase'/> + <feature policy='require' name='f16c'/> + <feature policy='require' name='ds'/> + <feature policy='require' name='tm2'/> + <feature policy='require' name='ss'/> + <feature policy='require' name='pbe'/> + <feature policy='require' name='ds_cpl'/> + <feature policy='require' name='rdrand'/> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <devices> + <emulator>/usr/bin/kvm</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='disk.raw'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + </disk> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <interface type='network'> + <source network='fuel1'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel2'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel3'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel4'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> + </interface> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='sv'/> + <sound model='ich6'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </sound> + <video> + <model type='cirrus' vram='9216' heads='1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> + </memballoon> + </devices> +</domain> + diff --git a/fuel/prototypes/libvirt/examples/vms/controller3 b/fuel/prototypes/libvirt/examples/vms/controller3 new file mode 100644 index 0000000..7c64a9d --- /dev/null +++ b/fuel/prototypes/libvirt/examples/vms/controller3 @@ -0,0 +1,100 @@ +<domain type='kvm'> + <name>controller3</name> + <memory unit='KiB'>2097152</memory> + <currentMemory unit='KiB'>2097152</currentMemory> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64' machine='pc-1.0'>hvm</type> + <boot dev='network'/> + <boot dev='hd'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <cpu mode='custom' match='exact'> + <model fallback='allow'>SandyBridge</model> + <vendor>Intel</vendor> + <feature policy='require' name='vme'/> + <feature policy='require' name='dtes64'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='erms'/> + <feature policy='require' name='xtpr'/> + <feature policy='require' name='smep'/> + <feature policy='require' name='pcid'/> + <feature policy='require' name='est'/> + <feature policy='require' name='monitor'/> + <feature policy='require' name='smx'/> + <feature policy='require' name='tm'/> + <feature policy='require' name='acpi'/> + <feature policy='require' name='osxsave'/> + <feature policy='require' name='ht'/> + <feature policy='require' name='pdcm'/> + <feature policy='require' name='fsgsbase'/> + <feature policy='require' name='f16c'/> + <feature policy='require' name='ds'/> + <feature policy='require' name='tm2'/> + <feature policy='require' name='ss'/> + <feature policy='require' name='pbe'/> + <feature policy='require' name='ds_cpl'/> + <feature policy='require' name='rdrand'/> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <devices> + <emulator>/usr/bin/kvm</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='disk.raw'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + </disk> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <interface type='network'> + <source network='fuel1'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel2'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel3'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </interface> + <interface type='network'> + <source network='fuel4'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> + </interface> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='sv'/> + <sound model='ich6'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </sound> + <video> + <model type='cirrus' vram='9216' heads='1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> + </memballoon> + </devices> +</domain> + diff --git a/fuel/prototypes/libvirt/examples/vms/fuel-master b/fuel/prototypes/libvirt/examples/vms/fuel-master new file mode 100644 index 0000000..1b2d86f --- /dev/null +++ b/fuel/prototypes/libvirt/examples/vms/fuel-master @@ -0,0 +1,95 @@ +<domain type='kvm'> + <name>fuel-master</name> + <memory unit='KiB'>2097152</memory> + <currentMemory unit='KiB'>2097152</currentMemory> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64' machine='pc-1.0'>hvm</type> + <boot dev='hd'/> + <boot dev='cdrom'/> + <bootmenu enable='yes'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <cpu mode='custom' match='exact'> + <model fallback='allow'>SandyBridge</model> + <vendor>Intel</vendor> + <feature policy='require' name='vme'/> + <feature policy='require' name='dtes64'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='erms'/> + <feature policy='require' name='xtpr'/> + <feature policy='require' name='smep'/> + <feature policy='require' name='pcid'/> + <feature policy='require' name='est'/> + <feature policy='require' name='monitor'/> + <feature policy='require' name='smx'/> + <feature policy='require' name='tm'/> + <feature policy='require' name='acpi'/> + <feature policy='require' name='osxsave'/> + <feature policy='require' name='ht'/> + <feature policy='require' name='pdcm'/> + <feature policy='require' name='fsgsbase'/> + <feature policy='require' name='f16c'/> + <feature policy='require' name='ds'/> + <feature policy='require' name='tm2'/> + <feature policy='require' name='ss'/> + <feature policy='require' name='pbe'/> + <feature policy='require' name='ds_cpl'/> + <feature policy='require' name='rdrand'/> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <devices> + <emulator>/usr/bin/kvm</emulator> + <disk type='file' device='cdrom'> + <driver name='qemu' type='raw'/> + <target dev='hdc' bus='ide'/> + <readonly/> + <address type='drive' controller='0' bus='1' target='0' unit='0'/> + </disk> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='disk.raw'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + </disk> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <interface type='network'> + <source network='fuel1'/> + <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </interface> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='sv'/> + <sound model='ich6'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </sound> + <video> + <model type='cirrus' vram='9216' heads='1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> + </memballoon> + </devices> +</domain> + diff --git a/fuel/prototypes/libvirt/setup_vms/apply_setup.sh b/fuel/prototypes/libvirt/setup_vms/apply_setup.sh new file mode 100755 index 0000000..1598d66 --- /dev/null +++ b/fuel/prototypes/libvirt/setup_vms/apply_setup.sh @@ -0,0 +1,61 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +error_exit () { + echo "$@" + exit 1 +} + +netdir='../examples/networks' +vmdir='../examples/vms' +tmpfile=/tmp/foo + +if [ ! -d $netdir ]; then + error_exit "No net directory $netdir" + exit 1 +elif [ ! -d $vmdir ]; then + error_exit "No VM directory $vmdir" + exit 1 +fi + +if [ $# -ne 2 ]; then + echo "Argument error." + echo "`basename $0` <path to storage dir> <size in GB of disk per VM>" + exit 1 +fi + +storagedir=$1 +size=$2 + +if [ ! -d $storagedir ]; then + error_exit "Could not find storagedir directory $storagedir" +fi + +# Create storage space and patch it in +for vm in $vmdir/* +do + storage=${storagedir}/`basename ${vm}`.raw + if [ -f ${storage} ]; then + error_exit "Storage already present: ${storage}" + fi + echo "Creating ${size} GB of storage in ${storage}" + fallocate -l ${size}G ${storage} || \ + error_exit "Could not create storage" + sed "s:<source file='disk.raw':<source file='${storage}':" $vm >$tmpfile + virsh define $tmpfile +done + +for net in $netdir/* +do + virsh net-define $net + virsh net-autostart `basename $net` + virsh net-start `basename $net` +done diff --git a/fuel/prototypes/libvirt/setup_vms/dump_setup.sh b/fuel/prototypes/libvirt/setup_vms/dump_setup.sh new file mode 100755 index 0000000..b65cf31 --- /dev/null +++ b/fuel/prototypes/libvirt/setup_vms/dump_setup.sh @@ -0,0 +1,59 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +netdir='../examples/networks' +vmdir='../examples/vms' + +if [ -d $netdir ]; then + echo "Net directory already present" + exit 1 +elif [ -d $vmdir ]; then + echo "VM directory already present" + exit 1 +fi + +mkdir -p $netdir +mkdir -p $vmdir + +# Check that no VM is up +if virsh list | egrep -q "fuel-master|controller|compute" ; then + echo "Can't dump while VMs are up:" + virsh list | egrep "fuel-master|controller|compute" + exit 1 +fi + +# Dump all networks in the fuell* namespace +for net in `virsh net-list --all | tail -n+3 | awk '{ print $1 }' | grep fuel` +do + virsh net-dumpxml $net > $netdir/$net +done + +# Dump all fuel-master, compute* and controller* VMs +for vm in `virsh list --all | tail -n+3 | awk '{ print $2 }' | egrep 'fuel-master|compute|controller'` +do + virsh dumpxml $vm > $vmdir/$vm +done + +# Remove all attached ISOs, generalize the rest of the setup +for vm in $vmdir/* +do + sed -i '/.iso/d' $vm + sed -i "s/<source file='.*raw'/<source file='disk.raw'/" $vm + sed -i '/<uuid/d' $vm + sed -i '/<mac/d' $vm +done + +# Generalize all nets +for net in $netdir/* +do + sed -i '/<uuid/d' $net + sed -i '/<mac/d' $net +done diff --git a/fuel/prototypes/libvirt/setup_vms/setup-vm-host.sh b/fuel/prototypes/libvirt/setup_vms/setup-vm-host.sh new file mode 100755 index 0000000..58ce19a --- /dev/null +++ b/fuel/prototypes/libvirt/setup_vms/setup-vm-host.sh @@ -0,0 +1,16 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# Tools for installation on the libvirt server/base host +# +apt-get install -y libvirt-bin qemu-kvm tightvncserver virt-manager \ + sshpass fuseiso genisoimage blackbox xterm +restart libvirt-bin |