The command 'cinder retype <volume-id> <type-id> --migration-policy on-demand' fails with the following exception when the volume with <volume-id> has no volume type:
2016-02-19 09:36:35.323 INFO cinder.volume.manager [req-c4dca4bc-2e42-4a0b-8cd8-f8131380aaa3 7dff5ccdadaa4306b7a9afebae06c4cd a83bb7aae90c49d3a0e9ab64e9f968d8] Deleted volume successfully.
2016-02-19 09:36:35.323 DEBUG oslo_concurrency.lockutils [req-c4dca4bc-2e42-4a0b-8cd8-f8131380aaa3 7dff5ccdadaa4306b7a9afebae06c4cd a83bb7aae90c49d3a0e9ab64e9f968d8] Lock "01b77d51-0b27-4700-9db9-0bcc29d3b29c-delete_volume" released by "cinder.volume.manager.lvo_inner2" :: held 0.143s from (pid=31529) inner /usr/lib/python2.7/site-packages/oslo_concurrency/lockutils.py:282
2016-02-19 09:36:35.342 ERROR oslo_messaging.rpc.dispatcher [req-c4dca4bc-2e42-4a0b-8cd8-f8131380aaa3 7dff5ccdadaa4306b7a9afebae06c4cd a83bb7aae90c49d3a0e9ab64e9f968d8] Exception during message handling: Instance <VolumeTypes at 0x7ffa5d8fb250> has a NULL identity key. If this is an auto-generated value, check that the database table allows generation of new primary key values, and that the mapped Column object is configured to expect these generated values. Ensure also that this flush() is not occurring at an inappropriate time, such aswithin a load() event.
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher Traceback (most recent call last):
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 143, in _dispatch_and_reply
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher executor_callback))
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 189, in _dispatch
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher executor_callback)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 130, in _do_dispatch
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher result = func(ctxt, **new_args)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 117, in wrapper
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 117, in wrapper
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 117, in wrapper
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/manager.py", line 2246, in retype
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher new_reservations, status_update)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher self.force_reraise()
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/manager.py", line 2242, in retype
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher new_type_id=new_type_id)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 117, in wrapper
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 117, in wrapper
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 117, in wrapper
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/manager.py", line 1900, in migrate_volume
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher volume.save()
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher self.force_reraise()
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/manager.py", line 1893, in migrate_volume
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher new_type_id)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/manager.py", line 1708, in _migrate_volume_generic
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher new_volume)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher self.force_reraise()
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/manager.py", line 1693, in _migrate_volume_generic
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher error=False)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 117, in wrapper
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 117, in wrapper
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 117, in wrapper
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/manager.py", line 1810, in migrate_volume_completion
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher updated_new = volume.finish_volume_migration(new_volume)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/objects/volume.py", line 409, in finish_volume_migration
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher dest_volume.save()
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 223, in wrapper
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return fn(self, *args, **kwargs)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/objects/volume.py", line 312, in save
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher db.volume_update(self._context, self.id, updates)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/db/api.py", line 225, in volume_update
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return IMPL.volume_update(context, volume_id, values)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/db/sqlalchemy/api.py", line 192, in wrapper
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/db/sqlalchemy/api.py", line 1709, in volume_update
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher return volume_ref
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 502, in __exit__
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher self.rollback()
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher compat.reraise(exc_type, exc_value, exc_tb)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 499, in __exit__
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher self.commit()
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 392, in commit
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher self._prepare_impl()
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 372, in _prepare_impl
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher self.session.flush()
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 2027, in flush
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher self._flush(objects)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 2145, in _flush
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher transaction.rollback(_capture_exception=True)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher compat.reraise(exc_type, exc_value, exc_tb)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 2115, in _flush
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher flush_context.finalize_flush_changes()
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 395, in finalize_flush_changes
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher self.session._register_newly_persistent(other)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 1535, in _register_newly_persistent
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher % state_str(state)
2016-02-19 09:36:35.342 TRACE oslo_messaging.rpc.dispatcher FlushError: Instance <VolumeTypes at 0x7ffa5d8fb250> has a NULL identity key. If this is an auto-generated value, check that the database table allows generation of new primary key values, and that the mapped Column object is configured to expect these generated values. Ensure also that this flush() is not occurring at an inappropriate time, such aswithin a load() event.
This is not a duplicate of [1]. There fixing a similar retype-failure required changes to volume_types_diff() to handle the case where the original volume had no volume type. Here we have an exception bubbling up from sqlaclhemy with a complaint that "VolumeTypes at 0x7ffa5d8fb250> has a NULL identity key."
[1] https:/ /bugs.launchpad .net/cinder/ +bug/1311058