From be4798296df3f380ce6a68c5387515a00d24aea7 Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Thu, 20 Jan 2011 18:08:01 -0600 Subject: [PATCH 01/49] added default label to nova-manage and create_networks --- bin/nova-manage | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index d0901ddfc..38d36ab0f 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -442,7 +442,7 @@ class NetworkCommands(object): def create(self, fixed_range=None, num_networks=None, network_size=None, vlan_start=None, vpn_start=None, - fixed_range_v6=None): + fixed_range_v6=None, label='public'): """Creates fixed ips for host by range arguments: [fixed_range=FLAG], [num_networks=FLAG], [network_size=FLAG], [vlan_start=FLAG], @@ -463,7 +463,8 @@ class NetworkCommands(object): net_manager.create_networks(context.get_admin_context(), fixed_range, int(num_networks), int(network_size), int(vlan_start), - int(vpn_start), fixed_range_v6) + int(vpn_start), fixed_range_v6, + label) class ServiceCommands(object): From e28ae936888d3fd19e26762f685cd59b8fdbb93b Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Thu, 20 Jan 2011 18:44:00 -0600 Subject: [PATCH 02/49] moved argument for label --- bin/nova-manage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 38d36ab0f..73832b0eb 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -441,8 +441,8 @@ class NetworkCommands(object): """Class for managing networks.""" def create(self, fixed_range=None, num_networks=None, - network_size=None, vlan_start=None, vpn_start=None, - fixed_range_v6=None, label='public'): + network_size=None, label='public', vlan_start=None, + vpn_start=None, fixed_range_v6=None): """Creates fixed ips for host by range arguments: [fixed_range=FLAG], [num_networks=FLAG], [network_size=FLAG], [vlan_start=FLAG], From 1a8d87fddb51992ea86e5e0aee50e7a1d0521891 Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Thu, 20 Jan 2011 18:51:46 -0600 Subject: [PATCH 03/49] undid moving argument --- bin/nova-manage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 73832b0eb..9603c6a49 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -441,8 +441,8 @@ class NetworkCommands(object): """Class for managing networks.""" def create(self, fixed_range=None, num_networks=None, - network_size=None, label='public', vlan_start=None, - vpn_start=None, fixed_range_v6=None): + network_size=None, vlan_start=None, + vpn_start=None, fixed_range_v6=None, label='public'): """Creates fixed ips for host by range arguments: [fixed_range=FLAG], [num_networks=FLAG], [network_size=FLAG], [vlan_start=FLAG], From 353ff8dd38e6eb6b37971f0641d9e00957950671 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Thu, 27 Jan 2011 23:53:28 -0600 Subject: [PATCH 04/49] Working on api / manager / db support for zones --- bin/nova-manage | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/nova-manage b/bin/nova-manage index 7835ca551..b62687aec 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -569,6 +569,15 @@ class DbCommands(object): print migration.db_version() +class ZoneCommands(object): + """Methods for defining zones.""" + + def create(self, name): + """Create a new Zone for this deployment.""" + ctxt = context.get_admin_context() + db.create_zone(ctxt, name) + + class VolumeCommands(object): """Methods for dealing with a cloud in an odd state""" @@ -620,6 +629,7 @@ CATEGORIES = [ ('service', ServiceCommands), ('log', LogCommands), ('db', DbCommands), + ('zone', ZoneCommands), ('volume', VolumeCommands)] From 4e3636692734ab16ccbdae64d35f1b3cee249c3e Mon Sep 17 00:00:00 2001 From: termie Date: Wed, 2 Feb 2011 13:13:10 -0800 Subject: [PATCH 05/49] some updates to HACKING to describe the docstrings --- HACKING | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/HACKING b/HACKING index 3af2381bf..4e0dfc835 100644 --- a/HACKING +++ b/HACKING @@ -47,3 +47,18 @@ Human Alphabetical Order Examples from nova.auth import users from nova.endpoint import api from nova.endpoint import cloud + +Docstrings +---------- + """Summary of the function, class or method, less than 80 characters. + + New paragraph after newline that explains in more detail any general + information about the function, class or method. After this, if defining + parameters and return types use the Sphinx format. After that an extra + newline then close the quotations. + + :param foo: the foo parameter + :param bar: the bar parameter + :rtype: the return type + + """ From e3485ee0aec875ea275607fc48fc787587ac5e53 Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Wed, 9 Feb 2011 10:08:15 +0000 Subject: [PATCH 06/49] Added test case for 'not enough memory' Successfully ran unit tests Fixed pep8 errors --- nova/tests/test_xenapi.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index 9f5b266f3..d5660c5d1 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -243,7 +243,8 @@ class XenAPIVMTestCase(test.TestCase): # Check that the VM is running according to XenAPI. self.assertEquals(vm['power_state'], 'Running') - def _test_spawn(self, image_id, kernel_id, ramdisk_id): + def _test_spawn(self, image_id, kernel_id, ramdisk_id, + instance_type="m1.large"): stubs.stubout_session(self.stubs, stubs.FakeSessionForVMTests) values = {'name': 1, 'id': 1, @@ -252,7 +253,7 @@ class XenAPIVMTestCase(test.TestCase): 'image_id': image_id, 'kernel_id': kernel_id, 'ramdisk_id': ramdisk_id, - 'instance_type': 'm1.large', + 'instance_type': instance_type, 'mac_address': 'aa:bb:cc:dd:ee:ff', } conn = xenapi_conn.get_connection(False) @@ -260,6 +261,12 @@ class XenAPIVMTestCase(test.TestCase): conn.spawn(instance) self.check_vm_record(conn) + def test_spawn_not_enough_memory(self): + FLAGS.xenapi_image_service = 'glance' + self.assertRaises(Exception, + self._test_spawn, + 1, 2, 3, "m1.xlarge") + def test_spawn_raw_objectstore(self): FLAGS.xenapi_image_service = 'objectstore' self._test_spawn(1, None, None) From 4b4657091c608ccf53b0358f56b1c114c6d53bb9 Mon Sep 17 00:00:00 2001 From: brian-lamar Date: Wed, 9 Feb 2011 13:36:16 -0500 Subject: [PATCH 07/49] Added myself to Authors --- Authors | 1 + 1 file changed, 1 insertion(+) diff --git a/Authors b/Authors index 27782738f..14cc95377 100644 --- a/Authors +++ b/Authors @@ -3,6 +3,7 @@ Anne Gentle Anthony Young Antony Messerli Armando Migliaccio +Brian Lamar Chiradeep Vittal Chmouel Boudjnah Chris Behrens From 2b36c63bebc9175c6123ba65f228f0d6303c2bb2 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Wed, 9 Feb 2011 21:54:52 -0500 Subject: [PATCH 08/49] adding myself to Authors file --- Authors | 1 + 1 file changed, 1 insertion(+) diff --git a/Authors b/Authors index 27782738f..563ddf759 100644 --- a/Authors +++ b/Authors @@ -3,6 +3,7 @@ Anne Gentle Anthony Young Antony Messerli Armando Migliaccio +Brian Waldon Chiradeep Vittal Chmouel Boudjnah Chris Behrens From 2c0273afa1e94bd3c71f3290607277ada7d1607b Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Thu, 10 Feb 2011 08:43:46 -0400 Subject: [PATCH 09/49] removed ZoneCommands from nova-manage --- bin/nova-manage | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index b62687aec..7835ca551 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -569,15 +569,6 @@ class DbCommands(object): print migration.db_version() -class ZoneCommands(object): - """Methods for defining zones.""" - - def create(self, name): - """Create a new Zone for this deployment.""" - ctxt = context.get_admin_context() - db.create_zone(ctxt, name) - - class VolumeCommands(object): """Methods for dealing with a cloud in an odd state""" @@ -629,7 +620,6 @@ CATEGORIES = [ ('service', ServiceCommands), ('log', LogCommands), ('db', DbCommands), - ('zone', ZoneCommands), ('volume', VolumeCommands)] From 8c49369ba4a298cb9da4e1022a60d6ad8f7f3ba1 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Thu, 10 Feb 2011 16:08:19 -0400 Subject: [PATCH 10/49] template adjusted to NOVA_TOOLS, zone db & os api layers added --- nova/auth/novarc.template | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nova/auth/novarc.template b/nova/auth/novarc.template index c53a4acdc..702df3bb0 100644 --- a/nova/auth/novarc.template +++ b/nova/auth/novarc.template @@ -10,7 +10,6 @@ export NOVA_CERT=${NOVA_KEY_DIR}/%(nova)s export EUCALYPTUS_CERT=${NOVA_CERT} # euca-bundle-image seems to require this set alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}" alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}" -export CLOUD_SERVERS_API_KEY="%(access)s" -export CLOUD_SERVERS_USERNAME="%(user)s" -export CLOUD_SERVERS_URL="%(os)s" - +export NOVA_TOOLS_API_KEY="%(access)s" +export NOVA_TOOLS_USERNAME="%(user)s" +export NOVA_TOOLS_URL="%(os)s" From 5b36773976519819b9ef2890a147c49b2ff6a1ba Mon Sep 17 00:00:00 2001 From: termie Date: Sat, 12 Feb 2011 13:30:31 -0800 Subject: [PATCH 11/49] fix :returns: and add pep-0257 --- HACKING | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/HACKING b/HACKING index 4e0dfc835..e58d60e58 100644 --- a/HACKING +++ b/HACKING @@ -57,8 +57,12 @@ Docstrings parameters and return types use the Sphinx format. After that an extra newline then close the quotations. + When writing the docstring for a class, an extra line should be placed + after the closing quotations. For more in-depth explanations for these + decisions see http://www.python.org/dev/peps/pep-0257/ + :param foo: the foo parameter :param bar: the bar parameter - :rtype: the return type + :returns: description of the return value """ From 439a76a027096b07130e25d628c367af6b2ffcb2 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 14 Feb 2011 10:43:22 -0800 Subject: [PATCH 12/49] fix for bug #716847 - if a volume has not been assigned to a host, then delete from db and skip rpc --- bin/nova-manage | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/nova-manage b/bin/nova-manage index 7835ca551..e4c0684c4 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -579,6 +579,13 @@ class VolumeCommands(object): ctxt = context.get_admin_context() volume = db.volume_get(ctxt, param2id(volume_id)) host = volume['host'] + + if not host: + print "Volume not yet assigned to host." + print "Deleting volume from database and skipping rpc." + db.volume_destroy(ctxt, param2id(volume_id)) + return + if volume['status'] == 'in-use': print "Volume is in-use." print "Detach volume from instance and then try again." From ab716de85bcb0acda6d5983690688d9acb33faaa Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 14 Feb 2011 21:06:16 +0100 Subject: [PATCH 13/49] Use eventlet.green.subprocess instead of standard subprocess Eventlet's monkey patching causes the os.wait call in the standard subprocess module to be non-blocking. This means that if it happens to call self.wait on a Popen object that hasn't completely terminated it'll be left as a zombie and its fd's are also leaked. --- nova/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/utils.py b/nova/utils.py index 8d7ff1f64..ba71ebf39 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -25,7 +25,6 @@ import inspect import json import os import random -import subprocess import socket import struct import sys @@ -36,6 +35,7 @@ import netaddr from eventlet import event from eventlet import greenthread +from eventlet.green import subprocess from nova import exception from nova.exception import ProcessExecutionError From 87a6ff90458eb3531032ab988b48605cc833b75a Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 14 Feb 2011 23:19:15 +0100 Subject: [PATCH 14/49] Resurrect logdir option. --- nova/flags.py | 2 ++ nova/log.py | 11 +++++++++-- nova/twistd.py | 2 -- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/nova/flags.py b/nova/flags.py index 3ba3fe6fa..f64a62da9 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -282,6 +282,8 @@ DEFINE_integer('auth_token_ttl', 3600, 'Seconds for auth tokens to linger') DEFINE_string('state_path', os.path.join(os.path.dirname(__file__), '../'), "Top-level directory for maintaining nova's state") +DEFINE_string('logdir', None, 'output to a per-service log file in named ' + 'directory') DEFINE_string('sql_connection', 'sqlite:///$state_path/nova.sqlite', diff --git a/nova/log.py b/nova/log.py index b541488bd..a5b4828d5 100644 --- a/nova/log.py +++ b/nova/log.py @@ -28,9 +28,11 @@ It also allows setting of formatting information through flags. import cStringIO +import inspect import json import logging import logging.handlers +import os import sys import traceback @@ -123,8 +125,13 @@ def basicConfig(): syslog = SysLogHandler(address='/dev/log') syslog.setFormatter(_formatter) logging.root.addHandler(syslog) - if FLAGS.logfile: - logfile = FileHandler(FLAGS.logfile) + if FLAGS.logfile or FLAGS.logdir: + if FLAGS.logfile: + logfile = FLAGS.logfile + else: + binary = os.path.basename(inspect.stack()[-1][1]) + logpath = '%s.log' % (os.path.join(FLAGS.logdir, binary),) + logfile = FileHandler(logpath) logfile.setFormatter(_formatter) logging.root.addHandler(logfile) diff --git a/nova/twistd.py b/nova/twistd.py index 6390a8144..60ff7879a 100644 --- a/nova/twistd.py +++ b/nova/twistd.py @@ -43,8 +43,6 @@ else: FLAGS = flags.FLAGS -flags.DEFINE_string('logdir', None, 'directory to keep log files in ' - '(will be prepended to $logfile)') class TwistdServerOptions(ServerOptions): From e75c617a116204b88cbf6a6001b5d068aabcda38 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 14 Feb 2011 23:27:31 +0100 Subject: [PATCH 15/49] Use RotatingFileHandler instead of FileHandler. --- nova/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/log.py b/nova/log.py index b541488bd..413dd946b 100644 --- a/nova/log.py +++ b/nova/log.py @@ -92,7 +92,7 @@ critical = logging.critical log = logging.log # handlers StreamHandler = logging.StreamHandler -FileHandler = logging.FileHandler +FileHandler = logging.RotatingFileHandler # logging.SysLogHandler is nicer than logging.logging.handler.SysLogHandler. SysLogHandler = logging.handlers.SysLogHandler From 462baa5af1781f058d70e12ba717787fbc1a5894 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Mon, 14 Feb 2011 14:52:58 -0800 Subject: [PATCH 16/49] fixed template and added migration --- nova/auth/novarc.template | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nova/auth/novarc.template b/nova/auth/novarc.template index 702df3bb0..cda2ecc28 100644 --- a/nova/auth/novarc.template +++ b/nova/auth/novarc.template @@ -10,6 +10,6 @@ export NOVA_CERT=${NOVA_KEY_DIR}/%(nova)s export EUCALYPTUS_CERT=${NOVA_CERT} # euca-bundle-image seems to require this set alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}" alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}" -export NOVA_TOOLS_API_KEY="%(access)s" -export NOVA_TOOLS_USERNAME="%(user)s" -export NOVA_TOOLS_URL="%(os)s" +export NOVA_API_KEY="%(access)s" +export NOVA_USERNAME="%(user)s" +export NOVA_URL="%(os)s" From 3550f48cfc9be62f6b3977a488a8aab146888908 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Mon, 14 Feb 2011 20:11:29 -0400 Subject: [PATCH 17/49] fixed nova-combined debug hack and renamed ChildZone to Zone --- bin/nova-combined | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/nova-combined b/bin/nova-combined index a0f552d64..913c866bf 100755 --- a/bin/nova-combined +++ b/bin/nova-combined @@ -53,11 +53,11 @@ if __name__ == '__main__': compute = service.Service.create(binary='nova-compute') network = service.Service.create(binary='nova-network') - #volume = service.Service.create(binary='nova-volume') + volume = service.Service.create(binary='nova-volume') scheduler = service.Service.create(binary='nova-scheduler') #objectstore = service.Service.create(binary='nova-objectstore') - service.serve(compute, network, scheduler) + service.serve(compute, network, volume, scheduler) apps = [] paste_config_file = wsgi.paste_config_file('nova-api.conf') From 83d90bac28ec486213df3ae00267045a52961293 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 15 Feb 2011 12:33:31 +0100 Subject: [PATCH 18/49] Break out of the "for group in rv" loop in security group unit tests so that we are use we are dealing with the correct group. --- nova/tests/test_api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nova/tests/test_api.py b/nova/tests/test_api.py index 2569e262b..efd6d94a8 100644 --- a/nova/tests/test_api.py +++ b/nova/tests/test_api.py @@ -258,6 +258,7 @@ class ApiEc2TestCase(test.TestCase): self.assertEquals(int(group.rules[0].to_port), 81) self.assertEquals(len(group.rules[0].grants), 1) self.assertEquals(str(group.rules[0].grants[0]), '0.0.0.0/0') + break self.expect_http() self.mox.ReplayAll() @@ -324,6 +325,7 @@ class ApiEc2TestCase(test.TestCase): self.assertEquals(int(group.rules[0].to_port), 81) self.assertEquals(len(group.rules[0].grants), 1) self.assertEquals(str(group.rules[0].grants[0]), '::/0') + break self.expect_http() self.mox.ReplayAll() From 19ff3548a5fa72783aa3b43b755125277d091738 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 15 Feb 2011 13:18:27 +0100 Subject: [PATCH 19/49] Beautify it a little bit, thanks to dabo. --- nova/tests/test_api.py | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/nova/tests/test_api.py b/nova/tests/test_api.py index efd6d94a8..fa27825cd 100644 --- a/nova/tests/test_api.py +++ b/nova/tests/test_api.py @@ -248,17 +248,14 @@ class ApiEc2TestCase(test.TestCase): self.mox.ReplayAll() rv = self.ec2.get_all_security_groups() - # I don't bother checkng that we actually find it here, - # because the create/delete unit test further up should - # be good enough for that. - for group in rv: - if group.name == security_group_name: - self.assertEquals(len(group.rules), 1) - self.assertEquals(int(group.rules[0].from_port), 80) - self.assertEquals(int(group.rules[0].to_port), 81) - self.assertEquals(len(group.rules[0].grants), 1) - self.assertEquals(str(group.rules[0].grants[0]), '0.0.0.0/0') - break + + group = [grp for grp in rv if grp.name == security_group_name][0] + + self.assertEquals(len(group.rules), 1) + self.assertEquals(int(group.rules[0].from_port), 80) + self.assertEquals(int(group.rules[0].to_port), 81) + self.assertEquals(len(group.rules[0].grants), 1) + self.assertEquals(str(group.rules[0].grants[0]), '0.0.0.0/0') self.expect_http() self.mox.ReplayAll() @@ -315,17 +312,13 @@ class ApiEc2TestCase(test.TestCase): self.mox.ReplayAll() rv = self.ec2.get_all_security_groups() - # I don't bother checkng that we actually find it here, - # because the create/delete unit test further up should - # be good enough for that. - for group in rv: - if group.name == security_group_name: - self.assertEquals(len(group.rules), 1) - self.assertEquals(int(group.rules[0].from_port), 80) - self.assertEquals(int(group.rules[0].to_port), 81) - self.assertEquals(len(group.rules[0].grants), 1) - self.assertEquals(str(group.rules[0].grants[0]), '::/0') - break + + group = [grp for grp in rv if grp.name == security_group_name][0] + self.assertEquals(len(group.rules), 1) + self.assertEquals(int(group.rules[0].from_port), 80) + self.assertEquals(int(group.rules[0].to_port), 81) + self.assertEquals(len(group.rules[0].grants), 1) + self.assertEquals(str(group.rules[0].grants[0]), '::/0') self.expect_http() self.mox.ReplayAll() From fe4483353525fb60131e829a5b2b321852e576b5 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 15 Feb 2011 14:02:19 +0100 Subject: [PATCH 20/49] =?UTF-8?q?Na=C3=AFve=20attempt=20at=20threading=20r?= =?UTF-8?q?pc=20requests.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nova/rpc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nova/rpc.py b/nova/rpc.py index 2b1f7298b..efe6164ad 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -29,6 +29,7 @@ import uuid from carrot import connection as carrot_connection from carrot import messaging +from eventlet import greenpool from eventlet import greenthread from nova import context @@ -155,11 +156,15 @@ class AdapterConsumer(TopicConsumer): def __init__(self, connection=None, topic="broadcast", proxy=None): LOG.debug(_('Initing the Adapter Consumer for %s') % topic) self.proxy = proxy + self.pool = greenpool.GreenPool(1024) super(AdapterConsumer, self).__init__(connection=connection, topic=topic) + def receive(self, *args, **kwargs): + self.pool.spawn_n(self._receive, *args, **kwargs) + @exception.wrap_exception - def receive(self, message_data, message): + def _receive(self, message_data, message): """Magically looks for a method on the proxy object and calls it Message data should be a dictionary with two keys: From 9f496cc77a3277e829ba0eb98367272227f51b03 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Tue, 15 Feb 2011 15:02:50 +0100 Subject: [PATCH 22/49] Adding missing scripts and files to setup.py / MANIFEST.in --- MANIFEST.in | 9 +++++++++ setup.py | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 3908830d7..510f1d688 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,14 +6,23 @@ graft doc graft smoketests graft tools graft etc +graft bzrplugins +graft contrib +graft locale +graft plugins include nova/api/openstack/notes.txt +include nova/auth/*.schema include nova/auth/novarc.template +include nova/auth/opendj.sh include nova/auth/slap.sh include nova/cloudpipe/bootscript.sh include nova/cloudpipe/client.ovpn.template +include nova/cloudpipe/bootscript.template include nova/compute/fakevirtinstance.xml include nova/compute/interfaces.template +include nova/console/xvp.conf.template include nova/db/sqlalchemy/migrate_repo/migrate.cfg +include nova/db/sqlalchemy/migrate_repo/README include nova/virt/interfaces.template include nova/virt/libvirt*.xml.template include nova/tests/CA/ diff --git a/setup.py b/setup.py index e3c45ce3e..4e25f43ed 100644 --- a/setup.py +++ b/setup.py @@ -85,9 +85,13 @@ setup(name='nova', packages=find_packages(exclude=['bin', 'smoketests']), include_package_data=True, test_suite='nose.collector', - scripts=['bin/nova-api', + scripts=['bin/nova-ajax-console-proxy', + 'bin/nova-api', + 'bin/nova-combined', 'bin/nova-compute', + 'bin/nova-console', 'bin/nova-dhcpbridge', + 'bin/nova-direct-api', 'bin/nova-import-canonical-imagestore', 'bin/nova-instancemonitor', 'bin/nova-logspool', @@ -96,5 +100,6 @@ setup(name='nova', 'bin/nova-objectstore', 'bin/nova-scheduler', 'bin/nova-spoolsentry', + 'bin/stack', 'bin/nova-volume', 'tools/nova-debug']) From ed04186e284096d59fd5027223dcf6e466fc26da Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Tue, 15 Feb 2011 15:44:46 +0100 Subject: [PATCH 23/49] Translations will be shipped in po/, not locale/ --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 510f1d688..9b6a3b2da 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,7 +8,7 @@ graft tools graft etc graft bzrplugins graft contrib -graft locale +graft po graft plugins include nova/api/openstack/notes.txt include nova/auth/*.schema From 89e8cd6ac72cee012064faf9c1632ae72601148b Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Tue, 15 Feb 2011 15:53:58 +0100 Subject: [PATCH 24/49] Missing nova/tests/db/nova.austin.sqlite file --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 9b6a3b2da..f0a9cffb3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -34,6 +34,7 @@ include nova/tests/bundle/1mb.manifest.xml include nova/tests/bundle/1mb.no_kernel_or_ramdisk.manifest.xml include nova/tests/bundle/1mb.part.0 include nova/tests/bundle/1mb.part.1 +include nova/tests/db/nova.austin.sqlite include plugins/xenapi/README include plugins/xenapi/etc/xapi.d/plugins/objectstore include plugins/xenapi/etc/xapi.d/plugins/pluginlib_nova.py From fc2e5cf9e0459cd7eccf4d1f8e64fda0686d7ab3 Mon Sep 17 00:00:00 2001 From: brian-lamar Date: Tue, 15 Feb 2011 15:33:17 -0500 Subject: [PATCH 25/49] Added teammate Naveed to authors file for his help. --- Authors | 1 + 1 file changed, 1 insertion(+) diff --git a/Authors b/Authors index e8bb58456..03f30084d 100644 --- a/Authors +++ b/Authors @@ -43,6 +43,7 @@ Monty Taylor MORITA Kazutaka Muneyuki Noguchi Nachi Ueno +Naveed Massjouni Paul Voccio Ricardo Carrillo Cruz Rick Clark From dc93d6be4c58f5a07e973e08d8a8191c62db1d81 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 15 Feb 2011 22:13:08 +0100 Subject: [PATCH 26/49] Don't hid RotatingFileHandler behind FileHandler's name. --- nova/log.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/log.py b/nova/log.py index 413dd946b..82a13f6a8 100644 --- a/nova/log.py +++ b/nova/log.py @@ -92,7 +92,7 @@ critical = logging.critical log = logging.log # handlers StreamHandler = logging.StreamHandler -FileHandler = logging.RotatingFileHandler +RotatingFileHandler = logging.RotatingFileHandler # logging.SysLogHandler is nicer than logging.logging.handler.SysLogHandler. SysLogHandler = logging.handlers.SysLogHandler @@ -124,7 +124,7 @@ def basicConfig(): syslog.setFormatter(_formatter) logging.root.addHandler(syslog) if FLAGS.logfile: - logfile = FileHandler(FLAGS.logfile) + logfile = RotatingFileHandler(FLAGS.logfile) logfile.setFormatter(_formatter) logging.root.addHandler(logfile) From 54ac07aa2b655f11c7d091d6a6bc7cc120300c07 Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Tue, 15 Feb 2011 15:30:44 -0600 Subject: [PATCH 27/49] changed d to s --- locale/nova.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/nova.pot b/locale/nova.pot index a96411e33..53e38c619 100644 --- a/locale/nova.pot +++ b/locale/nova.pot @@ -1826,7 +1826,7 @@ msgstr "" #: nova/virt/xenapi/vm_utils.py:290 #, python-format -msgid "PV Kernel in VDI:%d" +msgid "PV Kernel in VDI:%s" msgstr "" #: nova/virt/xenapi/vm_utils.py:318 From f40b6b47b66c6a6207c40c08cefc8ff25e71775c Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 15 Feb 2011 23:11:51 +0100 Subject: [PATCH 28/49] Refactor code that decides which logfile to use, if any. Adds unit tests. --- nova/log.py | 17 +++++++++++------ nova/tests/test_log.py | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/nova/log.py b/nova/log.py index a5b4828d5..ec6681edd 100644 --- a/nova/log.py +++ b/nova/log.py @@ -112,6 +112,15 @@ def _dictify_context(context): context = context.to_dict() return context +def _get_binary_name(): + return os.path.basename(inspect.stack()[-1][1]) + +def get_log_file_path(binary=None): + if FLAGS.logfile: + return FLAGS.logfile + if FLAGS.logdir: + binary = binary or _get_binary_name() + return '%s.log' % (os.path.join(FLAGS.logdir, binary),) def basicConfig(): logging.basicConfig() @@ -125,12 +134,8 @@ def basicConfig(): syslog = SysLogHandler(address='/dev/log') syslog.setFormatter(_formatter) logging.root.addHandler(syslog) - if FLAGS.logfile or FLAGS.logdir: - if FLAGS.logfile: - logfile = FLAGS.logfile - else: - binary = os.path.basename(inspect.stack()[-1][1]) - logpath = '%s.log' % (os.path.join(FLAGS.logdir, binary),) + logpath = get_log_file_path() + if logpath: logfile = FileHandler(logpath) logfile.setFormatter(_formatter) logging.root.addHandler(logfile) diff --git a/nova/tests/test_log.py b/nova/tests/test_log.py index 868a5ead3..7a5c52935 100644 --- a/nova/tests/test_log.py +++ b/nova/tests/test_log.py @@ -46,6 +46,27 @@ class RootLoggerTestCase(test.TestCase): self.assert_(True) # didn't raise exception +class LogHandlerTestCase(test.TestCase): + def test_log_path_logdir(self): + self.flags(logdir='/some/path') + self.assertEquals(log.get_log_file_path(binary='foo-bar'), + '/some/path/foo-bar.log') + + def test_log_path_logfile(self): + self.flags(logfile='/some/path/foo-bar.log') + self.assertEquals(log.get_log_file_path(binary='foo-bar'), + '/some/path/foo-bar.log') + + def test_log_path_none(self): + self.assertIsNone(log.get_log_file_path(binary='foo-bar')) + + def test_log_path_logfile_overrides_logdir(self): + self.flags(logdir='/some/other/path', + logfile='/some/path/foo-bar.log') + self.assertEquals(log.get_log_file_path(binary='foo-bar'), + '/some/path/foo-bar.log') + + class NovaFormatterTestCase(test.TestCase): def setUp(self): super(NovaFormatterTestCase, self).setUp() From 5d014edf5e693b918fbd847dfcfe286a183077ba Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 15 Feb 2011 23:13:25 +0100 Subject: [PATCH 29/49] Don't hide RotatingFileHandler behind FileHandler's name. --- nova/log.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/log.py b/nova/log.py index 413dd946b..32b6d4629 100644 --- a/nova/log.py +++ b/nova/log.py @@ -92,7 +92,7 @@ critical = logging.critical log = logging.log # handlers StreamHandler = logging.StreamHandler -FileHandler = logging.RotatingFileHandler +RotatingFileHandler = logging.handlers.RotatingFileHandler # logging.SysLogHandler is nicer than logging.logging.handler.SysLogHandler. SysLogHandler = logging.handlers.SysLogHandler @@ -124,7 +124,7 @@ def basicConfig(): syslog.setFormatter(_formatter) logging.root.addHandler(syslog) if FLAGS.logfile: - logfile = FileHandler(FLAGS.logfile) + logfile = RotatingFileHandler(FLAGS.logfile) logfile.setFormatter(_formatter) logging.root.addHandler(logfile) From 2b4067f923e937fc9c9fb9270c04e61a9ff97357 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Wed, 16 Feb 2011 00:10:17 +0100 Subject: [PATCH 30/49] Make rpc thread pool size configurable. --- nova/rpc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nova/rpc.py b/nova/rpc.py index efe6164ad..067d954d0 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -43,6 +43,8 @@ from nova import utils FLAGS = flags.FLAGS LOG = logging.getLogger('nova.rpc') +FLAGS.DEFINE_integer('rpc_thread_pool_size', 1024, 'Size of RPC thread pool') + class Connection(carrot_connection.BrokerConnection): """Connection instance object""" @@ -156,7 +158,7 @@ class AdapterConsumer(TopicConsumer): def __init__(self, connection=None, topic="broadcast", proxy=None): LOG.debug(_('Initing the Adapter Consumer for %s') % topic) self.proxy = proxy - self.pool = greenpool.GreenPool(1024) + self.pool = greenpool.GreenPool(FLAGS.rpc_thread_pool_size) super(AdapterConsumer, self).__init__(connection=connection, topic=topic) From e50c7169eda1dff01f32080c4f13a07246ebabda Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Tue, 15 Feb 2011 18:20:44 -0600 Subject: [PATCH 31/49] stubbed out reset networkin xenapi VM tests to solve domid problem --- nova/tests/test_xenapi.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index d5660c5d1..6b8efc9d8 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -32,6 +32,7 @@ from nova.virt import xenapi_conn from nova.virt.xenapi import fake as xenapi_fake from nova.virt.xenapi import volume_utils from nova.virt.xenapi.vmops import SimpleDH +from nova.virt.xenapi.vmops import VMOps from nova.tests.db import fakes as db_fakes from nova.tests.xenapi import stubs from nova.tests.glance import stubs as glance_stubs @@ -141,6 +142,10 @@ class XenAPIVolumeTestCase(test.TestCase): self.stubs.UnsetAll() +def reset_network(*args): + pass + + class XenAPIVMTestCase(test.TestCase): """ Unit tests for VM operations @@ -162,6 +167,7 @@ class XenAPIVMTestCase(test.TestCase): stubs.stubout_session(self.stubs, stubs.FakeSessionForVMTests) stubs.stubout_get_this_vm_uuid(self.stubs) stubs.stubout_stream_disk(self.stubs) + self.stubs.Set(VMOps, 'reset_network', reset_network) glance_stubs.stubout_glance_client(self.stubs, glance_stubs.FakeGlance) self.conn = xenapi_conn.get_connection(False) From 2d3e7e97a2ebece60854e42f91ae816a08fc72f8 Mon Sep 17 00:00:00 2001 From: Vasiliy Shlykov Date: Wed, 16 Feb 2011 10:13:52 +0300 Subject: [PATCH 32/49] Added myself to the authors file. --- Authors | 1 + 1 file changed, 1 insertion(+) diff --git a/Authors b/Authors index b359fec22..c338a9b3e 100644 --- a/Authors +++ b/Authors @@ -56,6 +56,7 @@ Thierry Carrez Todd Willey Trey Morris Tushar Patil +Vasiliy Shlykov Vishvananda Ishaya Youcef Laribi Zhixue Wu From b5128dc44ce7a4d8b454d92df58eb9d9d9a38707 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Wed, 16 Feb 2011 10:02:17 +0100 Subject: [PATCH 33/49] assertIsNone is a 2.7-ism. --- nova/tests/test_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/tests/test_log.py b/nova/tests/test_log.py index 7a5c52935..c2c9d7772 100644 --- a/nova/tests/test_log.py +++ b/nova/tests/test_log.py @@ -58,7 +58,7 @@ class LogHandlerTestCase(test.TestCase): '/some/path/foo-bar.log') def test_log_path_none(self): - self.assertIsNone(log.get_log_file_path(binary='foo-bar')) + self.assertTrue(log.get_log_file_path(binary='foo-bar') is None) def test_log_path_logfile_overrides_logdir(self): self.flags(logdir='/some/other/path', From 630875d0e3a606ab1436a99474cb0838c6f5d872 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Wed, 16 Feb 2011 10:46:59 +0100 Subject: [PATCH 34/49] Fix PEP-8 stuff --- nova/log.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nova/log.py b/nova/log.py index ec6681edd..90c40cca7 100644 --- a/nova/log.py +++ b/nova/log.py @@ -112,9 +112,11 @@ def _dictify_context(context): context = context.to_dict() return context + def _get_binary_name(): return os.path.basename(inspect.stack()[-1][1]) + def get_log_file_path(binary=None): if FLAGS.logfile: return FLAGS.logfile @@ -122,6 +124,7 @@ def get_log_file_path(binary=None): binary = binary or _get_binary_name() return '%s.log' % (os.path.join(FLAGS.logdir, binary),) + def basicConfig(): logging.basicConfig() for handler in logging.root.handlers: From 46668b3a75d4d346e4176bdf68530e0298a16cce Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Wed, 16 Feb 2011 12:15:48 +0100 Subject: [PATCH 35/49] added functionality to nova-manage to list created networks --- bin/nova-manage | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/nova-manage b/bin/nova-manage index 7835ca551..f7cf77adb 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -499,6 +499,18 @@ class NetworkCommands(object): vlan_start=int(vlan_start), vpn_start=int(vpn_start)) + def list(self): + """List all created networks""" + print "%-18s\t%-15s\t%-15s\t%-15s" % ('CIDR', + 'netmask', + 'dhcp_start', + 'DNS') + for network in db.network_get_all(context.get_admin_context()): + print "%-18s\t%-15s\t%-15s\t%-15s" % (network.cidr, + network.netmask, + network.dhcp_start, + network.dns) + class ServiceCommands(object): """Enable and disable running services""" From 6ffbc221c00044f25b51f6a03a08e30f76ac23c2 Mon Sep 17 00:00:00 2001 From: Brian Schott Date: Wed, 16 Feb 2011 13:24:46 -0500 Subject: [PATCH 36/49] fixed authors, import sys in migration.py --- Authors | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Authors b/Authors index 0edabc531..29fbf76b3 100644 --- a/Authors +++ b/Authors @@ -4,7 +4,7 @@ Anthony Young Antony Messerli Armando Migliaccio Bilal Akhtar -Brian Schott +Brian Schott Chiradeep Vittal Chmouel Boudjnah Chris Behrens From ad6d2b909604a25cd2cfdcacca71c87f8c71e12d Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Wed, 16 Feb 2011 20:34:17 +0100 Subject: [PATCH 37/49] Spell flags correctly (i.e. not in upper case) --- nova/rpc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/rpc.py b/nova/rpc.py index 067d954d0..205bb524a 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -43,7 +43,7 @@ from nova import utils FLAGS = flags.FLAGS LOG = logging.getLogger('nova.rpc') -FLAGS.DEFINE_integer('rpc_thread_pool_size', 1024, 'Size of RPC thread pool') +flags.DEFINE_integer('rpc_thread_pool_size', 1024, 'Size of RPC thread pool') class Connection(carrot_connection.BrokerConnection): From 63f039defe06d7828a297e36bb960c947d1a4828 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 16 Feb 2011 12:02:10 -0800 Subject: [PATCH 38/49] sanitize all args to strings before sending them to ldap --- nova/auth/ldapdriver.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/nova/auth/ldapdriver.py b/nova/auth/ldapdriver.py index e652f1caa..99cbb43f9 100644 --- a/nova/auth/ldapdriver.py +++ b/nova/auth/ldapdriver.py @@ -73,6 +73,23 @@ LOG = logging.getLogger("nova.ldapdriver") # creating this now because I'm expecting an auth refactor # in which we may want to change the interface a bit more. +def _clean(attr): + """Clean attr for insertion into ldap""" + if attr is None: + return None + if type(attr) is unicode: + return str(attr) + return attr + +def sanitize(fn): + """Decorator to sanitize all args""" + def _wrapped(self, *args, **kwargs): + args = [_clean(x) for x in args] + kwargs = dict((k, _clean(v)) for (k, v) in kwargs) + return fn(self, *args, **kwargs) + _wrapped.func_name = fn.func_name + return _wrapped + class LdapDriver(object): """Ldap Auth driver @@ -106,23 +123,27 @@ class LdapDriver(object): self.conn.unbind_s() return False + @sanitize def get_user(self, uid): """Retrieve user by id""" attr = self.__get_ldap_user(uid) return self.__to_user(attr) + @sanitize def get_user_from_access_key(self, access): """Retrieve user by access key""" query = '(accessKey=%s)' % access dn = FLAGS.ldap_user_subtree return self.__to_user(self.__find_object(dn, query)) + @sanitize def get_project(self, pid): """Retrieve project by id""" dn = self.__project_to_dn(pid) attr = self.__find_object(dn, LdapDriver.project_pattern) return self.__to_project(attr) + @sanitize def get_users(self): """Retrieve list of users""" attrs = self.__find_objects(FLAGS.ldap_user_subtree, @@ -134,6 +155,7 @@ class LdapDriver(object): users.append(user) return users + @sanitize def get_projects(self, uid=None): """Retrieve list of projects""" pattern = LdapDriver.project_pattern @@ -143,6 +165,7 @@ class LdapDriver(object): pattern) return [self.__to_project(attr) for attr in attrs] + @sanitize def create_user(self, name, access_key, secret_key, is_admin): """Create a user""" if self.__user_exists(name): @@ -196,6 +219,7 @@ class LdapDriver(object): self.conn.add_s(self.__uid_to_dn(name), attr) return self.__to_user(dict(attr)) + @sanitize def create_project(self, name, manager_uid, description=None, member_uids=None): """Create a project""" @@ -231,6 +255,7 @@ class LdapDriver(object): self.conn.add_s(dn, attr) return self.__to_project(dict(attr)) + @sanitize def modify_project(self, project_id, manager_uid=None, description=None): """Modify an existing project""" if not manager_uid and not description: @@ -249,21 +274,25 @@ class LdapDriver(object): dn = self.__project_to_dn(project_id) self.conn.modify_s(dn, attr) + @sanitize def add_to_project(self, uid, project_id): """Add user to project""" dn = self.__project_to_dn(project_id) return self.__add_to_group(uid, dn) + @sanitize def remove_from_project(self, uid, project_id): """Remove user from project""" dn = self.__project_to_dn(project_id) return self.__remove_from_group(uid, dn) + @sanitize def is_in_project(self, uid, project_id): """Check if user is in project""" dn = self.__project_to_dn(project_id) return self.__is_in_group(uid, dn) + @sanitize def has_role(self, uid, role, project_id=None): """Check if user has role @@ -273,6 +302,7 @@ class LdapDriver(object): role_dn = self.__role_to_dn(role, project_id) return self.__is_in_group(uid, role_dn) + @sanitize def add_role(self, uid, role, project_id=None): """Add role for user (or user and project)""" role_dn = self.__role_to_dn(role, project_id) @@ -283,11 +313,13 @@ class LdapDriver(object): else: return self.__add_to_group(uid, role_dn) + @sanitize def remove_role(self, uid, role, project_id=None): """Remove role for user (or user and project)""" role_dn = self.__role_to_dn(role, project_id) return self.__remove_from_group(uid, role_dn) + @sanitize def get_user_roles(self, uid, project_id=None): """Retrieve list of roles for user (or user and project)""" if project_id is None: @@ -307,6 +339,7 @@ class LdapDriver(object): roles = self.__find_objects(project_dn, query) return [role['cn'][0] for role in roles] + @sanitize def delete_user(self, uid): """Delete a user""" if not self.__user_exists(uid): @@ -332,12 +365,14 @@ class LdapDriver(object): # Delete entry self.conn.delete_s(self.__uid_to_dn(uid)) + @sanitize def delete_project(self, project_id): """Delete a project""" project_dn = self.__project_to_dn(project_id) self.__delete_roles(project_dn) self.__delete_group(project_dn) + @sanitize def modify_user(self, uid, access_key=None, secret_key=None, admin=None): """Modify an existing user""" if not access_key and not secret_key and admin is None: From 954bfc56a8102259f805dccf3afd95b49c3e0a59 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 16 Feb 2011 12:03:59 -0800 Subject: [PATCH 39/49] pep8 fixes --- nova/auth/ldapdriver.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nova/auth/ldapdriver.py b/nova/auth/ldapdriver.py index 99cbb43f9..5da7751a0 100644 --- a/nova/auth/ldapdriver.py +++ b/nova/auth/ldapdriver.py @@ -73,6 +73,7 @@ LOG = logging.getLogger("nova.ldapdriver") # creating this now because I'm expecting an auth refactor # in which we may want to change the interface a bit more. + def _clean(attr): """Clean attr for insertion into ldap""" if attr is None: @@ -81,6 +82,7 @@ def _clean(attr): return str(attr) return attr + def sanitize(fn): """Decorator to sanitize all args""" def _wrapped(self, *args, **kwargs): From 9a3073347cf7d1638cb168bf49ecf15548463b2b Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Wed, 16 Feb 2011 16:19:57 -0500 Subject: [PATCH 40/49] Added alternate email to mailmap --- .mailmap | 1 + Authors | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index c6f6c9a8b..a05520884 100644 --- a/.mailmap +++ b/.mailmap @@ -34,3 +34,4 @@ + diff --git a/Authors b/Authors index c57ca8aed..eb9d540bf 100644 --- a/Authors +++ b/Authors @@ -4,7 +4,6 @@ Anthony Young Antony Messerli Armando Migliaccio Bilal Akhtar -Brian Lamar Chiradeep Vittal Chmouel Boudjnah Chris Behrens From 7e97e8f49c4bfdfe64b168103586235b3e5f8ca6 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Wed, 16 Feb 2011 16:22:16 -0500 Subject: [PATCH 41/49] Accidently removed myself from Authors. --- Authors | 1 + 1 file changed, 1 insertion(+) diff --git a/Authors b/Authors index eb9d540bf..c57ca8aed 100644 --- a/Authors +++ b/Authors @@ -4,6 +4,7 @@ Anthony Young Antony Messerli Armando Migliaccio Bilal Akhtar +Brian Lamar Chiradeep Vittal Chmouel Boudjnah Chris Behrens From 0b87d21058454358ab72b149e423c9c11f8f9ef1 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Wed, 16 Feb 2011 16:40:40 -0500 Subject: [PATCH 42/49] Flipped mailmap entries --- .mailmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index a05520884..b2287d65f 100644 --- a/.mailmap +++ b/.mailmap @@ -34,4 +34,4 @@ - + From ceed4069213437a3372839fbc65f5e0f331bd81f Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Thu, 17 Feb 2011 16:46:55 +0100 Subject: [PATCH 43/49] added more I18N --- bin/nova-manage | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index f7cf77adb..c64277908 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -501,9 +501,9 @@ class NetworkCommands(object): def list(self): """List all created networks""" - print "%-18s\t%-15s\t%-15s\t%-15s" % ('CIDR', - 'netmask', - 'dhcp_start', + print "%-18s\t%-15s\t%-15s\t%-15s" % (_('network'), + _('netmask'), + _('start address'), 'DNS') for network in db.network_get_all(context.get_admin_context()): print "%-18s\t%-15s\t%-15s\t%-15s" % (network.cidr, From b9a7076a2cffa7bf76747d2ca4cafab0fff37ff3 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Thu, 17 Feb 2011 16:58:00 +0100 Subject: [PATCH 44/49] added new functionality to list all defined fixed ips --- bin/nova-manage | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/bin/nova-manage b/bin/nova-manage index e4c0684c4..a8c9441e2 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -433,6 +433,37 @@ class ProjectCommands(object): "nova-api server on this host.") +class FixedIpCommands(object): + """Class for managing fixed ip.""" + + def list(self, host=None): + """Lists all fixed ips (optionally by host) arguments: [host]""" + ctxt = context.get_admin_context() + if host == None: + fixed_ips = db.fixed_ip_get_all(ctxt) + else: + fixed_ips = db.fixed_ip_get_all_by_host(ctxt, host) + + print "%-18s\t%-15s\t%-17s\t%-15s\t%s" % (_('network'), + _('IP address'), + _('MAC address'), + _('hostname'), + _('host')) + for fixed_ip in fixed_ips: + hostname = None + host = None + mac_address = None + if fixed_ip['instance']: + instance = fixed_ip['instance'] + hostname = instance['hostname'] + host = instance['host'] + mac_address = instance['mac_address'] + print "%-18s\t%-15s\t%-17s\t%-15s\t%s" % ( + fixed_ip['network']['cidr'], + fixed_ip['address'], + mac_address, hostname, host) + + class FloatingIpCommands(object): """Class for managing floating ip.""" From 2d36bddf8ab3eef9b6706d01ec2c976d1b8f0345 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Thu, 17 Feb 2011 17:10:51 +0100 Subject: [PATCH 45/49] added entry in the category list --- bin/nova-manage | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/nova-manage b/bin/nova-manage index a8c9441e2..ddc78f7e5 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -653,6 +653,7 @@ CATEGORIES = [ ('role', RoleCommands), ('shell', ShellCommands), ('vpn', VpnCommands), + ('fixed', FixedIpCommands), ('floating', FloatingIpCommands), ('network', NetworkCommands), ('service', ServiceCommands), From d3331df835d3737b8786c493d68ac88c60ea926a Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Thu, 17 Feb 2011 12:13:20 -0500 Subject: [PATCH 46/49] Switched mailmap entries --- .mailmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index b2287d65f..a05520884 100644 --- a/.mailmap +++ b/.mailmap @@ -34,4 +34,4 @@ - + From 92353a16302a29c3935caaa8d8f26bda00376be7 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Thu, 17 Feb 2011 21:27:48 +0100 Subject: [PATCH 47/49] Re-alphabetise Authors, move extra addressses into .mailmap. --- .mailmap | 50 ++++++++++++++++++++++++++++---------------------- Authors | 10 +++++----- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/.mailmap b/.mailmap index a05520884..a839eba6c 100644 --- a/.mailmap +++ b/.mailmap @@ -1,37 +1,43 @@ # Format is: -# - - - - - - - - - +# +# - + + + + + + + + + + + + + - + Masumoto + + + - + + + + - + + + + - - - - - - - - + diff --git a/Authors b/Authors index 395c6b9ed..494e614a0 100644 --- a/Authors +++ b/Authors @@ -3,17 +3,17 @@ Anne Gentle Anthony Young Antony Messerli Armando Migliaccio -Brian Waldon Bilal Akhtar Brian Lamar -Brian Schott +Brian Schott +Brian Waldon Chiradeep Vittal Chmouel Boudjnah Chris Behrens Christian Berendt Cory Wright -David Pravec Dan Prince +David Pravec Dean Troyer Devin Carlen Ed Leafe @@ -44,7 +44,7 @@ Monsyne Dragon Monty Taylor MORITA Kazutaka Muneyuki Noguchi -Nachi Ueno +Nachi Ueno Naveed Massjouni Paul Voccio Ricardo Carrillo Cruz @@ -59,7 +59,7 @@ Soren Hansen Thierry Carrez Todd Willey Trey Morris -Tushar Patil +Tushar Patil Vasiliy Shlykov Vishvananda Ishaya Youcef Laribi From b7dff7ce29ba43e1d054f244af82d4115e1ba7e4 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Fri, 18 Feb 2011 10:24:55 +0100 Subject: [PATCH 48/49] Use WatchedFileHandler instead of RotatingFileHandler. --- nova/log.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/log.py b/nova/log.py index 87a6dd51b..6b201ffcc 100644 --- a/nova/log.py +++ b/nova/log.py @@ -94,7 +94,7 @@ critical = logging.critical log = logging.log # handlers StreamHandler = logging.StreamHandler -RotatingFileHandler = logging.handlers.RotatingFileHandler +WatchedFileHandler = logging.handlers.WatchedFileHandler # logging.SysLogHandler is nicer than logging.logging.handler.SysLogHandler. SysLogHandler = logging.handlers.SysLogHandler @@ -139,7 +139,7 @@ def basicConfig(): logging.root.addHandler(syslog) logpath = get_log_file_path() if logpath: - logfile = RotatingFileHandler(logpath) + logfile = WatchedFileHandler(logpath) logfile.setFormatter(_formatter) logging.root.addHandler(logfile)