Add the support for dynamiclly generating the HTML page

1. Add the support for dynamiclly generating the HTML page;
2. v4 image is still back-compatible to v3 image;
3. Update the doc build settings;

Change-Id: Icdde42baac95b40dc21c20295f382eacbff7d7d0
This commit is contained in:
Yichen Wang 2015-09-22 15:09:56 -07:00
parent b50786dbbe
commit 578a12d05f
6 changed files with 27 additions and 16 deletions

View File

@ -106,7 +106,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the

View File

@ -38,12 +38,9 @@ update-rc.d -f nginx remove
# Change permission to 777 for kb_test
chmod -R 777 /kb_test
# Generate a 32K HTML files
# Create nginx server root
mkdir -p /data/www
cd /data/www/
dd if=/dev/zero of=index.html bs=32K count=1
chmod -R 777 /data
cd -
# redis server should listen on all interfaces
sed -i "s/127.0.0.1/0.0.0.0/g" /etc/redis/redis.conf
@ -74,12 +71,12 @@ git clone -b HdrHistogram_c-0.9.0 git://github.com/HdrHistogram/HdrHistogram_c.g
cd HdrHistogram_c
/tmp/cmake-3.3.0-Linux-x86_64/bin/cmake .
make install
cd -
# Remove cmake and HdrHistogram_c builds
rm /tmp/cmake-3.3.0-Linux-x86_64.tar.gz
rm -rf /tmp/cmake-3.3.0-Linux-x86_64
cd ..
rm -rf HdrHistogram_c
rm -rf /tmp/HdrHistogram_c
# Install the http traffic generator
git clone git://github.com/yicwang/wrk2.git

View File

@ -253,6 +253,13 @@ def start_redis_server():
cmd = ['sudo', 'service', 'redis-server', 'start']
return exec_command(cmd)
def config_nginx_server(http_server_configs):
# Generate the HTML file with specified size
html_size = http_server_configs['html_size']
cmd_str = 'dd if=/dev/zero of=/data/www/index.html bs=%s count=1' % html_size
cmd = cmd_str.split()
return False if exec_command(cmd) else True
def start_nuttcp_server():
cmd = ['/usr/bin/nuttcp', '-P5002', '-S', '--single-threaded']
return exec_command(cmd)
@ -263,8 +270,8 @@ def start_nginx_server():
if __name__ == "__main__":
try:
f = open('user-data', 'r')
user_data = eval(f.read())
with open('user-data', 'r') as f:
user_data = eval(f.read())
except Exception as e:
# TODO(Logging on Agent)
print e.message
@ -276,9 +283,9 @@ if __name__ == "__main__":
if user_data['role'] == 'KB-PROXY':
sys.exit(start_redis_server())
if user_data['role'] == 'Server':
rc1 = start_nuttcp_server()
rc2 = start_nginx_server()
sys.exit(rc1 or rc2)
# rc = start_nuttcp_server()
if config_nginx_server(user_data['http_server_configs']):
sys.exit(start_nginx_server())
elif user_data['role'] == 'Client':
agent = KB_VM_Agent(user_data)
agent.setup_channels()

View File

@ -87,6 +87,12 @@ server:
# Note that this is ignored/overriden if you specify a topology file (-t)
availability_zone:
# HTTP Server specific configs (per VM)
http_server_configs:
# The size of HTML page in Bytes
html_size: 32768
# ==========================
# CLIENT SIDE CONFIG OPTIONS
# ==========================

View File

@ -317,6 +317,7 @@ class KloudBuster(object):
self.kloud.placement_az, "Round-robin")
for ins in svr_list:
ins.user_data['role'] = 'Server'
ins.user_data['http_server_configs'] = ins.config['http_server_configs']
ins.boot_info['flavor_type'] = 'kb.server' if \
not self.tenants_list['server'] else self.kloud.flavor_to_use
ins.boot_info['user_data'] = str(ins.user_data)

View File

@ -7,9 +7,9 @@ hacking<0.11,>=0.10.0
coverage>=3.6
discover
python-subunit>=0.0.18
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
oslosphinx>=2.2.0 # Apache-2.0
oslotest>=1.2.0 # Apache-2.0
sphinx>=1.3.1
oslosphinx>=2.5.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
testrepository>=0.0.18
testscenarios>=0.4
testtools>=0.9.36,!=1.2.0
testtools>=1.4.0