Fix the quota caclulation bugs, add force_cleanup
Change-Id: I99cc22325d69d271d6cc98479bda9b155d6ee158
This commit is contained in:
parent
f1076b0ad9
commit
af1e5ca210
82
scale/force_cleanup
Executable file
82
scale/force_cleanup
Executable file
@ -0,0 +1,82 @@
|
||||
#! /bin/bash
|
||||
# Copyright 2015 Cisco Systems, Inc. All rights reserved.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# A tool that can represent KloudBuster json results in
|
||||
# a nicer form using HTML5, bootstrap.js and the Google Charts Javascript library
|
||||
|
||||
###############################################################################
|
||||
# #
|
||||
# This is a helper script which will delete all resources created by #
|
||||
# KloudBuster. #
|
||||
# #
|
||||
# Normally, KloudBuster will clean up automatically when it is done. However, #
|
||||
# sometimes errors or timeouts happen during the rescource creation stage, #
|
||||
# which will cause KloudBuster out of sync with the real environment. If that #
|
||||
# happens, a force cleanup may be needed. #
|
||||
# #
|
||||
# This script will simply grep the resource name with "KB" and delete them. #
|
||||
# If running on a production network, please double and triple check all #
|
||||
# resources names are *NOT( containing "KB", otherwise they will be deleted #
|
||||
# when running with this script. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
# WARNING! WARNING! WARNING!
|
||||
# IMPORTANT FOR RUNNING KLOUDBUSTER ON PRODUCTION CLOUDS
|
||||
# ======================================================
|
||||
#
|
||||
# DOUBLE CHECK THE NAMES OF ALL RESOURCES THAT DOES NOT BELONG TO KLOUDBUSTER
|
||||
# ARE *NOT* CONTAINING "KB"
|
||||
|
||||
for line in `nova list --all-tenants | grep KB | cut -d'|' -f2`; do
|
||||
nova delete $line
|
||||
done
|
||||
|
||||
echo -e "`neutron floatingip-list | grep -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'`" | while read line; do
|
||||
fid=`echo $line | cut -d'|' -f2 | xargs`
|
||||
portid=`echo $line | cut -d'|' -f5 | xargs`
|
||||
if [ "$fid" != "" ] && [ "$portid" = "" ]; then
|
||||
neutron floatingip-delete $fid &
|
||||
fi
|
||||
done;
|
||||
|
||||
for line in `neutron security-group-list | grep KB | cut -d'|' -f2`; do
|
||||
neutron security-group-delete $line &
|
||||
done;
|
||||
|
||||
for line in `nova flavor-list | grep kb | cut -d'|' -f3`; do
|
||||
nova flavor-delete $line &
|
||||
done;
|
||||
|
||||
for line in `neutron router-list | grep KB | cut -d'|' -f2`; do
|
||||
neutron router-gateway-clear $line
|
||||
for line2 in `neutron router-port-list $line | grep subnet | cut -d'"' -f4`; do
|
||||
neutron router-interface-delete $line $line2
|
||||
done
|
||||
neutron router-delete $line
|
||||
done
|
||||
|
||||
for line in `neutron net-list | grep KB | cut -d'|' -f2`; do
|
||||
neutron net-delete $line
|
||||
done
|
||||
|
||||
for line in `keystone tenant-list | grep KB | cut -d'|' -f2`; do
|
||||
keystone tenant-delete $line
|
||||
done
|
||||
|
||||
for line in `keystone user-list | grep KB | cut -d'|' -f2`; do
|
||||
keystone user-delete $line
|
||||
done
|
0
scale/kb_gen_chart.py
Executable file → Normal file
0
scale/kb_gen_chart.py
Executable file → Normal file
@ -54,11 +54,10 @@ class KBRunner(object):
|
||||
self.report_chan_name = "kloudbuster_report"
|
||||
|
||||
def setup_redis(self, redis_server, redis_server_port=6379, timeout=120):
|
||||
LOG.info("Setting up redis connection pool...")
|
||||
LOG.info("Setting up the redis connections...")
|
||||
connection_pool = redis.ConnectionPool(
|
||||
host=redis_server, port=redis_server_port, db=0)
|
||||
|
||||
LOG.info("Setting up the redis connections...")
|
||||
self.redis_obj = redis.StrictRedis(connection_pool=connection_pool,
|
||||
socket_connect_timeout=1,
|
||||
socket_timeout=1)
|
||||
|
@ -37,6 +37,9 @@ import sshutils
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
class KBVMCreationException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def create_keystone_client(admin_creds):
|
||||
"""
|
||||
@ -166,7 +169,7 @@ class Kloud(object):
|
||||
LOG.info("Creating Instance: " + instance.vm_name)
|
||||
instance.create_server(**instance.boot_info)
|
||||
if not instance.instance:
|
||||
return
|
||||
raise KBVMCreationException()
|
||||
|
||||
instance.fixed_ip = instance.instance.networks.values()[0][0]
|
||||
if (instance.vm_name == "KB-PROXY") and (not instance.config['use_floatingip']):
|
||||
@ -389,6 +392,7 @@ class KloudBuster(object):
|
||||
server_quota['security_group_rule'] = server_quota['security_group'] * 100
|
||||
|
||||
client_quota = {}
|
||||
total_vm = total_vm * self.server_cfg['number_tenants']
|
||||
client_quota['network'] = 1
|
||||
client_quota['subnet'] = 1
|
||||
client_quota['router'] = 1
|
||||
@ -424,6 +428,7 @@ class KloudBuster(object):
|
||||
server_quota['ram'] = total_vm * self.server_cfg['flavor']['ram']
|
||||
|
||||
client_quota = {}
|
||||
total_vm = total_vm * self.server_cfg['number_tenants']
|
||||
client_quota['instances'] = total_vm + 1
|
||||
client_quota['cores'] = total_vm * self.client_cfg['flavor']['vcpus'] + 1
|
||||
client_quota['ram'] = total_vm * self.client_cfg['flavor']['ram'] + 2048
|
||||
@ -436,6 +441,7 @@ class KloudBuster(object):
|
||||
server_quota['gigabytes'] = total_vm * self.server_cfg['flavor']['disk']
|
||||
|
||||
client_quota = {}
|
||||
total_vm = total_vm * self.server_cfg['number_tenants']
|
||||
client_quota['gigabytes'] = total_vm * self.client_cfg['flavor']['disk'] + 20
|
||||
|
||||
return [server_quota, client_quota]
|
||||
|
Loading…
x
Reference in New Issue
Block a user