← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1025481] Re: Instance usage audit fails under PostgreSQL

 

*** This bug is a duplicate of bug 1102477 ***
    https://bugs.launchpad.net/bugs/1102477

** Changed in: nova
       Status: Triaged => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1025481

Title:
  Instance usage audit fails under PostgreSQL

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  The instance_usage_audit calls are not working when using PostgreSQL
  (not sure about other DB implementations) because SQLAlchemy sends it
  as a date when it expects a varchar.

  Stacktrace:
  2012-07-17 00:00:07 DEBUG nova.manager [-] Running periodic task ComputeManager._instance_usage_audit from (pid=6658) periodic_tasks /usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/manager.py:164
  2012-07-17 00:00:07 ERROR nova.manager [-] Error during ComputeManager._instance_usage_audit: (ProgrammingError) operator does not exist: character varying = timestamp without time zone
  LINE 3: ...stance_usage_audit' AND task_log.period_beginning = '2012-06...
                                                               ^
  HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
   'SELECT task_log.created_at AS task_log_created_at, task_log.updated_at AS task_log_updated_at, task_log.deleted_at AS task_log_deleted_at, task_log.deleted AS task_log_deleted, task_log.id AS task_log_id, task_log.task_name AS task_log_task_name, task_log.state AS task_log_state, task_log.host AS task_log_host, task_log.period_beginning AS task_log_period_beginning, task_log.period_ending AS task_log_period_ending, task_log.message AS task_log_message, task_log.task_items AS task_log_task_items, task_log.errors AS task_log_errors \nFROM task_log \nWHERE task_log.deleted = %(deleted_1)s AND task_log.task_name = %(task_name_1)s AND task_log.period_beginning = %(period_beginning_1)s AND task_log.period_ending = %(period_ending_1)s AND task_log.host = %(host_1)s \n LIMIT %(param_1)s' {'host_1': 'compute2', 'param_1': 1, 'deleted_1': False, 'period_ending_1': datetime.datetime(2012, 7, 1, 0, 0), 'task_name_1': 'instance_usage_audit', 'period_beginning_1': datetime.datetime(2012, 6, 1, 0, 0)}
  2012-07-17 00:00:07 TRACE nova.manager Traceback (most recent call last):
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/manager.py", line 167, in periodic_tasks
  2012-07-17 00:00:07 TRACE nova.manager     task(self, context)
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/compute/manager.py", line 2381, in _instance_usage_audit
  2012-07-17 00:00:07 TRACE nova.manager     if not compute_utils.has_audit_been_run(context, self.host):
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/compute/utils.py", line 116, in has_audit_been_run
  2012-07-17 00:00:07 TRACE nova.manager     begin, end, host)
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/db/api.py", line 1879, in task_log_get
  2012-07-17 00:00:07 TRACE nova.manager     period_ending, host, state, session)
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/db/sqlalchemy/api.py", line 114, in wrapper
  2012-07-17 00:00:07 TRACE nova.manager     return f(*args, **kwargs)
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/db/sqlalchemy/api.py", line 4971, in task_log_get
  2012-07-17 00:00:07 TRACE nova.manager     return query.first()
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2156, in first
  2012-07-17 00:00:07 TRACE nova.manager     ret = list(self[0:1])
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2023, in __getitem__
  2012-07-17 00:00:07 TRACE nova.manager     return list(res)
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2227, in __iter__
  2012-07-17 00:00:07 TRACE nova.manager     return self._execute_and_instances(context)
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2242, in _execute_and_instances
  2012-07-17 00:00:07 TRACE nova.manager     result = conn.execute(querycontext.statement, self._params)
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1449, in execute
  2012-07-17 00:00:07 TRACE nova.manager     params)
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1584, in _execute_clauseelement
  2012-07-17 00:00:07 TRACE nova.manager     compiled_sql, distilled_params
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1698, in _execute_context
  2012-07-17 00:00:07 TRACE nova.manager     context)
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1691, in _execute_context
  2012-07-17 00:00:07 TRACE nova.manager     context)
  2012-07-17 00:00:07 TRACE nova.manager   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 331, in do_execute
  2012-07-17 00:00:07 TRACE nova.manager     cursor.execute(statement, parameters)
  2012-07-17 00:00:07 TRACE nova.manager ProgrammingError: (ProgrammingError) operator does not exist: character varying = timestamp without time zone
  2012-07-17 00:00:07 TRACE nova.manager LINE 3: ...stance_usage_audit' AND task_log.period_beginning = '2012-06...
  2012-07-17 00:00:07 TRACE nova.manager                                                              ^
  2012-07-17 00:00:07 TRACE nova.manager HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
  2012-07-17 00:00:07 TRACE nova.manager  'SELECT task_log.created_at AS task_log_created_at, task_log.updated_at AS task_log_updated_at, task_log.deleted_at AS task_log_deleted_at, task_log.deleted AS task_log_deleted, task_log.id AS task_log_id, task_log.task_name AS task_log_task_name, task_log.state AS task_log_state, task_log.host AS task_log_host, task_log.period_beginning AS task_log_period_beginning, task_log.period_ending AS task_log_period_ending, task_log.message AS task_log_message, task_log.task_items AS task_log_task_items, task_log.errors AS task_log_errors \nFROM task_log \nWHERE task_log.deleted = %(deleted_1)s AND task_log.task_name = %(task_name_1)s AND task_log.period_beginning = %(period_beginning_1)s AND task_log.period_ending = %(period_ending_1)s AND task_log.host = %(host_1)s \n LIMIT %(param_1)s' {'host_1': 'compute2', 'param_1': 1, 'deleted_1': False, 'period_ending_1': datetime.datetime(2012, 7, 1, 0, 0), 'task_name_1': 'instance_usage_audit', 'period_beginning_1': datetime.datetime(2012, 6, 1, 0, 0)}

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1025481/+subscriptions