remove javelin1 & javelin2
javelin is obsoleted for direct use in grenade by the resource plugin scripts, so remove the coupling and reference to it. Change-Id: Ieaf63f0162f8d87a96058e941fb5b1f3e750dd2b
This commit is contained in:
parent
5e7f2d0880
commit
2c48491897
@ -243,9 +243,6 @@ if [[ "$RUN_BASE" == "True" ]]; then
|
||||
# Verify the resources were created
|
||||
resources verify
|
||||
|
||||
# Create the javelin resources
|
||||
run_javelin create
|
||||
|
||||
# Save some stuff before we shut that whole thing down
|
||||
echo_summary "Saving current state information"
|
||||
$GRENADE_DIR/save-state
|
||||
@ -290,9 +287,6 @@ if [[ "$RUN_TARGET" == "True" ]]; then
|
||||
# Verify the resources still exist after the upgrade
|
||||
resources verify
|
||||
|
||||
# Validate the created resources
|
||||
run_javelin check
|
||||
|
||||
# Validate the upgrade
|
||||
if [[ "$TARGET_RUN_SMOKE" == "True" ]]; then
|
||||
echo_summary "Running tempest scenario and smoke tests"
|
||||
@ -308,8 +302,6 @@ if [[ "$RUN_TARGET" == "True" ]]; then
|
||||
# Cleanup the resources
|
||||
resources destroy
|
||||
|
||||
# Cleanup all resources created by javelin
|
||||
run_javelin destroy
|
||||
fi
|
||||
|
||||
|
||||
|
37
inc/upgrade
37
inc/upgrade
@ -196,40 +196,3 @@ function ensure_logs_exist {
|
||||
die $LINENO "The following service logs were not found: $not_found"
|
||||
fi
|
||||
}
|
||||
|
||||
# run the javelin resource create / check / destroy tool. This is
|
||||
# encapsulated in a convenience function because of the hoops required
|
||||
# to jump through given that it's pulling pieces out of the tempest
|
||||
# directory.
|
||||
function run_javelin() {
|
||||
if [[ "$RUN_JAVELIN" != "True" ]]; then
|
||||
return
|
||||
fi
|
||||
local action=$1
|
||||
local tempest_dir=$BASE_RELEASE_DIR/tempest
|
||||
local javelin_conf=$tempest_dir/etc/javelin.conf
|
||||
local javelin_resources=$SAVE_DIR/resources.yaml
|
||||
|
||||
if [ ! -e $javelin_conf ]; then
|
||||
# initialize javelin config
|
||||
local tempest_conf=$tempest_dir/etc/tempest.conf
|
||||
cp $tempest_conf $javelin_conf
|
||||
# Make javelin write logs to javelin.log
|
||||
iniset $javelin_conf DEFAULT log_file $LOGDIR/javelin.log
|
||||
echo "Logs can be found at javelin.log"
|
||||
fi
|
||||
|
||||
if [ ! -e $javelin_resources ]; then
|
||||
mkdir -p $SAVE_DIR
|
||||
# Generate javelin2 resources configuration
|
||||
(source $BASE_DEVSTACK_DIR/functions; source $BASE_DEVSTACK_DIR/stackrc;
|
||||
$GRENADE_DIR/tools/generate_javelin_resources.py -o $javelin_resources \
|
||||
$ENABLED_SERVICES)
|
||||
fi
|
||||
|
||||
echo_summary "Running Javelin to $action resources"
|
||||
|
||||
cd $tempest_dir
|
||||
(source $BASE_DEVSTACK_DIR/openrc admin admin;
|
||||
tox -evenv -- javelin2 -m $action -r $javelin_resources -d $BASE_DEVSTACK_DIR -c $javelin_conf)
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
# Javelin tenant configuration
|
||||
|
||||
JPROJECT=javelin
|
||||
JUSER=javelin
|
||||
JPASSWORD=gungnir
|
||||
JAVELIN_SECGROUP=angon
|
||||
JAVELIN_VOLUME=assegai
|
||||
JSERVER=peltast
|
||||
|
@ -1,9 +0,0 @@
|
||||
# Set up Javelin tenant credentials
|
||||
|
||||
RC_DIR=$(cd $(dirname "$BASH_SOURCE") && pwd)
|
||||
|
||||
source $RC_DIR/grenaderc
|
||||
source $RC_DIR/javelin.conf
|
||||
source $BASE_DEVSTACK_DIR/openrc $JUSER $JPROJECT
|
||||
export OS_PASSWORD=$JPASSWORD
|
||||
|
150
setup-javelin
150
setup-javelin
@ -1,150 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ``setup-javelin``
|
||||
|
||||
# Keep track of the grenade directory
|
||||
GRENADE_DIR=$(cd $(dirname "$0") && pwd)
|
||||
|
||||
# Import common functions
|
||||
source $GRENADE_DIR/functions
|
||||
|
||||
# Determine what system we are running on. This provides ``os_VENDOR``,
|
||||
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
|
||||
# and ``DISTRO``
|
||||
GetDistro
|
||||
|
||||
# Source params
|
||||
source $GRENADE_DIR/grenaderc
|
||||
|
||||
# For debugging
|
||||
set -o xtrace
|
||||
|
||||
|
||||
# Create Javelin Project
|
||||
# ======================
|
||||
|
||||
# Get DevStack Configuration
|
||||
source $BASE_DEVSTACK_DIR/openrc admin admin
|
||||
|
||||
# Our configuration
|
||||
source $GRENADE_DIR/javelin.conf
|
||||
|
||||
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}
|
||||
|
||||
|
||||
# Add To Keystone
|
||||
# ---------------
|
||||
|
||||
function get_id () {
|
||||
echo `"$@" | awk '/ id / { print $4 }'`
|
||||
}
|
||||
|
||||
# Create javelin project and user
|
||||
JAVELIN_TENANT=$(keystone tenant-list | awk "/ $JPROJECT / { print \$2 }")
|
||||
[[ -z "$JAVELIN_TENANT" ]] && \
|
||||
JAVELIN_TENANT=$(get_id keystone tenant-create --name=$JPROJECT)
|
||||
|
||||
JAVELIN_USER=$(keystone user-list | awk "/ $JUSER / { print \$2 }")
|
||||
[[ -z "$JAVELIN_USER" ]] && \
|
||||
JAVELIN_USER=$(get_id keystone user-create --name=$JUSER \
|
||||
--pass="$JPASSWORD" \
|
||||
--email=bob@javelin.org)
|
||||
|
||||
MEMBER_ROLE=$(keystone role-list | awk "/ Member / { print \$2 }")
|
||||
keystone user-role-add --tenant_id $JAVELIN_TENANT \
|
||||
--user_id $JAVELIN_USER \
|
||||
--role_id $MEMBER_ROLE
|
||||
|
||||
|
||||
# Switch Identities
|
||||
# -----------------
|
||||
|
||||
source $BASE_DEVSTACK_DIR/openrc $JPROJECT $JUSER
|
||||
export OS_PASSWORD=$JPASSWORD
|
||||
|
||||
|
||||
# Add Custom Image
|
||||
# ----------------
|
||||
|
||||
# It's really cirros with our own name
|
||||
# Assumes DevStack.$BASE has already set this up
|
||||
CIRROS_IMAGE=${DEFAULT_IMAGE_NAME:-cirros-0.3.2-x86_64-uec}
|
||||
CIRROS_DIR=$BASE_DEVSTACK_DIR/files/images/$CIRROS_IMAGE
|
||||
KERNEL=$CIRROS_DIR/${CIRROS_IMAGE/uec/}vmlinuz
|
||||
RAMDISK=$CIRROS_DIR/${CIRROS_IMAGE/uec/}initrd
|
||||
ROOTDISK=$CIRROS_DIR/${CIRROS_IMAGE/uec/}blank.img
|
||||
JAVELIN_IMAGE=${CIRROS_IMAGE/cirros/javelin}
|
||||
IMAGE_ID=$(cat /proc/sys/kernel/random/uuid)
|
||||
|
||||
IMAGE=$(nova image-list | awk "/ $JAVELIN_IMAGE.img / { print \$2 }")
|
||||
if [[ -z "$IMAGE" ]]; then
|
||||
glance image-create --name $JAVELIN_IMAGE-kernel --is-public True --container-format aki --disk-format aki < "$KERNEL_ID"
|
||||
glance image-create --name $JAVELIN_IMAGE-ramdisk --is-public True --container-format ari --disk-format ari < "$RAMDISK_ID"
|
||||
glance image-create --name $JAVELIN_IMAGE.img --is-public True --id $IMAGE_ID --container-format ami --disk-format ami --property kernel_id=$KERNEL_ID --property ramdisk_id=$RAMDISK_ID < "${ROOTDISK}"
|
||||
|
||||
IMAGE=$IMAGE_ID
|
||||
die_if_not_set $LINENO IMAGE "Failure getting image"
|
||||
fi
|
||||
|
||||
|
||||
# Add Custom Security Group
|
||||
# -------------------------
|
||||
|
||||
# Create our secgroup
|
||||
if ! nova secgroup-list | grep -q $JAVELIN_SECGROUP; then
|
||||
nova secgroup-create $JAVELIN_SECGROUP "$JPROJECT access rules"
|
||||
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $JAVELIN_SECGROUP; do sleep 1; done"; then
|
||||
die $LINENO "$JAVELIN_SECGROUP security group not created"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add some rules
|
||||
if ! nova secgroup-list-rules $JAVELIN_SECGROUP | grep tcp | grep -q 22; then
|
||||
nova secgroup-add-rule $JAVELIN_SECGROUP icmp -1 -1 0.0.0.0/0
|
||||
nova secgroup-add-rule $JAVELIN_SECGROUP tcp 22 22 0.0.0.0/0
|
||||
fi
|
||||
|
||||
|
||||
# Identify A Flavor
|
||||
# -----------------
|
||||
|
||||
FLAVOR=`nova flavor-list | grep $DEFAULT_INSTANCE_TYPE | get_field 1`
|
||||
if [[ -z "$FLAVOR" ]]; then
|
||||
# Grab the first flavor in the list to launch if default doesn't exist
|
||||
FLAVOR=`nova flavor-list | head -n 4 | tail -n 1 | get_field 1`
|
||||
fi
|
||||
|
||||
|
||||
# Create a Volume
|
||||
# ---------------
|
||||
|
||||
if ! nova volume-list | grep -q $JAVELIN_VOLUME; then
|
||||
nova volume-create --display_name=$JAVELIN_VOLUME 1
|
||||
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $JAVELIN_VOLUME | grep -q available; do sleep 1; done"; then
|
||||
die $LINENO "$JAVELIN_VOLUME volume not created"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create An Instance
|
||||
# ------------------
|
||||
|
||||
# Boot an instance
|
||||
BOOT_TXT=$(nova boot --flavor "$FLAVOR" --image "$IMAGE" $JSERVER | awk "/adminPass/ { print \$2 \"=\" \$4 };/ id / { print \$2 \"=\" \$4 }"; exit ${PIPESTATUS[0]})
|
||||
ret=$?
|
||||
if [[ ! $ret = 0 ]]; then
|
||||
die $LINENO "Failed to boot $JSERVER"
|
||||
fi
|
||||
eval $BOOT_TXT
|
||||
|
||||
# Check that the status is active within ACTIVE_TIMEOUT seconds
|
||||
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $id | grep status | grep -q ACTIVE; do sleep 1; done"; then
|
||||
die $LINENO "server didn't become active!"
|
||||
fi
|
||||
|
||||
# Put some stuff in Swift
|
||||
# -----------------------
|
||||
|
||||
swift upload javelin /etc/hosts
|
||||
if ! swift list javelin | grep -q hosts; then
|
||||
die $LINENO "Swift upload failed"
|
||||
fi
|
@ -1,95 +0,0 @@
|
||||
# This is a yaml description for the most basic definitions
|
||||
# of what should exist across the resource boundary. Perhaps
|
||||
# one day this will grow into a Heat resource template, but as
|
||||
# Heat isn't a known working element in the upgrades, we do
|
||||
# this much simpler thing for now.
|
||||
|
||||
tenants:
|
||||
- javelin
|
||||
- discuss
|
||||
|
||||
users:
|
||||
- name: javelin
|
||||
pass: gungnir
|
||||
tenant: javelin
|
||||
- name: javelin2
|
||||
pass: gungnir2
|
||||
tenant: discuss
|
||||
|
||||
secgroups:
|
||||
- name: angon
|
||||
owner: javelin
|
||||
description: angon
|
||||
rules:
|
||||
- 'icmp -1 -1 0.0.0.0/0'
|
||||
- 'tcp 22 22 0.0.0.0/0'
|
||||
- name: baobab
|
||||
owner: javelin
|
||||
description: baobab
|
||||
rules:
|
||||
- 'tcp 80 80 0.0.0.0/0'
|
||||
|
||||
# resources that we want to create
|
||||
images:
|
||||
- name: javelin_cirros
|
||||
owner: javelin
|
||||
imgdir: files/images/cirros-0.3.2-x86_64-uec
|
||||
file: cirros-0.3.2-x86_64-blank.img
|
||||
format: ami
|
||||
aki: cirros-0.3.2-x86_64-vmlinuz
|
||||
ari: cirros-0.3.2-x86_64-initrd
|
||||
volumes:
|
||||
- name: assegai
|
||||
owner: javelin
|
||||
gb: 1
|
||||
server: peltast
|
||||
device: /dev/vdb
|
||||
- name: pifpouf
|
||||
owner: javelin
|
||||
gb: 2
|
||||
server: hoplite
|
||||
device: /dev/vdb
|
||||
networks:
|
||||
- name: world1
|
||||
owner: javelin
|
||||
- name: world2
|
||||
owner: javelin
|
||||
subnets:
|
||||
- name: subnet1
|
||||
range: 10.1.0.0/24
|
||||
network: world1
|
||||
owner: javelin
|
||||
- name: subnet2
|
||||
range: 192.168.1.0/24
|
||||
network: world2
|
||||
owner: javelin
|
||||
routers:
|
||||
- name: connector
|
||||
owner: javelin
|
||||
gateway: true
|
||||
subnet:
|
||||
- subnet1
|
||||
- subnet2
|
||||
servers:
|
||||
- name: peltast
|
||||
owner: javelin
|
||||
flavor: m1.tiny
|
||||
image: javelin_cirros
|
||||
networks:
|
||||
- world1
|
||||
secgroups:
|
||||
- angon
|
||||
- baobab
|
||||
- name: hoplite
|
||||
owner: javelin
|
||||
flavor: m1.micro
|
||||
image: javelin_cirros
|
||||
networks:
|
||||
- world2
|
||||
secgroups:
|
||||
- angon
|
||||
objects:
|
||||
- container: jc1
|
||||
name: javelin1
|
||||
owner: javelin
|
||||
file: /etc/hosts
|
@ -1,109 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import argparse
|
||||
import yaml
|
||||
import os
|
||||
import sys
|
||||
|
||||
ENABLED_SERVICES = None
|
||||
|
||||
# Maps service names to possible entries in devstack's ENABLED_SERVICES
|
||||
DEVSTACK_SERVICE_MAP = {
|
||||
'ceilometer': 'ceilometer-',
|
||||
'cinder': 'c-',
|
||||
'glance': 'g-',
|
||||
'heat': 'h-',
|
||||
'ironic': 'ir-',
|
||||
'keystone': 'key',
|
||||
'nova': 'n-',
|
||||
'neutron': 'q-',
|
||||
'swift': 's-',
|
||||
}
|
||||
|
||||
|
||||
def load_base_resources():
|
||||
"""Load the yaml file containing all possible resources"""
|
||||
d = os.path.dirname(sys.argv[0])
|
||||
f = os.path.join(d, 'base_resources.yaml')
|
||||
return yaml.load(open(f, 'r'))
|
||||
|
||||
|
||||
def service_enabled(service):
|
||||
"""Duplicate devstack's is_service_enabled()"""
|
||||
if service in ENABLED_SERVICES:
|
||||
return True
|
||||
abr = DEVSTACK_SERVICE_MAP.get(service)
|
||||
if abr:
|
||||
for svc in ENABLED_SERVICES:
|
||||
if svc.startswith(abr):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_options():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Generate a javelin resources yaml configuration based "
|
||||
"on devstack's enabled services.")
|
||||
parser.add_argument('-o', '--output', action='store', required=False,
|
||||
help='Output file to write yaml javelin resources '
|
||||
'config.')
|
||||
parser.add_argument('enabled_services', metavar='$ENABLED_SERVICES',
|
||||
help='Devstack $ENABLED_SERVICES.')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main():
|
||||
opts = get_options()
|
||||
global ENABLED_SERVICES
|
||||
ENABLED_SERVICES = opts.enabled_services.split(',')
|
||||
base_resources = load_base_resources()
|
||||
enabled_resources = {
|
||||
'tenants': base_resources['tenants'],
|
||||
'users': base_resources['users'],
|
||||
'images': base_resources['images'],
|
||||
'secgroups': base_resources['secgroups'],
|
||||
}
|
||||
|
||||
if service_enabled('cinder'):
|
||||
enabled_resources['volumes'] = base_resources['volumes']
|
||||
|
||||
if service_enabled('swift'):
|
||||
enabled_resources['objects'] = base_resources['objects']
|
||||
|
||||
if service_enabled('neutron'):
|
||||
enabled_resources['networks'] = base_resources['networks']
|
||||
enabled_resources['subnets'] = base_resources['subnets']
|
||||
enabled_resources['routers'] = base_resources['routers']
|
||||
|
||||
# do not create servers for ironic, we need the node resources
|
||||
# to run tempest.
|
||||
if not service_enabled('ironic'):
|
||||
enabled_resources['servers'] = base_resources['servers']
|
||||
# if neutron is not enabled, remove networks
|
||||
if not service_enabled('neutron'):
|
||||
for server in enabled_resources['servers']:
|
||||
del server['networks']
|
||||
|
||||
out = yaml.dump(enabled_resources, default_flow_style=False)
|
||||
print '# Grenade generated javelin2 resources yaml:'
|
||||
print out
|
||||
if opts.output:
|
||||
with open(opts.output, 'w') as f:
|
||||
f.write(out)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user