From 093c8200a102891232e2da166830cd59ee133fc4 Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Mon, 14 Mar 2011 13:32:22 -0500 Subject: committing to share --- bin/nova-manage | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index b603c8b07..9dc0f4a62 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -505,7 +505,8 @@ 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, label='public'): + vpn_start=None, fixed_range_v6=None, label='public', + flat_network_bridge=None): """Creates fixed ips for host by range arguments: [fixed_range=FLAG], [num_networks=FLAG], [network_size=FLAG], [vlan_start=FLAG], @@ -522,6 +523,8 @@ class NetworkCommands(object): vpn_start = FLAGS.vpn_start if not fixed_range_v6: fixed_range_v6 = FLAGS.fixed_range_v6 + if not flat_network_bridge: + flat_network_bridge = FLAGS.flat_network_bridge net_manager = utils.import_object(FLAGS.network_manager) net_manager.create_networks(context.get_admin_context(), cidr=fixed_range, @@ -530,7 +533,8 @@ class NetworkCommands(object): vlan_start=int(vlan_start), vpn_start=int(vpn_start), cidr_v6=fixed_range_v6, - label=label) + label=label, + flat_network_bridge) def list(self): """List all created networks""" -- cgit From 57890776d0d7e9172b1fa056076ce28ae4b34b7b Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Mon, 14 Mar 2011 17:54:39 -0500 Subject: added migration to repo --- bin/nova-manage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index 9dc0f4a62..dd0f00c85 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -534,7 +534,7 @@ class NetworkCommands(object): vpn_start=int(vpn_start), cidr_v6=fixed_range_v6, label=label, - flat_network_bridge) + bridge=flat_network_bridge) def list(self): """List all created networks""" -- cgit From d4a2a5c34ce568b5d67841c55d3034e93a418507 Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Thu, 12 May 2011 16:37:35 -0500 Subject: updated previous calls referring to the flags to use the column from the networks table instead --- bin/nova-manage | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index e19d67c47..c0319fdac 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -517,11 +517,13 @@ 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, label='public', - flat_network_bridge=None): + flat_network_bridge=None, bridge_interface=None): """Creates fixed ips for host by range arguments: fixed_range=FLAG, [num_networks=FLAG], [network_size=FLAG], [vlan_start=FLAG], - [vpn_start=FLAG], [fixed_range_v6=FLAG]""" + [vpn_start=FLAG], [fixed_range_v6=FLAG], + [label='public'], [flat_network_bridge=FLAG, + [bridge_interface=FLAG]""" if not fixed_range: raise TypeError(_('Fixed range in the form of 10.0.0.0/8 is ' 'required to create networks.')) @@ -537,6 +539,8 @@ class NetworkCommands(object): fixed_range_v6 = FLAGS.fixed_range_v6 if not flat_network_bridge: flat_network_bridge = FLAGS.flat_network_bridge + if not bridge_interface: + bridge_interface = FLAGS.flat_interface or FLAGS.vlan_interface net_manager = utils.import_object(FLAGS.network_manager) net_manager.create_networks(context.get_admin_context(), cidr=fixed_range, @@ -546,7 +550,8 @@ class NetworkCommands(object): vpn_start=int(vpn_start), cidr_v6=fixed_range_v6, label=label, - bridge=flat_network_bridge) + bridge=flat_network_bridge, + bridge_interface=bridge_interface) def list(self): """List all created networks""" -- cgit From 7377b010a133d5afa1a20e36b3a1dd2914c461b2 Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Thu, 12 May 2011 18:26:46 -0500 Subject: fixed_ip disassociate now also unsets mac_address_id --- bin/nova-manage | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index c0319fdac..6c3561f71 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -171,17 +171,23 @@ class VpnCommands(object): def change(self, project_id, ip, port): """Change the ip and port for a vpn. + this will update all networks associated with a project + not sure if that's the desired behavior or not, patches accepted + args: project, ip, port""" + # TODO(tr3buchet): perhaps this shouldn't update all networks + # associated with a project in the future project = self.manager.get_project(project_id) if not project: print 'No project %s' % (project_id) return - admin = context.get_admin_context() - network_ref = db.project_get_network(admin, project_id) - db.network_update(admin, - network_ref['id'], - {'vpn_public_address': ip, - 'vpn_public_port': int(port)}) + admin_context = context.get_admin_context() + networks = db.project_get_networks(admin_context, project_id) + for network in networks: + db.network_update(admin_context, + network['id'], + {'vpn_public_address': ip, + 'vpn_public_port': int(port)}) class ShellCommands(object): @@ -413,12 +419,13 @@ class ProjectCommands(object): def scrub(self, project_id): """Deletes data associated with project arguments: project_id""" - ctxt = context.get_admin_context() - network_ref = db.project_get_network(ctxt, project_id) - db.network_disassociate(ctxt, network_ref['id']) - groups = db.security_group_get_by_project(ctxt, project_id) + admin_context = context.get_admin_context() + networks = db.project_get_networks(admin_context, project_id) + for network in networks: + db.network_disassociate(admin_context, network['id']) + groups = db.security_group_get_by_project(admin_context, project_id) for group in groups: - db.security_group_destroy(ctxt, group['id']) + db.security_group_destroy(admin_context, group['id']) def zipfile(self, project_id, user_id, filename='nova.zip'): """Exports credentials for project to a zip file -- cgit From 93d76ba4706d1093965bd0690de24ee819cef1a4 Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Mon, 16 May 2011 14:50:26 -0500 Subject: using mac_address from fixed_ip instead of instance --- bin/nova-manage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index 6c3561f71..8e2a49ef2 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -476,7 +476,7 @@ class FixedIpCommands(object): instance = fixed_ip['instance'] hostname = instance['hostname'] host = instance['host'] - mac_address = instance['mac_address'] + mac_address = fixed_ip['mac_address']['address'] print "%-18s\t%-15s\t%-17s\t%-15s\t%s" % ( fixed_ip['network']['cidr'], fixed_ip['address'], -- cgit From d7925b3890f651b3f6fd002a45b2add86e388d10 Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Wed, 8 Jun 2011 14:46:31 -0500 Subject: updated docstring for nova-manage network create --- bin/nova-manage | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index e7164b4d2..187db0c86 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -562,6 +562,9 @@ class NetworkCommands(object): [network_size=FLAG], [vlan_start=FLAG], [vpn_start=FLAG], [fixed_range_v6=FLAG], [gateway_v6=FLAG], [flat_network_bridge=FLAG], [bridge_interface=FLAG] + If you wish to use a later argument fill in the gaps with 0s + Ex: network create private 10.0.0.0/8 1 15 0 0 0 0 xenbr1 eth1 + network create private 10.0.0.0/8 1 15 """ if not label: msg = _('a label (ex: public) is required to create networks.') -- cgit From 878468db557b4498528d57804a1808388d7993ec Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Fri, 10 Jun 2011 16:55:27 -0500 Subject: floating ips can now move around the network hosts --- bin/nova-manage | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index 187db0c86..16b0cd1dd 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -518,13 +518,12 @@ class FixedIpCommands(object): class FloatingIpCommands(object): """Class for managing floating ip.""" - def create(self, host, range): - """Creates floating ips for host by range - arguments: host ip_range""" + def create(self, range): + """Creates floating ips for zone by range + arguments: ip_range""" for address in IPy.IP(range): db.floating_ip_create(context.get_admin_context(), - {'address': str(address), - 'host': host}) + {'address': str(address)}) def delete(self, ip_range): """Deletes floating ips by range @@ -535,7 +534,8 @@ class FloatingIpCommands(object): def list(self, host=None): """Lists all floating ips (optionally by host) - arguments: [host]""" + arguments: [host] + Note: if host is given, only active floating IPs are returned""" ctxt = context.get_admin_context() if host is None: floating_ips = db.floating_ip_get_all(ctxt) -- cgit From 843644aed6477b4411ec3f07d1a5271df41c9798 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Sat, 18 Jun 2011 23:10:41 -0400 Subject: General cleanup and refactor of a lot of the API/WSGI service code. --- bin/nova-api | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index a1088c23d..6db68be9c 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -24,6 +24,8 @@ import gettext import os import sys +import eventlet.pool + # If ../nova/__init__.py exists, add ../ to Python search path, so that # it will override what happens to be installed in /usr/(local/)lib/python... possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), @@ -46,6 +48,13 @@ LOG = logging.getLogger('nova.api') FLAGS = flags.FLAGS + +def launch(service_name): + _service = service.WSGIService(service_name) + _service.start() + _service.wait() + + if __name__ == '__main__': utils.default_flagfile() FLAGS(sys.argv) @@ -57,5 +66,10 @@ if __name__ == '__main__': flag_get = FLAGS.get(flag, None) LOG.debug("%(flag)s : %(flag_get)s" % locals()) - service = service.serve_wsgi(service.ApiService) - service.wait() + + pool = eventlet.pool.Pool() + pool.execute(launch, "ec2") + pool.execute(launch, "osapi") + pool.wait_all() + + print >>sys.stderr, "Exiting..." -- cgit From ea64f883b74fa3c702a3c47d4508a1e7a7f6b40d Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Sun, 19 Jun 2011 14:09:09 -0400 Subject: Removed debugging, made objectstore tests pass again. --- bin/nova-api | 3 --- 1 file changed, 3 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 6db68be9c..90c8b69ad 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -66,10 +66,7 @@ if __name__ == '__main__': flag_get = FLAGS.get(flag, None) LOG.debug("%(flag)s : %(flag_get)s" % locals()) - pool = eventlet.pool.Pool() pool.execute(launch, "ec2") pool.execute(launch, "osapi") pool.wait_all() - - print >>sys.stderr, "Exiting..." -- cgit From 95213244fe341b7ec2723b92a5b793e89ee8403f Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Sun, 19 Jun 2011 14:41:42 -0400 Subject: Cleaned up nova-api binary and logging a bit. --- bin/nova-api | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 90c8b69ad..7d80b0b78 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -20,33 +20,20 @@ """Starter script for Nova API.""" -import gettext -import os import sys import eventlet.pool -# If ../nova/__init__.py exists, add ../ to Python search path, so that -# it will override what happens to be installed in /usr/(local/)lib/python... -possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), - os.pardir, - os.pardir)) -if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): - sys.path.insert(0, possible_topdir) - -gettext.install('nova', unicode=1) - from nova import flags from nova import log as logging from nova import service from nova import utils from nova import version -from nova import wsgi -LOG = logging.getLogger('nova.api') - +LOG = logging.getLogger("nova.api") FLAGS = flags.FLAGS +VERSION = version.version_string_with_vcs() def launch(service_name): @@ -55,18 +42,17 @@ def launch(service_name): _service.wait() -if __name__ == '__main__': +def main(): utils.default_flagfile() FLAGS(sys.argv) - logging.setup() - LOG.audit(_("Starting nova-api node (version %s)"), - version.version_string_with_vcs()) - LOG.debug(_("Full set of FLAGS:")) - for flag in FLAGS: - flag_get = FLAGS.get(flag, None) - LOG.debug("%(flag)s : %(flag_get)s" % locals()) +# logging.setup() + LOG.audit(_("Starting nova-api node (version %s)") % VERSION) pool = eventlet.pool.Pool() pool.execute(launch, "ec2") pool.execute(launch, "osapi") pool.wait_all() + + +if __name__ == '__main__': + sys.exit(main()) -- cgit From 1e047dae71131a0080310990dc6899852d233941 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Sun, 19 Jun 2011 16:27:46 -0400 Subject: Further nova-api cleanup. --- bin/nova-api | 63 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 26 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 7d80b0b78..ff4aa83d1 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -1,7 +1,5 @@ #!/usr/bin/env python -# pylint: disable=C0103 -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - +# # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. @@ -18,40 +16,53 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Starter script for Nova API.""" +"""Starter script for Nova API. -import sys +Starts both the EC2 and OpenStack APIs in separate processes. Pylint warnings +about re-imports should be ignored. -import eventlet.pool +""" -from nova import flags -from nova import log as logging -from nova import service -from nova import utils -from nova import version +# pylint: disable=W0404 +import sys +import multiprocessing -LOG = logging.getLogger("nova.api") -FLAGS = flags.FLAGS -VERSION = version.version_string_with_vcs() +import nova.flags +import nova.log +import nova.service +import nova.version +import nova.utils def launch(service_name): - _service = service.WSGIService(service_name) - _service.start() - _service.wait() + """Launch WSGI service with name matching 'paste' config file section.""" + service = nova.service.WSGIService(service_name) + service.start() + try: + service.wait() + except KeyboardInterrupt: + service.stop() def main(): - utils.default_flagfile() - FLAGS(sys.argv) -# logging.setup() - LOG.audit(_("Starting nova-api node (version %s)") % VERSION) - - pool = eventlet.pool.Pool() - pool.execute(launch, "ec2") - pool.execute(launch, "osapi") - pool.wait_all() + """Begin process of launching both EC2 and OSAPI services.""" + version = nova.version.version_string_with_vcs() + logger = nova.log.getLogger("nova.api") + logger.audit(_("Starting nova-api node (version %s)") % version) + + nova.flags.FLAGS(sys.argv) + nova.utils.default_flagfile() + + pool = multiprocessing.Pool(2) + pool.map_async(launch, ["ec2", "osapi"]) + pool.close() + + try: + pool.join() + except KeyboardInterrupt: + logger.audit(_("Exiting...")) + pool.terminate() if __name__ == '__main__': -- cgit From 79402ffbaeae18bb4adaa899743a688ef0bcb24b Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Sun, 19 Jun 2011 18:00:38 -0400 Subject: Cleanup of the cleanup. --- bin/nova-api | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index ff4aa83d1..1fcda24f4 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -1,4 +1,5 @@ #!/usr/bin/env python +# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. @@ -18,13 +19,10 @@ """Starter script for Nova API. -Starts both the EC2 and OpenStack APIs in separate processes. Pylint warnings -about re-imports should be ignored. +Starts both the EC2 and OpenStack APIs in separate processes. """ -# pylint: disable=W0404 - import sys import multiprocessing -- cgit From 927aecb0a3ff1fe561b3c96a4fb9b18c8893c3ae Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Sun, 19 Jun 2011 20:18:29 -0400 Subject: Introduced Loader concept, for paste decouple. --- bin/nova-api | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 1fcda24f4..885fb0ba4 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -51,6 +51,8 @@ def main(): nova.flags.FLAGS(sys.argv) nova.utils.default_flagfile() + +# launch("osapi") pool = multiprocessing.Pool(2) pool.map_async(launch, ["ec2", "osapi"]) -- cgit From dd870291a32d18d0f62592a73a03b9038ae5c3da Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Mon, 20 Jun 2011 10:12:43 -0400 Subject: Cleanup and addition of tests for WSGI server. --- bin/nova-api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 885fb0ba4..89112a159 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -1,6 +1,6 @@ #!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# + # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. -- cgit From c178b3ce44d89b662c5925b7b65aab9c2540cf37 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Mon, 20 Jun 2011 14:54:53 -0400 Subject: pep8 fixes --- bin/nova-api | 2 -- 1 file changed, 2 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 89112a159..2345b3f2c 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -51,8 +51,6 @@ def main(): nova.flags.FLAGS(sys.argv) nova.utils.default_flagfile() - -# launch("osapi") pool = multiprocessing.Pool(2) pool.map_async(launch, ["ec2", "osapi"]) -- cgit From e849aa7112dcf24357d46f39195cfefce828a91a Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Mon, 20 Jun 2011 19:32:18 -0400 Subject: Removed logging logic from __init__, added concept of Launcher...no tests for it yet. --- bin/nova-api | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 2345b3f2c..563d7c090 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -24,44 +24,26 @@ Starts both the EC2 and OpenStack APIs in separate processes. """ import sys -import multiprocessing -import nova.flags import nova.log import nova.service import nova.version -import nova.utils - - -def launch(service_name): - """Launch WSGI service with name matching 'paste' config file section.""" - service = nova.service.WSGIService(service_name) - service.start() - try: - service.wait() - except KeyboardInterrupt: - service.stop() def main(): - """Begin process of launching both EC2 and OSAPI services.""" - version = nova.version.version_string_with_vcs() - logger = nova.log.getLogger("nova.api") - logger.audit(_("Starting nova-api node (version %s)") % version) - - nova.flags.FLAGS(sys.argv) - nova.utils.default_flagfile() - - pool = multiprocessing.Pool(2) - pool.map_async(launch, ["ec2", "osapi"]) - pool.close() - + """Launch EC2 and OSAPI services.""" + ec2 = nova.service.WSGIService("ec2") + osapi = nova.service.WSGIService("osapi") + + launcher = nova.service.Launcher(sys.argv) + launcher.launch_service(ec2) + launcher.launch_service(osapi) + try: - pool.join() + launcher.wait() except KeyboardInterrupt: - logger.audit(_("Exiting...")) - pool.terminate() - + launcher.stop() + if __name__ == '__main__': sys.exit(main()) -- cgit From c17c73b3d0f07046c677711853e1b93768526e47 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Tue, 21 Jun 2011 00:21:33 -0400 Subject: Tests for WSGI/Launcher --- bin/nova-api | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 563d7c090..20ad4bfa5 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -38,12 +38,12 @@ def main(): launcher = nova.service.Launcher(sys.argv) launcher.launch_service(ec2) launcher.launch_service(osapi) - + try: launcher.wait() except KeyboardInterrupt: launcher.stop() - + if __name__ == '__main__': sys.exit(main()) -- cgit From e821b96feb49492c7b20afaa7ae0be5143dd4879 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Tue, 21 Jun 2011 00:32:31 -0400 Subject: Removed unneeded import. --- bin/nova-api | 1 - 1 file changed, 1 deletion(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 20ad4bfa5..b94928c7b 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -27,7 +27,6 @@ import sys import nova.log import nova.service -import nova.version def main(): -- cgit From 742c21e4e79ce5a26975b31486ded3956a846c55 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Tue, 21 Jun 2011 11:25:44 -0400 Subject: Very small alterations, switched from using start() to pass host/port, to just defining them up front in init. Doesn't make sense to set them in start because we can't start more than once any way. Also, unbroke binaries. --- bin/nova-ajax-console-proxy | 5 +++-- bin/nova-direct-api | 7 +++++-- bin/nova-objectstore | 7 +++++-- bin/nova-vncproxy | 7 +++++-- 4 files changed, 18 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/nova-ajax-console-proxy b/bin/nova-ajax-console-proxy index d88f59e40..21cf68007 100755 --- a/bin/nova-ajax-console-proxy +++ b/bin/nova-ajax-console-proxy @@ -137,8 +137,9 @@ if __name__ == '__main__': utils.default_flagfile() FLAGS(sys.argv) logging.setup() - server = wsgi.Server() + acp_port = FLAGS.ajax_console_proxy_port acp = AjaxConsoleProxy() acp.register_listeners() - server.start(acp, FLAGS.ajax_console_proxy_port, host='0.0.0.0') + server = wsgi.Server("AJAX Console Proxy", acp, port=acp_port) + server.start() server.wait() diff --git a/bin/nova-direct-api b/bin/nova-direct-api index 83ec72722..5d63eb87f 100755 --- a/bin/nova-direct-api +++ b/bin/nova-direct-api @@ -93,6 +93,9 @@ if __name__ == '__main__': with_req = direct.PostParamsMiddleware(with_json) with_auth = direct.DelegatedAuthMiddleware(with_req) - server = wsgi.Server() - server.start(with_auth, FLAGS.direct_port, host=FLAGS.direct_host) + server = wsgi.Server("Direct API", + with_auth, + host=FLAGS.direct_host, + port=FLAGS.direct_port) + server.start() server.wait() diff --git a/bin/nova-objectstore b/bin/nova-objectstore index 6ef841b85..aa0dc063f 100755 --- a/bin/nova-objectstore +++ b/bin/nova-objectstore @@ -50,6 +50,9 @@ if __name__ == '__main__': FLAGS(sys.argv) logging.setup() router = s3server.S3Application(FLAGS.buckets_path) - server = wsgi.Server() - server.start(router, FLAGS.s3_port, host=FLAGS.s3_host) + server = wsgi.Server("S3 Objectstore", + router, + port=FLAGS.s3_port, + host=FLAGS.s3_host) + server.start() server.wait() diff --git a/bin/nova-vncproxy b/bin/nova-vncproxy index ccb97e3a3..62d3b948c 100755 --- a/bin/nova-vncproxy +++ b/bin/nova-vncproxy @@ -96,6 +96,9 @@ if __name__ == "__main__": service.serve() - server = wsgi.Server() - server.start(with_auth, FLAGS.vncproxy_port, host=FLAGS.vncproxy_host) + server = wsgi.Server("VNC Proxy", + with_auth, + host=FLAGS.vncproxy_host, + port=FLAGS.vncproxy_port) + server.start() server.wait() -- cgit From 186598a819c4e9c4b1b76aad61e7df56cdddd5be Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Tue, 21 Jun 2011 12:03:27 -0400 Subject: Removed whitespace. --- bin/nova-direct-api | 4 ++-- bin/nova-objectstore | 6 +++--- bin/nova-vncproxy | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'bin') diff --git a/bin/nova-direct-api b/bin/nova-direct-api index 5d63eb87f..c6cf9b2ff 100755 --- a/bin/nova-direct-api +++ b/bin/nova-direct-api @@ -93,8 +93,8 @@ if __name__ == '__main__': with_req = direct.PostParamsMiddleware(with_json) with_auth = direct.DelegatedAuthMiddleware(with_req) - server = wsgi.Server("Direct API", - with_auth, + server = wsgi.Server("Direct API", + with_auth, host=FLAGS.direct_host, port=FLAGS.direct_port) server.start() diff --git a/bin/nova-objectstore b/bin/nova-objectstore index aa0dc063f..1aef3a255 100755 --- a/bin/nova-objectstore +++ b/bin/nova-objectstore @@ -50,9 +50,9 @@ if __name__ == '__main__': FLAGS(sys.argv) logging.setup() router = s3server.S3Application(FLAGS.buckets_path) - server = wsgi.Server("S3 Objectstore", - router, - port=FLAGS.s3_port, + server = wsgi.Server("S3 Objectstore", + router, + port=FLAGS.s3_port, host=FLAGS.s3_host) server.start() server.wait() diff --git a/bin/nova-vncproxy b/bin/nova-vncproxy index 62d3b948c..72271df3a 100755 --- a/bin/nova-vncproxy +++ b/bin/nova-vncproxy @@ -96,7 +96,7 @@ if __name__ == "__main__": service.serve() - server = wsgi.Server("VNC Proxy", + server = wsgi.Server("VNC Proxy", with_auth, host=FLAGS.vncproxy_host, port=FLAGS.vncproxy_port) -- cgit From 51c20f6f85d76bc14f394221a8836d2aac9a1aea Mon Sep 17 00:00:00 2001 From: Jimmy Bergman Date: Wed, 22 Jun 2011 12:01:18 +0200 Subject: Add a socket server responding with an allowing flash socket policy for all requests from flash on port 843 to nova-vncproxy --- bin/nova-vncproxy | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/nova-vncproxy b/bin/nova-vncproxy index ccb97e3a3..467d1eba3 100755 --- a/bin/nova-vncproxy +++ b/bin/nova-vncproxy @@ -39,6 +39,8 @@ from nova import wsgi from nova import version from nova.vnc import auth from nova.vnc import proxy +from twisted.internet import protocol, reactor +from twisted.protocols import basic LOG = logging.getLogger('nova.vnc-proxy') @@ -62,6 +64,16 @@ flags.DEFINE_flag(flags.HelpFlag()) flags.DEFINE_flag(flags.HelpshortFlag()) flags.DEFINE_flag(flags.HelpXMLFlag()) +class FlashSocketPolicyProtocol(basic.LineReceiver): + delimiter = "\0" + + def lineReceived(self, request): + if '' in request: + self.transport.write('' % (FLAGS.vncproxy_port)) + self.transport.loseConnection() + +class FlashSocketPolicyFactory(protocol.ServerFactory): + protocol = FlashSocketPolicyProtocol if __name__ == "__main__": utils.default_flagfile() @@ -96,6 +108,11 @@ if __name__ == "__main__": service.serve() - server = wsgi.Server() - server.start(with_auth, FLAGS.vncproxy_port, host=FLAGS.vncproxy_host) - server.wait() + flash_socket_policy_pid = os.fork() + if flash_socket_policy_pid == 0: + reactor.listenTCP(843, FlashSocketPolicyFactory()) + reactor.run() + else: + server = wsgi.Server() + server.start(with_auth, FLAGS.vncproxy_port, host=FLAGS.vncproxy_host) + server.wait() -- cgit From 2059a683e11169a35b35819575926fc6cbc1a3f1 Mon Sep 17 00:00:00 2001 From: Mark Washenberger Date: Wed, 22 Jun 2011 23:27:49 -0400 Subject: run launcher first since it initializes global flags and logging --- bin/nova-api | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index b94928c7b..121f6f9a0 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -31,10 +31,11 @@ import nova.service def main(): """Launch EC2 and OSAPI services.""" + launcher = nova.service.Launcher(sys.argv) + ec2 = nova.service.WSGIService("ec2") osapi = nova.service.WSGIService("osapi") - launcher = nova.service.Launcher(sys.argv) launcher.launch_service(ec2) launcher.launch_service(osapi) -- cgit From 3d1c8463d80932ddbe677ea1b8aee357642018a8 Mon Sep 17 00:00:00 2001 From: Jimmy Bergman Date: Thu, 23 Jun 2011 13:34:01 +0200 Subject: Change so that the flash socket policy server is using eventlet instead of twisted and is running in the same process as the main vnx proxy --- bin/nova-vncproxy | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'bin') diff --git a/bin/nova-vncproxy b/bin/nova-vncproxy index 467d1eba3..60e01e7f8 100755 --- a/bin/nova-vncproxy +++ b/bin/nova-vncproxy @@ -39,8 +39,6 @@ from nova import wsgi from nova import version from nova.vnc import auth from nova.vnc import proxy -from twisted.internet import protocol, reactor -from twisted.protocols import basic LOG = logging.getLogger('nova.vnc-proxy') @@ -64,16 +62,16 @@ flags.DEFINE_flag(flags.HelpFlag()) flags.DEFINE_flag(flags.HelpshortFlag()) flags.DEFINE_flag(flags.HelpXMLFlag()) -class FlashSocketPolicyProtocol(basic.LineReceiver): - delimiter = "\0" +def handle_flash_socket_policy(socket): + LOG.info(_("Received connection on flash socket policy port")) - def lineReceived(self, request): - if '' in request: - self.transport.write('' % (FLAGS.vncproxy_port)) - self.transport.loseConnection() - -class FlashSocketPolicyFactory(protocol.ServerFactory): - protocol = FlashSocketPolicyProtocol + fd = socket.makefile('rw') + expected_command = "" + if expected_command in fd.read(len(expected_command)+1): + LOG.info(_("Received valid flash socket policy request")) + fd.write('' % (FLAGS.vncproxy_port)) + fd.flush() + socket.close() if __name__ == "__main__": utils.default_flagfile() @@ -108,11 +106,7 @@ if __name__ == "__main__": service.serve() - flash_socket_policy_pid = os.fork() - if flash_socket_policy_pid == 0: - reactor.listenTCP(843, FlashSocketPolicyFactory()) - reactor.run() - else: - server = wsgi.Server() - server.start(with_auth, FLAGS.vncproxy_port, host=FLAGS.vncproxy_host) - server.wait() + server = wsgi.Server() + server.start(with_auth, FLAGS.vncproxy_port, host=FLAGS.vncproxy_host) + server.start_tcp(handle_flash_socket_policy, 843, host=FLAGS.vncproxy_host) + server.wait() -- cgit From 655a783d5a0ef2ddadcf119793cd34513a45fe27 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Thu, 23 Jun 2011 21:31:00 -0400 Subject: Created Bootstrapper to handle Nova bootstrapping logic. --- bin/nova-api | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 121f6f9a0..ea99a1b48 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -25,17 +25,18 @@ Starts both the EC2 and OpenStack APIs in separate processes. import sys -import nova.log import nova.service +import nova.utils def main(): """Launch EC2 and OSAPI services.""" - launcher = nova.service.Launcher(sys.argv) + nova.utils.Bootstrapper.bootstrap_binary(sys.argv) ec2 = nova.service.WSGIService("ec2") osapi = nova.service.WSGIService("osapi") + launcher = nova.service.Launcher() launcher.launch_service(ec2) launcher.launch_service(osapi) -- cgit From b699b9abd235eb611bc1d59b923f1ed83f96cfff Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Mon, 27 Jun 2011 17:07:21 -0500 Subject: removed unneded mac parameter to lease and release fixed ip functions --- bin/nova-dhcpbridge | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'bin') diff --git a/bin/nova-dhcpbridge b/bin/nova-dhcpbridge index 5926b97de..6d9d85896 100755 --- a/bin/nova-dhcpbridge +++ b/bin/nova-dhcpbridge @@ -59,14 +59,12 @@ def add_lease(mac, ip_address, _hostname, _interface): LOG.debug(_("leasing ip")) network_manager = utils.import_object(FLAGS.network_manager) network_manager.lease_fixed_ip(context.get_admin_context(), - mac, ip_address) else: rpc.cast(context.get_admin_context(), "%s.%s" % (FLAGS.network_topic, FLAGS.host), {"method": "lease_fixed_ip", - "args": {"mac": mac, - "address": ip_address}}) + "args": {"address": ip_address}}) def old_lease(mac, ip_address, hostname, interface): @@ -81,14 +79,12 @@ def del_lease(mac, ip_address, _hostname, _interface): LOG.debug(_("releasing ip")) network_manager = utils.import_object(FLAGS.network_manager) network_manager.release_fixed_ip(context.get_admin_context(), - mac, ip_address) else: rpc.cast(context.get_admin_context(), "%s.%s" % (FLAGS.network_topic, FLAGS.host), {"method": "release_fixed_ip", - "args": {"mac": mac, - "address": ip_address}}) + "args": {"address": ip_address}}) def init_leases(interface): -- cgit From 4b8bcf30f934ea91290b7fe41536ba06ee832b3f Mon Sep 17 00:00:00 2001 From: Monsyne Dragon Date: Tue, 28 Jun 2011 08:57:05 +0000 Subject: Re-merging code for generating system-usages to get around bzr merge braindeadness. --- bin/instance-usage-audit | 127 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100755 bin/instance-usage-audit (limited to 'bin') diff --git a/bin/instance-usage-audit b/bin/instance-usage-audit new file mode 100755 index 000000000..1124cf550 --- /dev/null +++ b/bin/instance-usage-audit @@ -0,0 +1,127 @@ +#!/usr/bin/env python +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright (c) 2011 Openstack, LLC. +# All Rights Reserved. +# +# 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. + +"""Cron script to generate usage notifications for instances neither created + nor destroyed in a given time period. + + Together with the notifications generated by compute on instance + create/delete/resize, over that ime period, this allows an external + system consuming usage notification feeds to calculate instance usage + for each tenant. + + Time periods are specified like so: + [mdy] + + 1m = previous month. If the script is run April 1, it will generate usages + for March 1 thry March 31. + 3m = 3 previous months. + 90d = previous 90 days. + 1y = previous year. If run on Jan 1, it generates usages for + Jan 1 thru Dec 31 of the previous year. +""" + +import datetime +import gettext +import os +import sys +import time + +# If ../nova/__init__.py exists, add ../ to Python search path, so that +# it will override what happens to be installed in /usr/(local/)lib/python... +POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), + os.pardir, + os.pardir)) +if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')): + sys.path.insert(0, POSSIBLE_TOPDIR) + +gettext.install('nova', unicode=1) + + +from nova import context +from nova import db +from nova import exception +from nova import flags +from nova import log as logging +from nova import utils + +from nova.notifier import api as notifier_api + +FLAGS = flags.FLAGS +flags.DEFINE_string('instance_usage_audit_period', '1m', + 'time period to generate instance usages for.') + +def time_period(period): + today = datetime.date.today() + unit = period[-1] + if unit not in 'mdy': + raise ValueError('Time period must be m, d, or y') + n = int(period[:-1]) + if unit == 'm': + year = today.year - (n//12) + n = n % 12 + if n >= today.month: + year -= 1 + month = 12 + (today.month - n) + else: + month = today.month - n + begin = datetime.datetime(day=1, month=month, year=year) + end = datetime.datetime(day=1, month=today.month, year=today.year) + + elif unit == 'y': + begin = datetime.datetime(day=1, month=1, year=today.year - n) + end = datetime.datetime(day=1, month=1, year=today.year) + + elif unit == 'd': + b = today - datetime.timedelta(days=n) + begin = datetime.datetime(day=b.day, month=b.month, year=b.year) + end = datetime.datetime(day=today.day, + month=today.month, + year=today.year) + + return (begin, end) + +if __name__ == '__main__': + utils.default_flagfile() + flags.FLAGS(sys.argv) + logging.setup() + begin, end = time_period(FLAGS.instance_usage_audit_period) + print "Creating usages for %s until %s" % (str(begin), str(end)) + instances = db.instance_get_active_by_window(context.get_admin_context(), + begin, + end) + print "%s instances" % len(instances) + for instance_ref in instances: + usage_info = dict( + tenant_id=instance_ref['project_id'], + user_id=instance_ref['user_id'], + instance_id=instance_ref['id'], + instance_type=instance_ref['instance_type']['name'], + instance_type_id=instance_ref['instance_type_id'], + display_name=instance_ref['display_name'], + created_at=str(instance_ref['created_at']), + launched_at=str(instance_ref['launched_at']) \ + if instance_ref['launched_at'] else '', + image_id=instance_ref['image_id'], + audit_period_begining=str(begin), + audit_period_ending=str(end)) + notifier_api.notify('compute.%s' % FLAGS.host, + 'compute.instance.exists', + notifier_api.INFO, + usage_info) + + -- cgit From e2c66d0e96467d510d01a5c5f60a56e8252dce5b Mon Sep 17 00:00:00 2001 From: Monsyne Dragon Date: Tue, 28 Jun 2011 09:08:35 +0000 Subject: Fix pep8 nits in audit script --- bin/instance-usage-audit | 53 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'bin') diff --git a/bin/instance-usage-audit b/bin/instance-usage-audit index 1124cf550..cef9b464b 100755 --- a/bin/instance-usage-audit +++ b/bin/instance-usage-audit @@ -17,22 +17,22 @@ # under the License. """Cron script to generate usage notifications for instances neither created - nor destroyed in a given time period. - + nor destroyed in a given time period. + Together with the notifications generated by compute on instance - create/delete/resize, over that ime period, this allows an external - system consuming usage notification feeds to calculate instance usage + create/delete/resize, over that ime period, this allows an external + system consuming usage notification feeds to calculate instance usage for each tenant. Time periods are specified like so: - [mdy] + [mdy] 1m = previous month. If the script is run April 1, it will generate usages for March 1 thry March 31. 3m = 3 previous months. - 90d = previous 90 days. - 1y = previous year. If run on Jan 1, it generates usages for - Jan 1 thru Dec 31 of the previous year. + 90d = previous 90 days. + 1y = previous year. If run on Jan 1, it generates usages for + Jan 1 thru Dec 31 of the previous year. """ import datetime @@ -65,6 +65,7 @@ FLAGS = flags.FLAGS flags.DEFINE_string('instance_usage_audit_period', '1m', 'time period to generate instance usages for.') + def time_period(period): today = datetime.date.today() unit = period[-1] @@ -72,27 +73,27 @@ def time_period(period): raise ValueError('Time period must be m, d, or y') n = int(period[:-1]) if unit == 'm': - year = today.year - (n//12) - n = n % 12 - if n >= today.month: - year -= 1 - month = 12 + (today.month - n) - else: - month = today.month - n - begin = datetime.datetime(day=1, month=month, year=year) - end = datetime.datetime(day=1, month=today.month, year=today.year) + year = today.year - (n // 12) + n = n % 12 + if n >= today.month: + year -= 1 + month = 12 + (today.month - n) + else: + month = today.month - n + begin = datetime.datetime(day=1, month=month, year=year) + end = datetime.datetime(day=1, month=today.month, year=today.year) elif unit == 'y': - begin = datetime.datetime(day=1, month=1, year=today.year - n) - end = datetime.datetime(day=1, month=1, year=today.year) - + begin = datetime.datetime(day=1, month=1, year=today.year - n) + end = datetime.datetime(day=1, month=1, year=today.year) + elif unit == 'd': - b = today - datetime.timedelta(days=n) - begin = datetime.datetime(day=b.day, month=b.month, year=b.year) - end = datetime.datetime(day=today.day, - month=today.month, + b = today - datetime.timedelta(days=n) + begin = datetime.datetime(day=b.day, month=b.month, year=b.year) + end = datetime.datetime(day=today.day, + month=today.month, year=today.year) - + return (begin, end) if __name__ == '__main__': @@ -123,5 +124,3 @@ if __name__ == '__main__': 'compute.instance.exists', notifier_api.INFO, usage_info) - - -- cgit From 4c1d05d27f207e71546f20c4e603839afc232b5a Mon Sep 17 00:00:00 2001 From: Monsyne Dragon Date: Tue, 28 Jun 2011 15:21:08 +0000 Subject: Fix issues due to renming of imange_id attrib. --- bin/instance-usage-audit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/instance-usage-audit b/bin/instance-usage-audit index cef9b464b..1fa2c2186 100755 --- a/bin/instance-usage-audit +++ b/bin/instance-usage-audit @@ -117,7 +117,7 @@ if __name__ == '__main__': created_at=str(instance_ref['created_at']), launched_at=str(instance_ref['launched_at']) \ if instance_ref['launched_at'] else '', - image_id=instance_ref['image_id'], + image_ref=instance_ref['image_ref'], audit_period_begining=str(begin), audit_period_ending=str(end)) notifier_api.notify('compute.%s' % FLAGS.host, -- cgit From 498f2d671573fc19d551516f7ead5da8d052ee18 Mon Sep 17 00:00:00 2001 From: Monsyne Dragon Date: Tue, 28 Jun 2011 20:37:05 +0000 Subject: Refactored usage generation --- bin/instance-usage-audit | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'bin') diff --git a/bin/instance-usage-audit b/bin/instance-usage-audit index 1fa2c2186..a06c6b1b3 100755 --- a/bin/instance-usage-audit +++ b/bin/instance-usage-audit @@ -107,19 +107,9 @@ if __name__ == '__main__': end) print "%s instances" % len(instances) for instance_ref in instances: - usage_info = dict( - tenant_id=instance_ref['project_id'], - user_id=instance_ref['user_id'], - instance_id=instance_ref['id'], - instance_type=instance_ref['instance_type']['name'], - instance_type_id=instance_ref['instance_type_id'], - display_name=instance_ref['display_name'], - created_at=str(instance_ref['created_at']), - launched_at=str(instance_ref['launched_at']) \ - if instance_ref['launched_at'] else '', - image_ref=instance_ref['image_ref'], - audit_period_begining=str(begin), - audit_period_ending=str(end)) + usage_info = utils.usage_from_instance(instance_ref, + audit_period_begining=str(begin), + audit_period_ending=str(end)) notifier_api.notify('compute.%s' % FLAGS.host, 'compute.instance.exists', notifier_api.INFO, -- cgit From 834b1741b4cd5e42393a8947a5c1fea80c625ee2 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Tue, 28 Jun 2011 17:26:08 -0500 Subject: Use milestone cut. --- bin/nova-api | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index ea99a1b48..fff67251f 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -23,8 +23,14 @@ Starts both the EC2 and OpenStack APIs in separate processes. """ +import os import sys +possible_topdir = os.path.normpath(os.path.join(os.path.abspath( + sys.argv[0]), os.pardir, os.pardir)) +if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")): + sys.path.insert(0, possible_topdir) + import nova.service import nova.utils -- cgit From fc40fa75a59d253859a559d1b8c336ebe7864b69 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Wed, 29 Jun 2011 16:45:46 +0200 Subject: Fix nova-manage vm list --- bin/nova-manage | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index 02f20347d..d5390b636 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -617,7 +617,7 @@ class VmCommands(object): :param host: show all instance on specified host. :param instance: show specificed instance. """ - print "%-10s %-15s %-10s %-10s %-19s %-12s %-12s %-12s" \ + print "%-10s %-15s %-10s %-10s %-26s %-9s %-9s %-9s" \ " %-10s %-10s %-10s %-5s" % ( _('instance'), _('node'), @@ -639,14 +639,14 @@ class VmCommands(object): context.get_admin_context(), host) for instance in instances: - print "%-10s %-15s %-10s %-10s %-19s %-12s %-12s %-12s" \ + print "%-10s %-15s %-10s %-10s %-26s %-9s %-9s %-9s" \ " %-10s %-10s %-10s %-5d" % ( instance['hostname'], instance['host'], - instance['instance_type'], + instance['instance_type'].name, instance['state_description'], instance['launched_at'], - instance['image_id'], + instance['image_ref'], instance['kernel_id'], instance['ramdisk_id'], instance['project_id'], -- cgit From 698bb2e090988723e58f67b92bb38a9f7f2e49e1 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Wed, 29 Jun 2011 16:52:55 +0200 Subject: Fix 'undefined name 'e'' pylint error --- bin/nova-manage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index d5390b636..51e0c32c9 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -878,7 +878,7 @@ class InstanceTypeCommands(object): try: instance_types.create(name, memory, vcpus, local_gb, flavorid, swap, rxtx_quota, rxtx_cap) - except exception.InvalidInput: + except exception.InvalidInput, e: print "Must supply valid parameters to create instance_type" print e sys.exit(1) -- cgit From efb5363356b13c3492ae895a1778428d06e6ca9c Mon Sep 17 00:00:00 2001 From: Jimmy Bergman Date: Thu, 7 Jul 2011 08:10:45 +0200 Subject: pep8 compliance --- bin/nova-vncproxy | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/nova-vncproxy b/bin/nova-vncproxy index 5d3dbf610..bdbb30a7f 100755 --- a/bin/nova-vncproxy +++ b/bin/nova-vncproxy @@ -62,14 +62,17 @@ flags.DEFINE_flag(flags.HelpFlag()) flags.DEFINE_flag(flags.HelpshortFlag()) flags.DEFINE_flag(flags.HelpXMLFlag()) + def handle_flash_socket_policy(socket): LOG.info(_("Received connection on flash socket policy port")) fd = socket.makefile('rw') expected_command = "" - if expected_command in fd.read(len(expected_command)+1): - LOG.info(_("Received valid flash socket policy request")) - fd.write('' % (FLAGS.vncproxy_port)) + if expected_command in fd.read(len(expected_command) + 1): + LOG.info(_("Received valid flash socket policy request")) + fd.write('' % (FLAGS.vncproxy_port)) fd.flush() socket.close() -- cgit