Merge with trunk

This commit is contained in:
Soren Hansen 2011-01-08 15:35:50 +01:00
commit 602f214e52
4 changed files with 30 additions and 15 deletions
doc/source
nova
db/sqlalchemy
utils.py
setup.py

@ -60,10 +60,11 @@ copyright = u'2010, United States Government as represented by the Administrator
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
# #
# The short X.Y version. from nova import version as nova_version
version = '2011.1'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '2011.1-prerelease' release = nova_version.version()
# The short X.Y version.
version = nova_version.canonical_version_string()
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.

@ -19,16 +19,17 @@
""" """
SQLAlchemy database backend SQLAlchemy database backend
""" """
import logging
import time import time
from sqlalchemy.exc import OperationalError from sqlalchemy.exc import OperationalError
from nova import flags from nova import flags
from nova import log as logging
from nova.db.sqlalchemy import models from nova.db.sqlalchemy import models
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
LOG = logging.getLogger('nova.db.sqlalchemy')
for i in xrange(FLAGS.sql_max_retries): for i in xrange(FLAGS.sql_max_retries):
@ -39,5 +40,6 @@ for i in xrange(FLAGS.sql_max_retries):
models.register_models() models.register_models()
break break
except OperationalError: except OperationalError:
logging.exception(_("Data store is unreachable." LOG.exception(_("Data store %s is unreachable."
" Trying again in %d seconds.") % FLAGS.sql_retry_interval) " Trying again in %d seconds."),
FLAGS.sql_connection, FLAGS.sql_retry_interval)

@ -22,7 +22,6 @@ System-level utilities and helper functions.
import datetime import datetime
import inspect import inspect
import logging
import os import os
import random import random
import subprocess import subprocess
@ -37,8 +36,10 @@ from eventlet import greenthread
from nova import exception from nova import exception
from nova.exception import ProcessExecutionError from nova.exception import ProcessExecutionError
from nova import log as logging
LOG = logging.getLogger("nova.utils")
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ" TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
@ -109,7 +110,7 @@ def vpn_ping(address, port, timeout=0.05, session_id=None):
def fetchfile(url, target): def fetchfile(url, target):
logging.debug(_("Fetching %s") % url) LOG.debug(_("Fetching %s") % url)
# c = pycurl.Curl() # c = pycurl.Curl()
# fp = open(target, "wb") # fp = open(target, "wb")
# c.setopt(c.URL, url) # c.setopt(c.URL, url)
@ -121,7 +122,7 @@ def fetchfile(url, target):
def execute(cmd, process_input=None, addl_env=None, check_exit_code=True): def execute(cmd, process_input=None, addl_env=None, check_exit_code=True):
logging.debug(_("Running cmd (subprocess): %s"), cmd) LOG.debug(_("Running cmd (subprocess): %s"), cmd)
env = os.environ.copy() env = os.environ.copy()
if addl_env: if addl_env:
env.update(addl_env) env.update(addl_env)
@ -134,7 +135,7 @@ def execute(cmd, process_input=None, addl_env=None, check_exit_code=True):
result = obj.communicate() result = obj.communicate()
obj.stdin.close() obj.stdin.close()
if obj.returncode: if obj.returncode:
logging.debug(_("Result was %s") % (obj.returncode)) LOG.debug(_("Result was %s") % (obj.returncode))
if check_exit_code and obj.returncode != 0: if check_exit_code and obj.returncode != 0:
(stdout, stderr) = result (stdout, stderr) = result
raise ProcessExecutionError(exit_code=obj.returncode, raise ProcessExecutionError(exit_code=obj.returncode,
@ -167,12 +168,12 @@ def default_flagfile(filename='nova.conf'):
def debug(arg): def debug(arg):
logging.debug('debug in callback: %s', arg) LOG.debug(_('debug in callback: %s'), arg)
return arg return arg
def runthis(prompt, cmd, check_exit_code=True): def runthis(prompt, cmd, check_exit_code=True):
logging.debug(_("Running %s") % (cmd)) LOG.debug(_("Running %s"), (cmd))
rv, err = execute(cmd, check_exit_code=check_exit_code) rv, err = execute(cmd, check_exit_code=check_exit_code)
@ -203,7 +204,7 @@ def get_my_ip():
csock.close() csock.close()
return addr return addr
except socket.gaierror as ex: except socket.gaierror as ex:
logging.warn(_("Couldn't get IP, using 127.0.0.1 %s"), ex) LOG.warn(_("Couldn't get IP, using 127.0.0.1 %s"), ex)
return "127.0.0.1" return "127.0.0.1"
@ -296,7 +297,7 @@ class LazyPluggable(object):
fromlist = backend fromlist = backend
self.__backend = __import__(name, None, None, fromlist) self.__backend = __import__(name, None, None, fromlist)
logging.info('backend %s', self.__backend) LOG.debug(_('backend %s'), self.__backend)
return self.__backend return self.__backend
def __getattr__(self, key): def __getattr__(self, key):

@ -24,6 +24,15 @@ from setuptools.command.sdist import sdist
from sphinx.setup_command import BuildDoc from sphinx.setup_command import BuildDoc
from nova.utils import parse_mailmap, str_dict_replace from nova.utils import parse_mailmap, str_dict_replace
from nova import version
if os.path.isdir('.bzr'):
with open("nova/vcsversion.py", 'w') as version_file:
vcs_cmd = subprocess.Popen(["bzr", "version-info", "--python"],
stdout=subprocess.PIPE)
vcsversion = vcs_cmd.communicate()[0]
version_file.write(vcsversion)
class local_BuildDoc(BuildDoc): class local_BuildDoc(BuildDoc):
def run(self): def run(self):
@ -49,7 +58,7 @@ class local_sdist(sdist):
sdist.run(self) sdist.run(self)
setup(name='nova', setup(name='nova',
version='2011.1', version=version.canonical_version_string(),
description='cloud computing fabric controller', description='cloud computing fabric controller',
author='OpenStack', author='OpenStack',
author_email='nova@lists.launchpad.net', author_email='nova@lists.launchpad.net',
@ -64,9 +73,11 @@ setup(name='nova',
'bin/nova-dhcpbridge', 'bin/nova-dhcpbridge',
'bin/nova-import-canonical-imagestore', 'bin/nova-import-canonical-imagestore',
'bin/nova-instancemonitor', 'bin/nova-instancemonitor',
'bin/nova-logspool',
'bin/nova-manage', 'bin/nova-manage',
'bin/nova-network', 'bin/nova-network',
'bin/nova-objectstore', 'bin/nova-objectstore',
'bin/nova-scheduler', 'bin/nova-scheduler',
'bin/nova-spoolsentry',
'bin/nova-volume', 'bin/nova-volume',
'tools/nova-debug']) 'tools/nova-debug'])