Ask Your Question

Revision history [back]

snapshots fail to delete / volume unable to be deleted (mitaka)

Unable to delete volume snapshot to delete volume.

Openstack Mitaka using gluster / nfs as storage repos.

After testing snapshot ability on a volume i tried to delete the snapshot and got this.

2016-11-07 00:01:03.725 31305 CRITICAL cinder [req-23a17285-b210-44a2-99ba-f8c1beaab80d - - - - -] DBReferenceError: (pymysql.err.IntegrityError) (1451, u'Cannot delete or update a parent row: a foreign key constraint fails (`cinder`.`volume_glance_metadata`, CONSTRAINT `volume_glance_metadata_ibfk_2` FOREIGN KEY (`snapshot_id`) REFERENCES `snapshots` (`id`))') [SQL: u'DELETE FROM snapshots WHERE snapshots.deleted_at < %s'] [parameters: (datetime.datetime(2016, 11, 6, 5, 1, 3, 715297),)]
2016-11-07 00:01:03.725 31305 ERROR cinder Traceback (most recent call last):
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/bin/cinder-manage", line 10, in <module>
2016-11-07 00:01:03.725 31305 ERROR cinder     sys.exit(main())
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/cinder/cmd/manage.py", line 596, in main
2016-11-07 00:01:03.725 31305 ERROR cinder     fn(*fn_args)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/cinder/cmd/manage.py", line 231, in purge
2016-11-07 00:01:03.725 31305 ERROR cinder     db.purge_deleted_rows(ctxt, age_in_days)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/cinder/db/api.py", line 1062, in purge_deleted_rows
2016-11-07 00:01:03.725 31305 ERROR cinder     return IMPL.purge_deleted_rows(context, age_in_days=age_in_days)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/cinder/db/sqlalchemy/api.py", line 175, in wrapper
2016-11-07 00:01:03.725 31305 ERROR cinder     return f(*args, **kwargs)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/cinder/db/sqlalchemy/api.py", line 4267, in purge_deleted_rows
2016-11-07 00:01:03.725 31305 ERROR cinder     .where(t.c.deleted_at < deleted_age))
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 1046, in execute
2016-11-07 00:01:03.725 31305 ERROR cinder     bind, close_with_result=True).execute(clause, params or {})
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
2016-11-07 00:01:03.725 31305 ERROR cinder     return meth(self, multiparams, params)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
2016-11-07 00:01:03.725 31305 ERROR cinder     return connection._execute_clauseelement(self, multiparams, params)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
2016-11-07 00:01:03.725 31305 ERROR cinder     compiled_sql, distilled_params
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
2016-11-07 00:01:03.725 31305 ERROR cinder     context)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception
2016-11-07 00:01:03.725 31305 ERROR cinder     util.raise_from_cause(newraise, exc_info)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause
2016-11-07 00:01:03.725 31305 ERROR cinder     reraise(type(exception), exception, tb=exc_tb)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
2016-11-07 00:01:03.725 31305 ERROR cinder     context)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
2016-11-07 00:01:03.725 31305 ERROR cinder     cursor.execute(statement, parameters)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/pymysql/cursors.py", line 146, in execute
2016-11-07 00:01:03.725 31305 ERROR cinder     result = self._query(query)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/pymysql/cursors.py", line 296, in _query
2016-11-07 00:01:03.725 31305 ERROR cinder     conn.query(q)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 781, in query
2016-11-07 00:01:03.725 31305 ERROR cinder     self._affected_rows = self._read_query_result(unbuffered=unbuffered)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 942, in _read_query_result
2016-11-07 00:01:03.725 31305 ERROR cinder     result.read()
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 1138, in read
2016-11-07 00:01:03.725 31305 ERROR cinder     first_packet = self.connection._read_packet()
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 906, in _read_packet
2016-11-07 00:01:03.725 31305 ERROR cinder     packet.check_error()
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 367, in check_error
2016-11-07 00:01:03.725 31305 ERROR cinder     err.raise_mysql_exception(self._data)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/pymysql/err.py", line 120, in raise_mysql_exception
2016-11-07 00:01:03.725 31305 ERROR cinder     _check_mysql_exception(errinfo)
2016-11-07 00:01:03.725 31305 ERROR cinder   File "/usr/lib/python2.7/site-packages/pymysql/err.py", line 112, in _check_mysql_exception
2016-11-07 00:01:03.725 31305 ERROR cinder     raise errorclass(errno, errorvalue)
2016-11-07 00:01:03.725 31305 ERROR cinder DBReferenceError: (pymysql.err.IntegrityError) (1451, u'Cannot delete or update a parent row: a foreign key constraint fails (`cinder`.`volume_glance_metadata`, CONSTRAINT `volume_glance_metadata_ibfk_2` FOREIGN KEY (`snapshot_id`) REFERENCES `snapshots` (`id`))') [SQL: u'DELETE FROM snapshots WHERE snapshots.deleted_at < %s'] [parameters: (datetime.datetime(2016, 11, 6, 5, 1, 3, 715297),)]
2016-11-07 00:01:03.725 31305 ERROR cinder