diff options
author | Szilard Cserey <szilard.cserey@ericsson.com> | 2015-04-14 15:47:45 +0200 |
---|---|---|
committer | Szilard Cserey <szilard.cserey@ericsson.com> | 2015-04-28 10:01:04 +0200 |
commit | 9c2b6848566a0b80bb44f27cca155a240d69f061 (patch) | |
tree | 5081686f09c3c4662f6b807a196a28cb4acab67a /fuel/deploy/setup_vms | |
parent | e2b2d46756213fde3bca42a49b04e6a1e8792498 (diff) |
Automatic Deployment
- node discovery
- refactoring to support multiple shelves
- configure nodes and interfaces
- provisioning
- deployment
- extending with autodeployment scripts from libvirt prototype
JIRA: [BGS-2] Create Fuel deployment scrip
Signed-off-by: Szilard Cserey <szilard.cserey@ericsson.com>
Change-Id: Ic48f93594914d5bef6c9de34d87434c7cd567198
Diffstat (limited to 'fuel/deploy/setup_vms')
-rwxr-xr-x | fuel/deploy/setup_vms/apply_setup.sh | 61 | ||||
-rwxr-xr-x | fuel/deploy/setup_vms/setup-vm-host.sh | 17 |
2 files changed, 78 insertions, 0 deletions
diff --git a/fuel/deploy/setup_vms/apply_setup.sh b/fuel/deploy/setup_vms/apply_setup.sh new file mode 100755 index 0000000..b38cf5d --- /dev/null +++ b/fuel/deploy/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='../libvirt/networks' +vmdir='../libvirt/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/deploy/setup_vms/setup-vm-host.sh b/fuel/deploy/setup_vms/setup-vm-host.sh new file mode 100755 index 0000000..fd469e6 --- /dev/null +++ b/fuel/deploy/setup_vms/setup-vm-host.sh @@ -0,0 +1,17 @@ +#!/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 python-yaml python-netaddr \ + python-paramiko python-lxml +restart libvirt-bin |