diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-04-30 18:54:52 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-04-30 18:54:52 +0000 |
| commit | 1c127f79c3331bc74b0b74c4eade87be695a8828 (patch) | |
| tree | b2ccdb1f34efbcf3c4c86027b400338cfb2ec26c /bin/instance-usage-audit | |
| parent | 8fe6eda0b0d240f600f4c066d9cc3a136edffe34 (diff) | |
| parent | 8577aeb12819fe188a3a2773f9610e07b5683df0 (diff) | |
Merge "Adds better bookending and robustness around the instance audit usage generation"
Diffstat (limited to 'bin/instance-usage-audit')
| -rwxr-xr-x | bin/instance-usage-audit | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/bin/instance-usage-audit b/bin/instance-usage-audit index 41b65df8c..d40faa3e1 100755 --- a/bin/instance-usage-audit +++ b/bin/instance-usage-audit @@ -39,6 +39,7 @@ 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... @@ -66,10 +67,16 @@ if __name__ == '__main__': flags.FLAGS(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 "%s instances" % len(instances) + print "Found %d instances" % len(instances) for instance_ref in instances: - nova.compute.utils.notify_usage_exists(admin_context, instance_ref) + try: + nova.compute.utils.notify_usage_exists( + admin_context, instance_ref, safe=False) + except Exception, e: + print traceback.format_exc(e) + print "Instance usage audit completed" |
