diff options
-rwxr-xr-x | utils/rubbos_dev_env_setup/deploy.sh | 106 | ||||
-rw-r--r-- | utils/rubbos_dev_env_setup/env_config.sh | 7 | ||||
-rw-r--r-- | utils/rubbos_dev_env_setup/libvirt_template.xml | 41 | ||||
-rwxr-xr-x | utils/rubbos_dev_env_setup/mac_generator.sh | 36 | ||||
-rw-r--r-- | utils/rubbos_dev_env_setup/meta-data_template | 11 | ||||
-rw-r--r-- | utils/rubbos_dev_env_setup/user-data_template | 2 |
6 files changed, 0 insertions, 203 deletions
diff --git a/utils/rubbos_dev_env_setup/deploy.sh b/utils/rubbos_dev_env_setup/deploy.sh deleted file mode 100755 index a4fbfb8b..00000000 --- a/utils/rubbos_dev_env_setup/deploy.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. -# -# 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 modified copy of compass4nfv/deploy/host_virtual.sh - -set -x - -SCRIPT_DIR=`cd ${BASH_SOURCE[0]%/*};pwd` -WORK_DIR=${SCRIPT_DIR}/work - -mkdir -p $WORK_DIR - -source ./env_config.sh - -host_vm_dir=$WORK_DIR/vm - - -function download_iso() -{ - mkdir -p ${WORK_DIR}/cache - curl --connect-timeout 10 -o ${WORK_DIR}/cache/$IMAGE_NAME $IMAGE_URL -} - - -function tear_down_machines() { - for i in $HOSTNAMES; do - echo "tear down machine:" $i - sudo virsh destroy $i - sudo virsh undefine $i - rm -rf $host_vm_dir/$i - done -} - - -function get_host_macs() { - local mac_generator=${SCRIPT_DIR}/mac_generator.sh - local machines= - - chmod +x $mac_generator - mac_array=$($mac_generator $VIRT_NUMBER) - machines=$(echo $mac_array) - - echo $machines -} - -function launch_host_vms() { - mac_array=($(get_host_macs)) - - echo ${mac_array[2]} - echo ${mac_array[*]} - - old_ifs=$IFS - IFS=, - tear_down_machines - echo "bringing up vms ${mac_array[*]}" - i=0 - for host in $HOSTNAMES; do - echo "creating vm disk for instance $host" \ - "ip ${IPADDR_PREFIX}$((i+11))" \ - "mac ${mac_array[$i]}" - vm_dir=$host_vm_dir/$host - mkdir -p $vm_dir - - cp ${WORK_DIR}/cache/$IMAGE_NAME $vm_dir - - # create seed.iso - sed -e "s/REPLACE_IPADDR/${IPADDR_PREFIX}$((i+11))/g" \ - -e "s/REPLACE_GATEWAY/${IPADDR_PREFIX}1/g" \ - -e "s/REPLACE_HOSTNAME/${host}/g" \ - meta-data_template \ - > meta-data - cp user-data_template user-data - genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data - cp seed.iso $vm_dir - - # create vm xml - sed -e "s/REPLACE_MEM/$VIRT_MEM/g" \ - -e "s/REPLACE_CPU/$VIRT_CPUS/g" \ - -e "s/REPLACE_NAME/$host/g" \ - -e "s#REPLACE_IMAGE#$vm_dir/disk.img#g" \ - -e "s#REPLACE_SEED_IMAGE#$vm_dir/seed.iso#g" \ - -e "s/REPLACE_MAC_ADDR/${mac_array[$i]}/g" \ - libvirt_template.xml \ - > $vm_dir/libvirt.xml - - sudo virsh define $vm_dir/libvirt.xml - sudo virsh start $host - let i=i+1 - done - IFS=$old_ifs - rm -rf meta-data user-data seed.iso -} - - -download_iso -launch_host_vms - -set +x - diff --git a/utils/rubbos_dev_env_setup/env_config.sh b/utils/rubbos_dev_env_setup/env_config.sh deleted file mode 100644 index 326b9a57..00000000 --- a/utils/rubbos_dev_env_setup/env_config.sh +++ /dev/null @@ -1,7 +0,0 @@ -export HOSTNAMES=${HOSTNAMES:-"control,httpd,mysql,tomcat,client1,client2,client3,client4,benchmark"} -export VIRT_NUMBER=9 -export VIRT_MEM=4096 -export VIRT_CPUS=4 -export IMAGE_URL=${IMAGE_URL:-"file:///bottlenecks/trusty-server-cloudimg-amd64-disk1.img"} -export IMAGE_NAME=disk.img -export IPADDR_PREFIX="192.168.122." diff --git a/utils/rubbos_dev_env_setup/libvirt_template.xml b/utils/rubbos_dev_env_setup/libvirt_template.xml deleted file mode 100644 index eddeff00..00000000 --- a/utils/rubbos_dev_env_setup/libvirt_template.xml +++ /dev/null @@ -1,41 +0,0 @@ -<domain type='kvm'> - <name>REPLACE_NAME</name> - <memory unit='MiB'>REPLACE_MEM</memory> - <currentMemory unit='MiB'>REPLACE_MEM</currentMemory> - <vcpu placement='static'>REPLACE_CPU</vcpu> - <os> - <type arch='x86_64'>hvm</type> - <boot dev='hd'/> - </os> - <features> - <acpi/><apic/><pae/> - </features> - <clock offset="utc"/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>restart</on_crash> - <devices> - <disk type='file' device='disk'> - <driver name='qemu' type='qcow2'/> - <source file='REPLACE_IMAGE'/> - <target dev='vda' bus='virtio'/> - </disk> - <disk type='file' device='cdrom'> - <driver name='qemu'/> - <source file='REPLACE_SEED_IMAGE'/> - <target dev='hdb'/> - <readonly/> - </disk> - <interface type='network'> - <source network='default'/> - <mac address='REPLACE_MAC_ADDR'/> - <model type='virtio'/> - </interface> - <input type='tablet' bus='usb'/> - <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'/> - <console type='pty'/> - <video> - <model type='cirrus'/> - </video> - </devices> -</domain> diff --git a/utils/rubbos_dev_env_setup/mac_generator.sh b/utils/rubbos_dev_env_setup/mac_generator.sh deleted file mode 100755 index ef78f5f6..00000000 --- a/utils/rubbos_dev_env_setup/mac_generator.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. -# -# 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 modified copy from compass4nfv/deploy/mac_generator.sh - -function mac_address_part() { - hex_number=$(printf '%02x' $RANDOM) - number_length=${#hex_number} - number_start=$(expr $number_length - 2) - echo ${hex_number:$number_start:2} -} - -function mac_address() { - echo "00:00:$(mac_address_part):$(mac_address_part):$(mac_address_part):$(mac_address_part)" -} - -machines='' -for i in `seq $1`; do - mac=$(mac_address) - - if [[ -z $machines ]]; then - machines="${mac}" - else - machines="${machines} ${mac}" - fi -done - -echo ${machines} - diff --git a/utils/rubbos_dev_env_setup/meta-data_template b/utils/rubbos_dev_env_setup/meta-data_template deleted file mode 100644 index 43db6597..00000000 --- a/utils/rubbos_dev_env_setup/meta-data_template +++ /dev/null @@ -1,11 +0,0 @@ -instance-id: iid-abcdeff -network-interfaces: | - # The primary network interface - auto eth0 - iface eth0 inet static - address REPLACE_IPADDR - netmask 255.255.255.0 - gateway REPLACE_GATEWAY - dns-nameservers 8.8.8.8 -local-hostname: REPLACE_HOSTNAME - diff --git a/utils/rubbos_dev_env_setup/user-data_template b/utils/rubbos_dev_env_setup/user-data_template deleted file mode 100644 index 77f616df..00000000 --- a/utils/rubbos_dev_env_setup/user-data_template +++ /dev/null @@ -1,2 +0,0 @@ -#cloud-config - |