From 6582517c4a48e134d2ed982d23c49d89560fb05a Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Mon, 4 Jun 2012 13:35:21 -0400 Subject: Prefix all nova binaries with 'nova-'. Fixes LP Bug #1008625. Change-Id: I2b0dc97133b3039818a52e0b8456dc31cdbd714e --- bin/clear_rabbit_queues | 76 --------------------------------------- bin/instance-usage-audit | 83 ------------------------------------------- bin/nova-clear-rabbit-queues | 76 +++++++++++++++++++++++++++++++++++++++ bin/nova-instance-usage-audit | 83 +++++++++++++++++++++++++++++++++++++++++++ bin/nova-volume-usage-audit | 82 ++++++++++++++++++++++++++++++++++++++++++ bin/volume-usage-audit | 82 ------------------------------------------ setup.py | 8 ++--- 7 files changed, 245 insertions(+), 245 deletions(-) delete mode 100755 bin/clear_rabbit_queues delete mode 100755 bin/instance-usage-audit create mode 100755 bin/nova-clear-rabbit-queues create mode 100755 bin/nova-instance-usage-audit create mode 100755 bin/nova-volume-usage-audit delete mode 100755 bin/volume-usage-audit diff --git a/bin/clear_rabbit_queues b/bin/clear_rabbit_queues deleted file mode 100755 index 578681790..000000000 --- a/bin/clear_rabbit_queues +++ /dev/null @@ -1,76 +0,0 @@ -#!/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. - -"""Admin/debug script to wipe rabbitMQ (AMQP) queues nova uses. - This can be used if you need to change durable options on queues, - or to wipe all messages in the queue system if things are in a - serious bad way. - -""" - -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 exception -from nova import flags -from nova import log as logging -from nova.openstack.common import cfg -from nova import rpc - - -delete_exchange_opt = cfg.BoolOpt('delete_exchange', - default=False, - help='delete nova exchange too.') - -FLAGS = flags.FLAGS -FLAGS.register_cli_opt(delete_exchange_opt) - - -def delete_exchange(exch): - conn = rpc.create_connection() - x = conn.get_channel() - x.exchange_delete(exch) - - -def delete_queues(queues): - conn = rpc.create_connection() - x = conn.get_channel() - for q in queues: - x.queue_delete(q) - -if __name__ == '__main__': - args = flags.parse_args(sys.argv) - logging.setup() - delete_queues(args[1:]) - if FLAGS.delete_exchange: - delete_exchange(FLAGS.control_exchange) diff --git a/bin/instance-usage-audit b/bin/instance-usage-audit deleted file mode 100755 index 3d60edfec..000000000 --- a/bin/instance-usage-audit +++ /dev/null @@ -1,83 +0,0 @@ -#!/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 existing - during the audit period. - - Together with the notifications generated by compute on instance - create/delete/resize, over that time period, this allows an external - system consuming usage notification feeds to calculate instance usage - for each tenant. - - Time periods are specified as 'hour', 'month', 'day' or 'year' - - hour = previous hour. If run at 9:07am, will generate usage for 8-9am. - month = previous month. If the script is run April 1, it will generate - usages for March 1 through March 31. - day = previous day. if run on July 4th, it generates usages for July 3rd. - year = previous year. If run on Jan 1, it generates usages for - Jan 1 through Dec 31 of the previous year. -""" - -import datetime -import gettext -import os -import sys -import time -import traceback - -# 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) -import nova.compute.utils -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 rpc -from nova import utils - - -FLAGS = flags.FLAGS - -if __name__ == '__main__': - admin_context = context.get_admin_context() - flags.parse_args(sys.argv) - logging.setup() - begin, end = utils.last_completed_audit_period() - print "Starting instance usage audit" - print "Creating usages for %s until %s" % (str(begin), str(end)) - instances = db.instance_get_active_by_window_joined(admin_context, - begin, - end) - print "Found %d instances" % len(instances) - for instance_ref in instances: - try: - nova.compute.utils.notify_usage_exists( - admin_context, instance_ref, - ignore_missing_network_data=False) - except Exception, e: - print traceback.format_exc(e) - print "Instance usage audit completed" diff --git a/bin/nova-clear-rabbit-queues b/bin/nova-clear-rabbit-queues new file mode 100755 index 000000000..578681790 --- /dev/null +++ b/bin/nova-clear-rabbit-queues @@ -0,0 +1,76 @@ +#!/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. + +"""Admin/debug script to wipe rabbitMQ (AMQP) queues nova uses. + This can be used if you need to change durable options on queues, + or to wipe all messages in the queue system if things are in a + serious bad way. + +""" + +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 exception +from nova import flags +from nova import log as logging +from nova.openstack.common import cfg +from nova import rpc + + +delete_exchange_opt = cfg.BoolOpt('delete_exchange', + default=False, + help='delete nova exchange too.') + +FLAGS = flags.FLAGS +FLAGS.register_cli_opt(delete_exchange_opt) + + +def delete_exchange(exch): + conn = rpc.create_connection() + x = conn.get_channel() + x.exchange_delete(exch) + + +def delete_queues(queues): + conn = rpc.create_connection() + x = conn.get_channel() + for q in queues: + x.queue_delete(q) + +if __name__ == '__main__': + args = flags.parse_args(sys.argv) + logging.setup() + delete_queues(args[1:]) + if FLAGS.delete_exchange: + delete_exchange(FLAGS.control_exchange) diff --git a/bin/nova-instance-usage-audit b/bin/nova-instance-usage-audit new file mode 100755 index 000000000..3d60edfec --- /dev/null +++ b/bin/nova-instance-usage-audit @@ -0,0 +1,83 @@ +#!/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 existing + during the audit period. + + Together with the notifications generated by compute on instance + create/delete/resize, over that time period, this allows an external + system consuming usage notification feeds to calculate instance usage + for each tenant. + + Time periods are specified as 'hour', 'month', 'day' or 'year' + + hour = previous hour. If run at 9:07am, will generate usage for 8-9am. + month = previous month. If the script is run April 1, it will generate + usages for March 1 through March 31. + day = previous day. if run on July 4th, it generates usages for July 3rd. + year = previous year. If run on Jan 1, it generates usages for + Jan 1 through Dec 31 of the previous year. +""" + +import datetime +import gettext +import os +import sys +import time +import traceback + +# 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) +import nova.compute.utils +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 rpc +from nova import utils + + +FLAGS = flags.FLAGS + +if __name__ == '__main__': + admin_context = context.get_admin_context() + flags.parse_args(sys.argv) + logging.setup() + begin, end = utils.last_completed_audit_period() + print "Starting instance usage audit" + print "Creating usages for %s until %s" % (str(begin), str(end)) + instances = db.instance_get_active_by_window_joined(admin_context, + begin, + end) + print "Found %d instances" % len(instances) + for instance_ref in instances: + try: + nova.compute.utils.notify_usage_exists( + admin_context, instance_ref, + ignore_missing_network_data=False) + except Exception, e: + print traceback.format_exc(e) + print "Instance usage audit completed" diff --git a/bin/nova-volume-usage-audit b/bin/nova-volume-usage-audit new file mode 100755 index 000000000..2c01da56f --- /dev/null +++ b/bin/nova-volume-usage-audit @@ -0,0 +1,82 @@ +#!/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 volumes existing during + the audit period. + + Together with the notifications generated by volumes + create/delete/resize, over that time period, this allows an external + system consuming usage notification feeds to calculate volume usage + for each tenant. + + Time periods are specified as 'hour', 'month', 'day' or 'year' + + hour = previous hour. If run at 9:07am, will generate usage for 8-9am. + month = previous month. If the script is run April 1, it will generate + usages for March 1 through March 31. + day = previous day. if run on July 4th, it generates usages for July 3rd. + year = previous year. If run on Jan 1, it generates usages for + Jan 1 through Dec 31 of the previous year. +""" + +import datetime +import gettext +import os +import sys +import time +import traceback + +# 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 rpc +from nova import utils +from nova.volume import utils as volume_utils + +FLAGS = flags.FLAGS + +if __name__ == '__main__': + admin_context = context.get_admin_context() + utils.default_cfgfile() + flags.FLAGS(sys.argv) + logging.setup() + begin, end = utils.last_completed_audit_period() + print "Starting volume usage audit" + print "Creating usages for %s until %s" % (str(begin), str(end)) + volumes = db.volume_get_active_by_window(admin_context, + begin, + end) + print "Found %d volumes" % len(volumes) + for volume_ref in volumes: + try: + volume_utils.notify_usage_exists( + admin_context, volume_ref) + except Exception, e: + print traceback.format_exc(e) + print "Volume usage audit completed" diff --git a/bin/volume-usage-audit b/bin/volume-usage-audit deleted file mode 100755 index 2c01da56f..000000000 --- a/bin/volume-usage-audit +++ /dev/null @@ -1,82 +0,0 @@ -#!/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 volumes existing during - the audit period. - - Together with the notifications generated by volumes - create/delete/resize, over that time period, this allows an external - system consuming usage notification feeds to calculate volume usage - for each tenant. - - Time periods are specified as 'hour', 'month', 'day' or 'year' - - hour = previous hour. If run at 9:07am, will generate usage for 8-9am. - month = previous month. If the script is run April 1, it will generate - usages for March 1 through March 31. - day = previous day. if run on July 4th, it generates usages for July 3rd. - year = previous year. If run on Jan 1, it generates usages for - Jan 1 through Dec 31 of the previous year. -""" - -import datetime -import gettext -import os -import sys -import time -import traceback - -# 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 rpc -from nova import utils -from nova.volume import utils as volume_utils - -FLAGS = flags.FLAGS - -if __name__ == '__main__': - admin_context = context.get_admin_context() - utils.default_cfgfile() - flags.FLAGS(sys.argv) - logging.setup() - begin, end = utils.last_completed_audit_period() - print "Starting volume usage audit" - print "Creating usages for %s until %s" % (str(begin), str(end)) - volumes = db.volume_get_active_by_window(admin_context, - begin, - end) - print "Found %d volumes" % len(volumes) - for volume_ref in volumes: - try: - volume_utils.notify_usage_exists( - admin_context, volume_ref) - except Exception, e: - print traceback.format_exc(e) - print "Volume usage audit completed" diff --git a/setup.py b/setup.py index 929223f25..f71312dfc 100644 --- a/setup.py +++ b/setup.py @@ -72,26 +72,26 @@ setuptools.setup(name='nova', packages=setuptools.find_packages(exclude=['bin', 'smoketests']), include_package_data=True, test_suite='nose.collector', - scripts=['bin/clear_rabbit_queues', - 'bin/instance-usage-audit', - 'bin/nova-all', + scripts=['bin/nova-all', 'bin/nova-api', 'bin/nova-api-ec2', 'bin/nova-api-metadata', 'bin/nova-api-os-compute', 'bin/nova-api-os-volume', 'bin/nova-cert', + 'bin/nova-clear-rabbit-queues', 'bin/nova-compute', 'bin/nova-console', 'bin/nova-consoleauth', 'bin/nova-dhcpbridge', + 'bin/nova-instance-usage-audit', 'bin/nova-manage', 'bin/nova-network', 'bin/nova-objectstore', 'bin/nova-rootwrap', 'bin/nova-scheduler', 'bin/nova-volume', + 'bin/nova-volume-usage-audit', 'bin/nova-xvpvncproxy', - 'bin/volume-usage-audit', ], py_modules=[]) -- cgit