Updated apache user (shouldn't of been checked in) and made success more visible (vs failure).

Also fixed missing network setup.
This commit is contained in:
Joshua Harlow 2012-01-27 23:14:16 -08:00
parent 030004d144
commit bcc0164c12
7 changed files with 108 additions and 44 deletions

@ -107,21 +107,38 @@ nova_version = ${NOVA_VERSION:-1.1}
scheduler = ${NOVA_SCHEDULER:-nova.scheduler.simple.SimpleScheduler}
# Network settings
# Very useful to read over:
# http://docs.openstack.org/cactus/openstack-compute/admin/content/configuring-networking-on-the-compute-node.html
fixed_range = ${NOVA_FIXED_RANGE:-10.0.0.0/24}
fixed_network_size = ${NOVA_FIXED_NETWORK_SIZE:-256}
network_manager = ${NET_MAN:-FlatDHCPManager}
public_interface = ${PUBLIC_INTERFACE:-eth0}
#DHCP Warning: If your flat interface device uses DHCP, there will be a hiccup while the network is moved from the flat interface to the flat network bridge. This will happen when you launch your first instance. Upon launch you will lose all connectivity to the node, and the vm launch will probably fail.
#
#TODO: should/can we check that FLAT_INTERFACE is sane? (in code)
#
#If you are running on a single node and don't need to access the VMs from devices other than that node, you can set the flat interface to the same value as FLAT_NETWORK_BRIDGE. This will stop the network hiccup from occurring.
flat_interface = ${FLAT_INTERFACE:-eth0}
vlan_interface = ${VLAN_INTERFACE:-$(nova:public_interface)}
flat_network_bridge = ${FLAT_NETWORK_BRIDGE:-br100}
# Test floating pool and range are used for testing.
# They are defined here until the admin APIs can replace nova-manage
floating_range = ${FLOATING_RANGE:-172.24.4.224/28}
test_floating_pool = ${TEST_FLOATING_POOL:-test}
test_floating_range = ${TEST_FLOATING_RANGE:-192.168.253.0/29}
# TODO document these
vncproxy_url = ${VNCPROXY_URL:-http://$(host:ip):6080}
ec2_dmz_host = ${EC2_DMZ_HOST:-$(host:ip)}
# Volume settings
volume_group = ${VOLUME_GROUP:-nova-volumes}
volume_backing_file = ${VOLUME_BACKING_FILE:-}
volume_backing_file_size =${VOLUME_BACKING_FILE_SIZE:-2052M}
volume_name_prefix = ${VOLUME_NAME_PREFIX:-volume-}
volume_name_postfix = ${VOLUME_NAME_POSTFIX:-%08x}
public_interface = ${PUBLIC_INTERFACE:-eth0}
flat_network_bridge = ${FLAT_NETWORK_BRIDGE:-br100}
flat_interface = ${FLAT_INTERFACE:-eth0}
vlan_interface = ${VLAN_INTERFACE:-$(nova:public_interface)}
# TODO document these
vncproxy_url = ${VNCPROXY_URL:-http://$(host:ip):6080}
ec2_dmz_host = ${EC2_DMZ_HOST:-$(host:ip)}
# How instances will be named
instance_name_prefix = ${INSTANCE_NAME_PREFIX:-instance-}
@ -131,6 +148,7 @@ instance_name_postfix = ${INSTANCE_NAME_POSTFIX:-%08x}
instances_path = ${INSTANCES_PATH:-}
# Are we setup in multihost mode?
# Multi-host is a mode where each compute node runs its own network node. This allows network operations and routing for a VM to occur on the server that is running the VM - removing a SPOF and bandwidth bottleneck.
multi_host = ${MULTI_HOST:-0}
# Virtualization settings
@ -145,11 +163,6 @@ glance_server = ${GLANCE_SERVER:-$(host:ip):9292}
# Used however you want - ensure you know nova's conf file format if you use this!
extra_flags = ${NOVA_EXTRA_FLAGS:-}
floating_range=${FLOATING_RANGE:-172.24.4.224/28}
test_floating_pool=${TEST_FLOATING_POOL:-test}
test_floating_range=${TEST_FLOATING_RANGE:-192.168.253.0/29}
[ec2]
# Set the ec2 url so euca2ools works

@ -41,10 +41,14 @@ DB_NAME = 'nova'
#id
TYPE = settings.NOVA
#post install cmds that will happen after install
POST_INSTALL_CMDS = [
DB_SYNC_CMD = [
{'cmd': ['%BINDIR%/nova-manage', '--flagfile', '%CFGFILE%',
'db', 'sync']},
]
NETWORK_SETUP_CMDS = [
{'cmd': ['%BINDIR%/nova-manage', '--flagfile', '%CFGFILE%',
'network', 'create', 'private', '%FIXED_RANGE%', '1', '%FIXED_NETWORK_SIZE%']},
{'cmd': ['%BINDIR%/nova-manage', '--flagfile', '%CFGFILE%',
'floating', 'create', '%FLOATING_RANGE%']},
{'cmd': ['%BINDIR%/nova-manage', '--flagfile', '%CFGFILE%',
@ -82,7 +86,7 @@ RESTART_TGT_CMD = [
{'cmd': ['start', 'tgt'], 'run_as_root': True}
]
# NCPU, NVOL, NAPI are here as possible subcomponents of nova
# NCPU, NVOL, NAPI ... are here as possible subcomponents of nova
NCPU = "cpu"
NVOL = "vol"
NAPI = "api"
@ -131,7 +135,6 @@ APP_OPTIONS = {
'nova-consoleauth': [],
#TODO FIX these
#'nova-xvpvncproxy' : ['--flagfile', '%CFGFILE%'],
#TODO add in novnc
}
# Sub component names to actual app names (matching previous dict)
@ -207,20 +210,32 @@ class NovaInstaller(comp.PythonInstallComponent):
def _get_config_files(self):
return list(CONFIGS)
def post_install(self):
parent_result = comp.PkgInstallComponent.post_install(self)
#extra actions to do nova setup
self._setup_db()
# Need to do db sync and other post install commands
# set up replacement map for CFGFILE, BINDIR, FLOATING_RANGE,
# TEST_FLOATING_RANGE, TEST_FLOATING_POOL
def _setup_network(self):
LOG.info("Creating your nova network to be used with instances.")
mp = dict()
mp['BINDIR'] = self.bindir
mp['CFGFILE'] = sh.joinpths(self.cfgdir, API_CONF)
mp['FLOATING_RANGE'] = self.cfg.get('nova', 'floating_range')
mp['TEST_FLOATING_RANGE'] = self.cfg.get('nova', 'test_floating_range')
mp['TEST_FLOATING_POOL'] = self.cfg.get('nova', 'test_floating_pool')
utils.execute_template(*POST_INSTALL_CMDS, params=mp, tracewriter=self.tracewriter)
mp['FIXED_NETWORK_SIZE'] = self.cfg.get('nova', 'fixed_network_size')
mp['FIXED_RANGE'] = self.cfg.get('nova', 'fixed_range')
#TODO this needs to be fixed for quantum!
utils.execute_template(*NETWORK_SETUP_CMDS, params=mp, tracewriter=self.tracewriter)
def _sync_db(self):
LOG.info("Syncing the database with nova.")
mp = dict()
mp['BINDIR'] = self.bindir
mp['CFGFILE'] = sh.joinpths(self.cfgdir, API_CONF)
utils.execute_template(*DB_SYNC_CMD, params=mp, tracewriter=self.tracewriter)
def post_install(self):
parent_result = comp.PkgInstallComponent.post_install(self)
#extra actions to do nova setup
self._setup_db()
self._sync_db()
self._setup_network()
# check if we need to do the vol subcomponent
if not self.component_opts or NVOL in self.component_opts:
# yes, either no subcomponents were specifically requested or it's
@ -234,7 +249,7 @@ class NovaInstaller(comp.PythonInstallComponent):
db.create_db(self.cfg, DB_NAME)
def _setup_vol_groups(self):
LOG.debug("Attempt to setup vol groups")
LOG.info("Attempting to setup volume groups for nova volume management")
mp = dict()
backing_file = self.cfg.get('nova', 'volume_backing_file')
# check if we need to have a default backing file
@ -247,12 +262,12 @@ class NovaInstaller(comp.PythonInstallComponent):
mp['VOLUME_BACKING_FILE_SIZE'] = backing_file_size
try:
utils.execute_template(*VG_CHECK_CMD, params=mp)
LOG.info("Vol group already exists:%s" % (vol_group))
LOG.warn("Volume group already exists:%s" % (vol_group))
except exceptions.ProcessExecutionError as err:
# Check that the error from VG_CHECK is an expected error
if err.exit_code != 5:
raise
LOG.info("Need to create vol group:%s" % (vol_group))
LOG.info("Need to create volume group:%s" % (vol_group))
sh.touch_file(backing_file, die_if_there=False, file_size=backing_file_size)
vg_dev_result = utils.execute_template(*VG_DEV_CMD, params=mp)
LOG.debug("vg dev result:%s" % (vg_dev_result))
@ -267,6 +282,7 @@ class NovaInstaller(comp.PythonInstallComponent):
utils.execute_template(*RESTART_TGT_CMD, check_exit_code=False, tracewriter=self.tracewriter)
def _process_lvs(self, mp):
LOG.info("Attempting to setup logical volumes for nova volume management")
lvs_result = utils.execute_template(*VG_LVS_CMD, params=mp, tracewriter=self.tracewriter)
LOG.debug("lvs result:%s" % (lvs_result))
vol_name_prefix = self.cfg.get('nova', 'volume_name_prefix')
@ -288,7 +304,7 @@ class NovaInstaller(comp.PythonInstallComponent):
utils.execute_template(*VG_LVREMOVE_CMD, params=mp, tracewriter=self.tracewriter)
def _generate_nova_conf(self):
LOG.debug("Generating dynamic content for nova configuration")
LOG.info("Generating dynamic content for nova configuration (%s)." % (API_CONF))
dirs = dict()
dirs['app'] = self.appdir
dirs['cfg'] = self.cfgdir
@ -557,7 +573,9 @@ class NovaConfigurator(object):
else:
nova_conf.add('connection_type', self._getstr('connection_type'))
nova_conf.add('flat_network_bridge', self._getstr('flat_network_bridge'))
nova_conf.add('flat_interface', self._getstr('flat_interface'))
flat_interface = self._getstr('flat_interface')
if flat_interface:
nova_conf.add('flat_interface', flat_interface)
# This class represents the data in the nova config file

@ -32,7 +32,7 @@ VNC_PROXY_APP = 'nova-novncproxy'
APP_OPTIONS = {
#this reaches into the nova configuration file
#TODO can we stop that?
VNC_PROXY_APP: ['--flagfile-file=%NOVA_CONF%', '--web'],
VNC_PROXY_APP: ['--flagfile-file', '%NOVA_CONF%', '--web'],
}
@ -73,6 +73,7 @@ class NoVNCRuntime(comp.ProgramRuntime):
root_params = comp.ProgramRuntime._get_param_map(self, app_name)
if app_name == VNC_PROXY_APP and settings.NOVA in self.instances:
nova_runtime = self.instances.get(settings.NOVA)
#have to reach into the nova conf (puke)
root_params['NOVA_CONF'] = sh.joinpths(nova_runtime.cfgdir, nova.API_CONF)
return root_params

@ -199,10 +199,10 @@ class ImageCreationService:
def install(self):
urls = list()
token = None
LOG.info("Setting up any specified images in glance.")
#extract them
#extract them from the config
try:
token = self.cfg.get("passwords", "service_token")
flat_urls = self.cfg.get('img', 'image_urls')
if flat_urls:
expanded_urls = [x.strip() for x in flat_urls.split(',')]
@ -216,6 +216,7 @@ class ImageCreationService:
am_installed = 0
if urls:
LOG.info("Attempting to download & extract and upload (%s) images." % (", ".join(urls)))
token = self.cfg.get("passwords", "service_token")
for url in urls:
try:
Image(url, token).install()

@ -345,7 +345,7 @@ def _get_def_components():
#TODO glance subcomponents should be api/reg
def_components[settings.GLANCE] = []
def_components[settings.KEYSTONE] = []
#TODO add in xvnc? nvnc?
#TODO add in xvnc?
def_components[settings.NOVA] = [
nova.NCPU,
nova.NVOL,

@ -23,6 +23,7 @@ import os
import platform
import random
import re
import traceback
#requires http://pypi.python.org/pypi/termcolor
#but the colors make it worth it :-)
@ -303,6 +304,28 @@ def center_text(text, fill, max_len):
return centered_str
def goodbye(worked):
#thx cowsay
cow = r'''
_________
< {message} >
---------
\ ^__^
\ ({eye}{eye})\_______
(__)\ )\/\
||----w |
|| ||
'''
cow = cow.strip("\n\r")
worked_msg = colored('Success!', 'blue')
eye_fmt = 'o'
if not worked:
worked_msg = colored('Failure!', 'red', attrs=['bold'])
eye_fmt = colored("o", 'red')
outmsg = cow.format(message=worked_msg, eye=eye_fmt)
print(outmsg)
def welcome(ident):
ver_str = version.version_string()
lower = "|"

28
stack

@ -21,6 +21,7 @@ import os.path
import logging
import logging.config
import sys
import traceback
#requires http://pypi.python.org/pypi/termcolor
#but the colors make it worth it :-)
@ -34,6 +35,7 @@ logging.config.fileConfig(logfn)
#this handles our option parsing
from devstack import opts
from devstack import utils
#these are the program runtimes that actually do the running
from devstack.progs import actions
@ -43,19 +45,25 @@ from devstack.progs import misc
def main():
#parse and get it done!
args = opts.parse()
run_ok = False
#figure out what to do
module = None
if args.get('list_deps') or args.get('describe_comp'):
run_ok = misc.run(args)
module = misc
else:
run_ok = actions.run(args)
#now do it
if run_ok:
return 0
else:
me = colored((os.path.basename(sys.argv[0])), "red", attrs=['bold'])
me += " " + colored('--help', 'red')
print("Perhaps you should try %s" % (me))
module = actions
try:
ran_ok = module.run(args)
if not ran_ok:
me = colored((os.path.basename(sys.argv[0])), "red", attrs=['bold'])
me += " " + colored('--help', 'red')
print("Perhaps you should try %s" % (me))
return 1
else:
utils.goodbye(True)
return 0
except:
utils.goodbye(False)
traceback.print_exc(file=sys.stdout)
return 1