software deployment without server property specified fails with DB error

Bug #1473063 reported by Rabi Mishra
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Rabi Mishra

Bug Description

SERVER is an optional property of SoftwareDeployment resource. However, when not specified, it throws DB error.

 stack_status_reason | Resource CREATE failed: RemoteError: Remote error: |
| | OperationalError (OperationalError) (1048, "Column |
| | 'server_id' cannot be null") 'INSERT INTO |
| | software_deployment (created_at, action, status, |
| | status_reason, id, config_id, server_id, input_values, |
| | output_values, tenant, stack_user_project_id, |
| | updated_at) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, |
| | %s, %s, %s)' (datetime.datetime(2015, 6, 12, 23, 53, |
| | 34, 673620), 'CREATE', 'IN_PROGRESS', 'Deploy data |
| | available', 'edbe25c7-75c5-4a05-95a9-4eb2a6d5415e', |
| | '42750efb-252d-4cce-aa7a-00723bb16077', None, '{}', |
| | 'null', '64587284c2fa4641b1e5e9f2c6a8e4a2', |
| | 'b7efd4f5332f43b584718f88256fa875', None) [u'Traceback |
| | (most recent call last):\n', u' File |
| | "/usr/lib/python2.7/site- |
| | packages/oslo_messaging/rpc/dispatcher.py", line 142, |
| | in _dispatch_and_reply\n executor_callback))\n', u' |
| | File "/usr/lib/python2.7/site- |
| | packages/oslo_messaging/rpc/dispatcher.py", line 186, |
| | in _dispatch\n executor_callback)\n', u' File |
| | "/usr/lib/python2.7/site- |
| | packages/oslo_messaging/rpc/dispatcher.py", line 130, |
| | in _do_dispatch\n result = func(ctxt, |
| | **new_args)\n', u' File "/usr/lib/python2.7/site- |
| | packages/osprofiler/profiler.py", line 105, in |
| | wrapper\n return f(*args, **kwargs)\n', u' File |
| | "/opt/stack/heat/heat/common/context.py", line 267, in |
| | wrapped\n return func(self, ctx, *args, |
| | **kwargs)\n', u' File |
| | "/opt/stack/heat/heat/engine/service.py", line 1566, in |
| | create_software_deployment\n |
| | stack_user_project_id=stack_user_project_id)\n', u' |
| | File "/opt/stack/heat/heat/engine/service_software_conf |
| | ig.py", line 163, in create_software_deployment\n |
| | \'status_reason\': status_reason})\n', u' File |
| | "/opt/stack/heat/heat/objects/software_deployment.py", |
| | line 66, in create\n context, cls(), |
| | db_api.software_deployment_create(context, values))\n', |
| | u' File "/opt/stack/heat/heat/db/api.py", line 314, in |
| | software_deployment_create\n return |
| | IMPL.software_deployment_create(context, values)\n', u' |
| | File "/opt/stack/heat/heat/db/sqlalchemy/api.py", line |
| | 883, in software_deployment_create\n |
| | obj_ref.save(_session(context))\n', u' File |
| | "/usr/lib/python2.7/site- |
| | packages/oslo_db/sqlalchemy/models.py", line 48, in |
| | save\n session.flush()\n', u' File |
| | "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/orm/session.py", line 1985, in |
| | flush\n self._flush(objects)\n', u' File |
| | "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/orm/session.py", line 2103, in |
| | _flush\n |
| | transaction.rollback(_capture_exception=True)\n', u' |
| | File "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/util/langhelpers.py", line 60, in |
| | __exit__\n compat.reraise(exc_type, exc_value, |
| | exc_tb)\n', u' File "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/orm/session.py", line 2067, in |
| | _flush\n flush_context.execute()\n', u' File |
| | "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/orm/unitofwork.py", line 372, in |
| | execute\n rec.execute(self)\n', u' File |
| | "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/orm/unitofwork.py", line 526, in |
| | execute\n uow\n', u' File "/usr/lib64/python2.7 |
| | /site-packages/sqlalchemy/orm/persistence.py", line 65, |
| | in save_obj\n mapper, table, insert)\n', u' File |
| | "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/orm/persistence.py", line 602, in |
| | _emit_insert_statements\n execute(statement, |
| | params)\n', u' File "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/engine/base.py", line 841, in |
| | execute\n return meth(self, multiparams, params)\n', |
| | u' File "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/sql/elements.py", line 322, in |
| | _execute_on_connection\n return |
| | connection._execute_clauseelement(self, multiparams, |
| | params)\n', u' File "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/engine/base.py", line 938, in |
| | _execute_clauseelement\n compiled_sql, |
| | distilled_params\n', u' File "/usr/lib64/python2.7 |
| | /site-packages/sqlalchemy/engine/base.py", line 1070, |
| | in _execute_context\n context)\n', u' File |
| | "/usr/lib/python2.7/site- |
| | packages/oslo_db/sqlalchemy/compat/handle_error.py", |
| | line 155, in _handle_dbapi_exception\n e, statement, |
| | parameters, cursor, context)\n', u' File |
| | "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/engine/base.py", line 1267, in |
| | _handle_dbapi_exception\n |
| | util.raise_from_cause(newraise, exc_info)\n', u' File |
| | "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/util/compat.py", line 199, in |
| | raise_from_cause\n reraise(type(exception), |
| | exception, tb=exc_tb)\n', u' File |
| | "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/engine/base.py", line 1063, in |
| | _execute_context\n context)\n', u' File |
| | "/usr/lib64/python2.7/site- |
| | packages/sqlalchemy/engine/default.py", line 442, in |
| | do_execute\n cursor.execute(statement, |
| | parameters)\n', u' File "/usr/lib64/python2.7/site- |
| | packages/MySQLdb/cursors.py", line 174, in execute\n |
| | self.errorhandler(self, exc, value)\n', u' File |
| | "/usr/lib64/python2.7/site- |
| | packages/MySQLdb/connections.py", line 36, in |
| | defaulterrorhandler\n raise errorclass, |
| | errorvalue\n', u'OperationalError: (OperationalError) |
| | (1048, "Column \'server_id\' cannot be null") \'INSERT |
| | INTO software_deployment (created_at, action, status, |
| | status_reason, id, config_id, server_id, input_values, |
| | output_values, tenant, stack_user_project_id, |
| | updated_at) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, |
| | %s, %s, %s)\' (datetime.datetime(2015, 6, 12, 23, 53, |
| | 34, 673620), \'CREATE\', \'IN_PROGRESS\', \'Deploy data |
| | available\', \'edbe25c7-75c5-4a05-95a9-4eb2a6d5415e\', |
| | \'42750efb-252d-4cce-aa7a-00723bb16077\', None, \'{}\', |
| | \'null\', \'64587284c2fa4641b1e5e9f2c6a8e4a2\', |
| | \'b7efd4f5332f43b584718f88256fa875\', None)\n'].

Rabi Mishra (rabi)
Changed in heat:
assignee: nobody → Rabi Mishra (rabi)
Changed in heat:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/200366

Changed in heat:
status: Triaged → In Progress
Revision history for this message
huangtianhua (huangtianhua) wrote :

I proposed a patch similar before https://review.openstack.org/#/c/144865/
And stevebaker given me some suggestions, please have a look.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/200366
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=a091bec1f2cf62c2dcb164ce5670051b9a08b9ea
Submitter: Jenkins
Branch: master

commit a091bec1f2cf62c2dcb164ce5670051b9a08b9ea
Author: Rabi Mishra <email address hidden>
Date: Fri Jul 10 09:26:50 2015 +0530

    Make 'server' property of SoftwareDeployment mandatory

    Change-Id: I6c1d82cc4cc6df4d5edac93537c546ac6ffcad7e
    Closes-Bug: #1473063

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
milestone: none → liberty-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: liberty-2 → 5.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.