Internal Tempest tests are failing when deleting a consistency group. The error from the log file is:
2016-06-02 17:31:49.211 INFO cinder.api.contrib.consistencygroups [req-815de577-e1d6-4418-a56e-8e8346257709 tempest-ConsistencyGroupsV2Test-1276397807] Delete consistency group with id: a8cc0153-1a16-4e2c-85ac-ada73a75bcd8
2016-06-02 17:31:49.216 INFO cinder.api.openstack.wsgi [req-7d35bc72-0440-4258-bfc8-8374b4b9b983 tempest-NetAppCDOTQOSTest-1518787507] GET http://127.0.0.1:8776/v2/23bf4a3d35b6411ab80730939884125d/qos-specs/ec5f1f08-31a7-4115-b303-d9ad6dc65776/associate?vol_type_id=083d9ae8-592f-4b98-bf0c-6b9377661ac8
2016-06-02 17:31:49.216 DEBUG cinder.api.openstack.wsgi [req-7d35bc72-0440-4258-bfc8-8374b4b9b983 tempest-NetAppCDOTQOSTest-1518787507] Empty body provided in request get_body /opt/stack/new/cinder/cinder/api/openstack/wsgi.py:717
2016-06-02 17:31:49.216 DEBUG cinder.api.openstack.wsgi [req-7d35bc72-0440-4258-bfc8-8374b4b9b983 tempest-NetAppCDOTQOSTest-1518787507] Calling method '<bound method QoSSpecsController.associate of <cinder.api.contrib.qos_specs_manage.QoSSpecsController object at 0x7fac5a24aad0>>' _process_stack /opt/stack/new/cinder/cinder/api/openstack/wsgi.py:874
2016-06-02 17:31:49.217 DEBUG cinder.api.contrib.qos_specs_manage [req-7d35bc72-0440-4258-bfc8-8374b4b9b983 tempest-NetAppCDOTQOSTest-1518787507] Associate qos_spec: ec5f1f08-31a7-4115-b303-d9ad6dc65776 with type: 083d9ae8-592f-4b98-bf0c-6b9377661ac8 associate /opt/stack/new/cinder/cinder/api/contrib/qos_specs_manage.py:282
2016-06-02 17:31:49.248 ERROR oslo_db.sqlalchemy.exc_filters [req-815de577-e1d6-4418-a56e-8e8346257709 tempest-ConsistencyGroupsV2Test-1276397807] DBAPIError exception wrapped from (pymysql.err.InternalError) (1093, u"You can't specify target table 'consistencygroups' for update in FROM clause") [SQL: u'UPDATE consistencygroups SET updated_at=%(updated_at)s, status=%(status)s WHERE consistencygroups.deleted = false AND NOT (EXISTS (SELECT * \nFROM cgsnapshots \nWHERE cgsnapshots.consistencygroup_id = consistencygroups.id AND cgsnapshots.deleted = 0)) AND NOT (EXISTS (SELECT * \nFROM volumes \nWHERE volumes.consistencygroup_id = consistencygroups.id AND volumes.deleted = 0 AND (volumes.attach_status = %(attach_status_1)s OR (EXISTS (SELECT * \nFROM snapshots \nWHERE volumes.id = snapshots.volume_id AND snapshots.deleted = 0))))) AND NOT (EXISTS (SELECT * \nFROM consistencygroups AS consistencygroups_1 \nWHERE consistencygroups_1.deleted = 0 AND consistencygroups_1.status = %(status_1)s AND consistencygroups_1.source_cgid = %(source_cgid_1)s)) AND consistencygroups.id = %(id_1)s'] [parameters: {'status': 'deleting', u'attach_status_1': 'attached', 'updated_at': datetime.datetime(2016, 6, 2, 17, 31, 49, 247097), u'id_1': 'a8cc0153-1a16-4e2c-85ac-ada73a75bcd8', u'source_cgid_1': 'a8cc0153-1a16-4e2c-85ac-ada73a75bcd8', u'status_1': 'creating'}]
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters Traceback (most recent call last):
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters context)
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 450, in do_execute
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters cursor.execute(statement, parameters)
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 161, in execute
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters result = self._query(query)
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 317, in _query
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters conn.query(q)
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 835, in query
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters self._affected_rows = self._read_query_result(unbuffered=unbuffered)
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1019, in _read_query_result
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters result.read()
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1302, in read
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters first_packet = self.connection._read_packet()
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 981, in _read_packet
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters packet.check_error()
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 393, in check_error
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters err.raise_mysql_exception(self._data)
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 120, in raise_mysql_exception
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters _check_mysql_exception(errinfo)
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 115, in _check_mysql_exception
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters raise InternalError(errno, errorvalue)
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters InternalError: (1093, u"You can't specify target table 'consistencygroups' for update in FROM clause")
2016-06-02 17:31:49.248 27596 ERROR oslo_db.sqlalchemy.exc_filters
Reproduced on my setup. Exception was thrown while doing conditional update:
https:/ /github. com/openstack/ cinder/ blob/master/ cinder/ consistencygrou p/api.py# L440