From 60c82177da9c4ebbb89e5534959d0d5a52bfa49a Mon Sep 17 00:00:00 2001 From: Eric Day Date: Wed, 3 Nov 2010 12:38:15 -0700 Subject: Fix for bug#613264, allowing hosts to be specified for nova-api and objectstore listeners. --- nova/objectstore/handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova') diff --git a/nova/objectstore/handler.py b/nova/objectstore/handler.py index b26906001..aaf207db4 100644 --- a/nova/objectstore/handler.py +++ b/nova/objectstore/handler.py @@ -438,6 +438,7 @@ def get_application(): # Disabled because of lack of proper introspection in Twisted # or possibly different versions of twisted? # pylint: disable-msg=E1101 - objectStoreService = internet.TCPServer(FLAGS.s3_port, factory) + objectStoreService = internet.TCPServer(FLAGS.s3_port, factory, + interface=FLAGS.s3_host) objectStoreService.setServiceParent(application) return application -- cgit From d65c35bcadc6cc4e4d1fc61502d43fd001ce2f0e Mon Sep 17 00:00:00 2001 From: Eric Day Date: Wed, 3 Nov 2010 13:13:59 -0700 Subject: Added an extra argument to the objectstore listen to separate out the listening host from the connecting host. --- nova/objectstore/handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova') diff --git a/nova/objectstore/handler.py b/nova/objectstore/handler.py index aaf207db4..c8920b00c 100644 --- a/nova/objectstore/handler.py +++ b/nova/objectstore/handler.py @@ -61,6 +61,7 @@ from nova.objectstore import image FLAGS = flags.FLAGS +flags.DEFINE_string('s3_listen_host', '', 'Host to listen on.') def render_xml(request, value): @@ -439,6 +440,6 @@ def get_application(): # or possibly different versions of twisted? # pylint: disable-msg=E1101 objectStoreService = internet.TCPServer(FLAGS.s3_port, factory, - interface=FLAGS.s3_host) + interface=FLAGS.s3_listen_host) objectStoreService.setServiceParent(application) return application -- cgit From 3b695e11da34247123ea919e71096e53393f227b Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Thu, 11 Nov 2010 19:52:36 -0600 Subject: Added a .mailmap that maps addresses in bzr to people's real, preferred e-mail addresses. (I made a few guesses along the way, feel free to adjust according to what is actually the preferred e-mail) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a couple of methods to nova.utils to parse said .mailmap and do the appropriate (though highly naïve) replacement. Apply mailmap replacement in changelog generation in setup.py. Add a unit test that checks everyone is properly listed in Authors. Add sleepsonthefloor to Authors. If anyone knows the real name, please add it. --- nova/tests/misc_unittest.py | 48 +++++++++++++++++++++++++++++++++++++++++++++ nova/utils.py | 16 +++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 nova/tests/misc_unittest.py (limited to 'nova') diff --git a/nova/tests/misc_unittest.py b/nova/tests/misc_unittest.py new file mode 100644 index 000000000..856060afa --- /dev/null +++ b/nova/tests/misc_unittest.py @@ -0,0 +1,48 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2010 OpenStack LLC +# +# 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 os +import subprocess + +from nova import test +from nova.utils import parse_mailmap, str_dict_replace + + +class ProjectTestCase(test.TrialTestCase): + def test_authors_up_to_date(self): + if os.path.exists('../.bzr'): + log_cmd = subprocess.Popen(["bzr", "log", "-n0"], + stdout=subprocess.PIPE) + changelog = log_cmd.communicate()[0] + mailmap = parse_mailmap('../.mailmap') + + contributors = set() + for l in changelog.split('\n'): + l = l.strip() + if (l.startswith('author:') or l.startswith('committer:') + and not l == 'committer: Tarmac'): + email = l.split(' ')[-1] + contributors.add(str_dict_replace(email, mailmap)) + + authors_file = open('../Authors', 'r').read() + + missing = set() + for contributor in contributors: + if not contributor in authors_file: + missing.add(contributor) + + self.assertTrue(len(missing) == 0, + '%r not listed in Authors' % missing) diff --git a/nova/utils.py b/nova/utils.py index e7892a212..b63237c10 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -173,6 +173,22 @@ def isotime(at=None): def parse_isotime(timestr): return datetime.datetime.strptime(timestr, TIME_FORMAT) +def parse_mailmap(mailmap='.mailmap'): + mapping = {} + if os.path.exists(mailmap): + fp = open(mailmap, 'r') + for l in fp: + l = l.strip() + if not l.startswith('#') and ' ' in l: + canonical_email, alias = l.split(' ') + mapping[alias] = canonical_email + return mapping + +def str_dict_replace(s, mapping): + for s1, s2 in mapping.iteritems(): + s = s.replace(s1, s2) + return s + class LazyPluggable(object): """A pluggable backend loaded lazily based on some value.""" -- cgit From aa433547ff797678cd2aad17d70c1c0b569d1e37 Mon Sep 17 00:00:00 2001 From: Armando Migliaccio Date: Fri, 19 Nov 2010 17:32:38 +0000 Subject: first cut of fixes for bug #676128 --- nova/virt/xenapi.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'nova') diff --git a/nova/virt/xenapi.py b/nova/virt/xenapi.py index 0f563aa41..2f115c14b 100644 --- a/nova/virt/xenapi.py +++ b/nova/virt/xenapi.py @@ -286,11 +286,21 @@ class XenAPIConnection(object): # Don't complain, just return. This lets us clean up instances # that have already disappeared from the underlying platform. defer.returnValue(None) + # Get the VDIs related to the VM + vdis = yield self._lookup_vm_vdis(vm) try: task = yield self._call_xenapi('Async.VM.hard_shutdown', vm) yield self._wait_for_task(task) except Exception, exc: logging.warn(exc) + # Disk clean-up + if vdis: + for vdi in vdis: + try: + task = yield self._call_xenapi('Async.VDI.destroy', vdi) + yield self._wait_for_task(task) + except Exception, exc: + logging.warn(exc) try: task = yield self._call_xenapi('Async.VM.destroy', vm) yield self._wait_for_task(task) @@ -325,6 +335,24 @@ class XenAPIConnection(object): else: return vms[0] + @utils.deferredToThread + def _lookup_vm_vdis(self, vm): + return self._lookup_vm_vdis_blocking(vm) + + def _lookup_vm_vdis_blocking(self, vm): + # Firstly we get the VBDs, then the VDIs. + # TODO: do we leave the read-only devices? + vbds = self._conn.xenapi.VM.get_VBDs(vm) + vdis = [] + if vbds: + for vbd in vbds: + vdis.append(self._conn.xenapi.VBD.get_VDI(vbd)) + if len(vdis) > 0: + return vdis + else: + return None + + def _wait_for_task(self, task): """Return a Deferred that will give the result of the given task. The task is polled until it completes.""" -- cgit From 958591ab2996443ffb6d2f92f928eaad277aa2db Mon Sep 17 00:00:00 2001 From: Armando Migliaccio Date: Mon, 22 Nov 2010 13:11:00 +0000 Subject: pep8 violations fix --- nova/virt/xenapi.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'nova') diff --git a/nova/virt/xenapi.py b/nova/virt/xenapi.py index c3a0c2c7a..3169562a5 100644 --- a/nova/virt/xenapi.py +++ b/nova/virt/xenapi.py @@ -338,28 +338,27 @@ class XenAPIConnection(object): @utils.deferredToThread def _lookup_vm_vdis(self, vm): return self._lookup_vm_vdis_blocking(vm) - + def _lookup_vm_vdis_blocking(self, vm): # Firstly we get the VBDs, then the VDIs. # TODO: do we leave the read-only devices? vbds = self._conn.xenapi.VM.get_VBDs(vm) vdis = [] if vbds: - for vbd in vbds: - try: - vdi = self._conn.xenapi.VBD.get_VDI(vbd) - # Test valid VDI - record = self._conn.xenapi.VDI.get_record(vdi) - except Exception, exc: - logging.warn(exc) - else: - vdis.append(vdi) - if len(vdis) > 0: - return vdis - else: - return None - - + for vbd in vbds: + try: + vdi = self._conn.xenapi.VBD.get_VDI(vbd) + # Test valid VDI + record = self._conn.xenapi.VDI.get_record(vdi) + except Exception, exc: + logging.warn(exc) + else: + vdis.append(vdi) + if len(vdis) > 0: + return vdis + else: + return None + def _wait_for_task(self, task): """Return a Deferred that will give the result of the given task. The task is polled until it completes.""" -- cgit From 51be7159574d3e0cba8a81b8ea3e9706ce74ac3a Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Mon, 22 Nov 2010 14:45:05 -0600 Subject: Set and use AMQP retry interval and max retry constants --- nova/rpc.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'nova') diff --git a/nova/rpc.py b/nova/rpc.py index 9938b0838..c2d18cb61 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -38,8 +38,11 @@ from nova import fakerabbit from nova import flags from nova import context + FLAGS = flags.FLAGS +AMQP_RETRY_INT = 10 +AMQP_MAX_RETRIES = 12 LOG = logging.getLogger('amqplib') LOG.setLevel(logging.DEBUG) @@ -85,17 +88,23 @@ class Consumer(messaging.Consumer): def __init__(self, *args, **kwargs): self.failed_connection = False - while True: + for i in range(AMQP_MAX_RETRIES): try: super(Consumer, self).__init__(*args, **kwargs) break except: # Catching all because carrot sucks - logging.exception("AMQP server on %s:%d is unreachable. " \ - "Trying again in 30 seconds." % ( - FLAGS.rabbit_host, - FLAGS.rabbit_port)) - time.sleep(30) - continue + if i + 1 == AMQP_MAX_RETRIES: + logging.exception("Unable to connect to AMQP server" \ + " after %d tries. Shutting down." % AMQP_MAX_RETRIES) + sys.exit(1) + else: + logging.exception("AMQP server on %s:%d is unreachable." \ + " Trying again in %d seconds." % ( + FLAGS.rabbit_host, + FLAGS.rabbit_port, + AMQP_RETRY_INT)) + time.sleep(AMQP_RETRY_INT) + continue def fetch(self, no_ack=None, auto_ack=None, enable_callbacks=False): """Wraps the parent fetch with some logic for failed connections""" @@ -103,7 +112,7 @@ class Consumer(messaging.Consumer): # refactored into some sort of connection manager object try: if self.failed_connection: - # NOTE(vish): conn is defined in the parent class, we can + # NOTE(vish): connection is defined in the parent class, we can # recreate it as long as we create the backend too # pylint: disable-msg=W0201 self.connection = Connection.recreate() -- cgit From 14e4ba7f0e10fc3c2f532b445c1f656f53c8aa95 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Mon, 22 Nov 2010 15:22:02 -0600 Subject: Refactor AMQP retry loop --- nova/rpc.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'nova') diff --git a/nova/rpc.py b/nova/rpc.py index c2d18cb61..961b56de6 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -86,25 +86,25 @@ class Consumer(messaging.Consumer): Contains methods for connecting the fetch method to async loops """ def __init__(self, *args, **kwargs): - self.failed_connection = False - - for i in range(AMQP_MAX_RETRIES): + for i in xrange(AMQP_MAX_RETRIES): + if i > 0: + time.sleep(AMQP_RETRY_INT) try: super(Consumer, self).__init__(*args, **kwargs) + self.failed_connection = False break except: # Catching all because carrot sucks - if i + 1 == AMQP_MAX_RETRIES: - logging.exception("Unable to connect to AMQP server" \ - " after %d tries. Shutting down." % AMQP_MAX_RETRIES) - sys.exit(1) - else: - logging.exception("AMQP server on %s:%d is unreachable." \ - " Trying again in %d seconds." % ( - FLAGS.rabbit_host, - FLAGS.rabbit_port, - AMQP_RETRY_INT)) - time.sleep(AMQP_RETRY_INT) - continue + logging.exception("AMQP server on %s:%d is unreachable." \ + " Trying again in %d seconds." % ( + FLAGS.rabbit_host, + FLAGS.rabbit_port, + AMQP_RETRY_INT)) + self.failed_connection = True + continue + if self.failed_connection: + logging.exception("Unable to connect to AMQP server" \ + " after %d tries. Shutting down." % AMQP_MAX_RETRIES) + sys.exit(1) def fetch(self, no_ack=None, auto_ack=None, enable_callbacks=False): """Wraps the parent fetch with some logic for failed connections""" -- cgit From a8497abaf24436a92a85129d9771a12f046f2f42 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Mon, 22 Nov 2010 16:04:21 -0600 Subject: Removed unnecessary continue --- nova/rpc.py | 1 - 1 file changed, 1 deletion(-) (limited to 'nova') diff --git a/nova/rpc.py b/nova/rpc.py index 961b56de6..57e522ad3 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -100,7 +100,6 @@ class Consumer(messaging.Consumer): FLAGS.rabbit_port, AMQP_RETRY_INT)) self.failed_connection = True - continue if self.failed_connection: logging.exception("Unable to connect to AMQP server" \ " after %d tries. Shutting down." % AMQP_MAX_RETRIES) -- cgit From deac609ceb1cd6e081445bfc4d8f8c3222b97774 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Mon, 22 Nov 2010 16:28:28 -0600 Subject: Make time.sleep() non-blocking --- nova/wsgi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova') diff --git a/nova/wsgi.py b/nova/wsgi.py index b04b487ea..c7ee9ed14 100644 --- a/nova/wsgi.py +++ b/nova/wsgi.py @@ -28,7 +28,7 @@ from xml.dom import minidom import eventlet import eventlet.wsgi -eventlet.patcher.monkey_patch(all=False, socket=True) +eventlet.patcher.monkey_patch(all=False, socket=True, time=True) import routes import routes.middleware import webob -- cgit From f0f990495428c028401ba9a4740e6b7a0441213c Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Mon, 22 Nov 2010 16:48:44 -0600 Subject: Use FLAGS instead of constants --- nova/flags.py | 2 ++ nova/rpc.py | 11 ++++------- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'nova') diff --git a/nova/flags.py b/nova/flags.py index 4ae86d9b2..a39f22273 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -196,6 +196,8 @@ DEFINE_integer('rabbit_port', 5672, 'rabbit port') DEFINE_string('rabbit_userid', 'guest', 'rabbit userid') DEFINE_string('rabbit_password', 'guest', 'rabbit password') DEFINE_string('rabbit_virtual_host', '/', 'rabbit virtual host') +DEFINE_integer('rabbit_retry_interval', 10, 'rabbit connection retry interval') +DEFINE_integer('rabbit_max_retries', 12, 'rabbit connection attempts') DEFINE_string('control_exchange', 'nova', 'the main exchange to connect to') DEFINE_string('cc_host', '127.0.0.1', 'ip of api server') DEFINE_integer('cc_port', 8773, 'cloud controller port') diff --git a/nova/rpc.py b/nova/rpc.py index 57e522ad3..86a29574f 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -41,9 +41,6 @@ from nova import context FLAGS = flags.FLAGS -AMQP_RETRY_INT = 10 -AMQP_MAX_RETRIES = 12 - LOG = logging.getLogger('amqplib') LOG.setLevel(logging.DEBUG) @@ -86,9 +83,9 @@ class Consumer(messaging.Consumer): Contains methods for connecting the fetch method to async loops """ def __init__(self, *args, **kwargs): - for i in xrange(AMQP_MAX_RETRIES): + for i in xrange(FLAGS.rabbit_max_retries): if i > 0: - time.sleep(AMQP_RETRY_INT) + time.sleep(FLAGS.rabbit_retry_interval) try: super(Consumer, self).__init__(*args, **kwargs) self.failed_connection = False @@ -98,11 +95,11 @@ class Consumer(messaging.Consumer): " Trying again in %d seconds." % ( FLAGS.rabbit_host, FLAGS.rabbit_port, - AMQP_RETRY_INT)) + FLAGS.rabbit_retry_interval)) self.failed_connection = True if self.failed_connection: logging.exception("Unable to connect to AMQP server" \ - " after %d tries. Shutting down." % AMQP_MAX_RETRIES) + " after %d tries. Shutting down." % FLAGS.rabbit_max_retries) sys.exit(1) def fetch(self, no_ack=None, auto_ack=None, enable_callbacks=False): -- cgit From 89f56207de1ffe2f1f9d5c3cad3ab71ba324d133 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 23 Nov 2010 13:48:57 +0100 Subject: Add a --logdir flag that will be prepended to the logfile setting. This makes it easier to share a flagfile between multiple workers while still having separate log files. --- nova/server.py | 3 +++ nova/twistd.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'nova') diff --git a/nova/server.py b/nova/server.py index cb424caa1..4d0f6e4da 100644 --- a/nova/server.py +++ b/nova/server.py @@ -42,6 +42,7 @@ flags.DEFINE_bool('daemonize', False, 'daemonize this process') # clutter. flags.DEFINE_bool('use_syslog', True, 'output to syslog when daemonizing') flags.DEFINE_string('logfile', None, 'log file to output to') +flags.DEFINE_string('logdir', None, 'directory to keep log files in (will be prepended to $logfile)') flags.DEFINE_string('pidfile', None, 'pid file to output to') flags.DEFINE_string('working_directory', './', 'working directory...') flags.DEFINE_integer('uid', os.getuid(), 'uid under which to run') @@ -119,6 +120,8 @@ def daemonize(args, name, main): else: if not FLAGS.logfile: FLAGS.logfile = '%s.log' % name + if FLAGS.logdir: + FLAGS.logfile = os.path.join(FLAGS.logdir, FLAGS.logfile) logfile = logging.FileHandler(FLAGS.logfile) logfile.setFormatter(formatter) logger.addHandler(logfile) diff --git a/nova/twistd.py b/nova/twistd.py index 3ec0ff61e..6c6cb955f 100644 --- a/nova/twistd.py +++ b/nova/twistd.py @@ -43,7 +43,7 @@ else: FLAGS = flags.FLAGS - +flags.DEFINE_string('logdir', None, 'directory to keep log files in (will be prepended to $logfile)') class TwistdServerOptions(ServerOptions): def parseArgs(self, *args): @@ -246,6 +246,8 @@ def serve(filename): FLAGS.logfile = '%s.log' % name elif FLAGS.logfile.endswith('twistd.log'): FLAGS.logfile = FLAGS.logfile.replace('twistd.log', '%s.log' % name) + if FLAGS.logdir: + FLAGS.logfile = os.path.join(FLAGS.logdir, FLAGS.logfile) if not FLAGS.prefix: FLAGS.prefix = name elif FLAGS.prefix.endswith('twisted'): -- cgit From 513e4eb76a8d21108484bbc08e3ff755190cb2d9 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Tue, 23 Nov 2010 12:04:34 -0600 Subject: Make aws_access_key_id and aws_secret_access_key configurable --- nova/adminclient.py | 16 +++++++++++----- nova/compute/monitor.py | 4 ++-- nova/flags.py | 2 ++ 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'nova') diff --git a/nova/adminclient.py b/nova/adminclient.py index af55197fc..5a62cce7d 100644 --- a/nova/adminclient.py +++ b/nova/adminclient.py @@ -22,13 +22,15 @@ Nova User API client library. import base64 import boto import httplib + +from nova import flags from boto.ec2.regioninfo import RegionInfo +FLAGS = flags.FLAGS + DEFAULT_CLC_URL = 'http://127.0.0.1:8773' DEFAULT_REGION = 'nova' -DEFAULT_ACCESS_KEY = 'admin' -DEFAULT_SECRET_KEY = 'admin' class UserInfo(object): @@ -192,9 +194,13 @@ class HostInfo(object): class NovaAdminClient(object): - def __init__(self, clc_url=DEFAULT_CLC_URL, region=DEFAULT_REGION, - access_key=DEFAULT_ACCESS_KEY, secret_key=DEFAULT_SECRET_KEY, - **kwargs): + def __init__( + self, + clc_url=DEFAULT_CLC_URL, + region=DEFAULT_REGION, + access_key=FLAGS.aws_access_key_id, + secret_key=FLAGS.aws_secret_access_key, + **kwargs): parts = self.split_clc_url(clc_url) self.clc_url = clc_url diff --git a/nova/compute/monitor.py b/nova/compute/monitor.py index d0154600f..ce45b14f6 100644 --- a/nova/compute/monitor.py +++ b/nova/compute/monitor.py @@ -211,8 +211,8 @@ def store_graph(instance_id, filename): # the response we can make our own client that does the actual # request and hands it off to the response parser. s3 = boto.s3.connection.S3Connection( - aws_access_key_id='admin', - aws_secret_access_key='admin', + aws_access_key_id=FLAGS.aws_access_key_id, + aws_secret_access_key=FLAGS.aws_secret_access_key, is_secure=False, calling_format=boto.s3.connection.OrdinaryCallingFormat(), port=FLAGS.s3_port, diff --git a/nova/flags.py b/nova/flags.py index 121b9ca25..f7ae26050 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -179,6 +179,8 @@ DEFINE_list('region_list', [], 'list of region=url pairs separated by commas') DEFINE_string('connection_type', 'libvirt', 'libvirt, xenapi or fake') +DEFINE_string('aws_access_key_id', 'admin', 'AWS Access ID') +DEFINE_string('aws_secret_access_key', 'admin', 'AWS Access Key') DEFINE_integer('s3_port', 3333, 's3 port') DEFINE_string('s3_host', '127.0.0.1', 's3 host') DEFINE_string('compute_topic', 'compute', 'the topic compute nodes listen on') -- cgit From 9c57e5ce37c1f2405fcf7a1ba322946e6d84efeb Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Tue, 23 Nov 2010 12:46:07 -0600 Subject: Remove FAKE_subdomain from docs --- nova/api/__init__.py | 1 - 1 file changed, 1 deletion(-) (limited to 'nova') diff --git a/nova/api/__init__.py b/nova/api/__init__.py index 7e75445a8..80f9f2109 100644 --- a/nova/api/__init__.py +++ b/nova/api/__init__.py @@ -22,7 +22,6 @@ Root WSGI middleware for all API controllers. :osapi_subdomain: subdomain running the OpenStack API (default: api) :ec2api_subdomain: subdomain running the EC2 API (default: ec2) -:FAKE_subdomain: set to 'api' or 'ec2', requests default to that endpoint """ -- cgit From edd7e3ed3bee6c11156569ab13b4eb5b3a1f7152 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 23 Nov 2010 21:52:00 +0100 Subject: Address PEP8 complaints. --- nova/server.py | 3 ++- nova/twistd.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'nova') diff --git a/nova/server.py b/nova/server.py index 4d0f6e4da..a0ee54681 100644 --- a/nova/server.py +++ b/nova/server.py @@ -42,7 +42,8 @@ flags.DEFINE_bool('daemonize', False, 'daemonize this process') # clutter. flags.DEFINE_bool('use_syslog', True, 'output to syslog when daemonizing') flags.DEFINE_string('logfile', None, 'log file to output to') -flags.DEFINE_string('logdir', None, 'directory to keep log files in (will be prepended to $logfile)') +flags.DEFINE_string('logdir', None, 'directory to keep log files in ' + '(will be prepended to $logfile)') flags.DEFINE_string('pidfile', None, 'pid file to output to') flags.DEFINE_string('working_directory', './', 'working directory...') flags.DEFINE_integer('uid', os.getuid(), 'uid under which to run') diff --git a/nova/twistd.py b/nova/twistd.py index 6c6cb955f..cb5648ce6 100644 --- a/nova/twistd.py +++ b/nova/twistd.py @@ -43,7 +43,9 @@ else: FLAGS = flags.FLAGS -flags.DEFINE_string('logdir', None, 'directory to keep log files in (will be prepended to $logfile)') +flags.DEFINE_string('logdir', None, 'directory to keep log files in ' + '(will be prepended to $logfile)') + class TwistdServerOptions(ServerOptions): def parseArgs(self, *args): -- cgit From 3df7b85265b123080387f1a844e067026410a9bc Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 23 Nov 2010 21:58:46 +0100 Subject: Address pep8 complaints. --- nova/utils.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nova') diff --git a/nova/utils.py b/nova/utils.py index 820d5bb8a..142584df8 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -174,6 +174,7 @@ def isotime(at=None): def parse_isotime(timestr): return datetime.datetime.strptime(timestr, TIME_FORMAT) + def parse_mailmap(mailmap='.mailmap'): mapping = {} if os.path.exists(mailmap): @@ -185,6 +186,7 @@ def parse_mailmap(mailmap='.mailmap'): mapping[alias] = canonical_email return mapping + def str_dict_replace(s, mapping): for s1, s2 in mapping.iteritems(): s = s.replace(s1, s2) -- cgit