Looks like this bug is still not fixed. We upgraded to latest stein release and we are facing this problem when starting cinder-volume service:
Error starting thread.: sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <VolumeAttachment at 0x7f04ba5ed3c8> is not bound to a Session; lazy load operation of attribute 'volume' cannot proceed (Background on this error at: http://sqlalche.me/e/bhk3)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service Traceback (most recent call last):
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/oslo_service/service.py", line 796, in run_service
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service service.start()
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/cinder/service.py", line 222, in start
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service service_id=Service.service_id)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/cinder/volume/manager.py", line 445, in init_host
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service self._init_host(added_to_cluster, **kwargs)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/cinder/volume/manager.py", line 523, in _init_host
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service volumes = self._get_my_volumes(ctxt)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/cinder/volume/manager.py", line 3007, in _get_my_volumes
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service limit, offset)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/cinder/volume/manager.py", line 3003, in _get_my_resources
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service offset=offset)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/cinder/objects/volume.py", line 617, in get_all
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service volumes, expected_attrs=expected_attrs)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/oslo_versionedobjects/base.py", line 1133, in obj_make_list
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service **extra_args)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/cinder/objects/volume.py", line 290, in _from_db_object
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service db_volume.get('volume_attachment'))
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/oslo_versionedobjects/base.py", line 1133, in obj_make_list
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service **extra_args)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/cinder/objects/volume_attachment.py", line 102, in _from_db_object
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service if 'volume' in expected_attrs and hasattr(db_attachment, 'volume'):
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/sqlalchemy/orm/attributes.py", line 242, in __get__
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service return self.impl.get(instance_state(instance), dict_)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/sqlalchemy/orm/attributes.py", line 601, in get
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service value = self.callable_(state, passive)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service File "/usr/lib/python3/dist-packages/sqlalchemy/orm/strategies.py", line 596, in _load_for_state
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service (orm_util.state_str(state), self.key)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.service sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <VolumeAttachment at 0x7f04ba5ed3c8> is not bound to a Session; lazy load operation of attribute 'volume' cannot proceed (Background on this error at: http://sqlalche.me/e/bhk3)
Should I open a new bug report? I think this is related to this one. I already looked into the code and the patch is applied at my version.
ii cinder-api 2:14.0.0-0ubuntu1~cloud0 all Cinder storage service - API server
ii cinder-common 2:14.0.0-0ubuntu1~cloud0 all Cinder storage service - common files
ii cinder-scheduler 2:14.0.0-0ubuntu1~cloud0 all Cinder storage service - Scheduler server
ii cinder-volume 2:14.0.0-0ubuntu1~cloud0 all Cinder storage service - Volume server
ii python3-cinder 2:14.0.0-0ubuntu1~cloud0 all Cinder Python 3 libraries
Looks like this bug is still not fixed. We upgraded to latest stein release and we are facing this problem when starting cinder-volume service:
Error starting thread.: sqlalchemy. orm.exc. DetachedInstanc eError: Parent instance <VolumeAttachment at 0x7f04ba5ed3c8> is not bound to a Session; lazy load operation of attribute 'volume' cannot proceed (Background on this error at: http:// sqlalche. me/e/bhk3) service Traceback (most recent call last): service File "/usr/lib/ python3/ dist-packages/ oslo_service/ service. py", line 796, in run_service service service.start() service File "/usr/lib/ python3/ dist-packages/ cinder/ service. py", line 222, in start service service_ id=Service. service_ id) service File "/usr/lib/ python3/ dist-packages/ cinder/ volume/ manager. py", line 445, in init_host service self._init_ host(added_ to_cluster, **kwargs) service File "/usr/lib/ python3/ dist-packages/ cinder/ volume/ manager. py", line 523, in _init_host service volumes = self._get_ my_volumes( ctxt) service File "/usr/lib/ python3/ dist-packages/ cinder/ volume/ manager. py", line 3007, in _get_my_volumes service limit, offset) service File "/usr/lib/ python3/ dist-packages/ cinder/ volume/ manager. py", line 3003, in _get_my_resources service offset=offset) service File "/usr/lib/ python3/ dist-packages/ cinder/ objects/ volume. py", line 617, in get_all service volumes, expected_ attrs=expected_ attrs) service File "/usr/lib/ python3/ dist-packages/ oslo_versionedo bjects/ base.py" , line 1133, in obj_make_list service **extra_args) service File "/usr/lib/ python3/ dist-packages/ cinder/ objects/ volume. py", line 290, in _from_db_object service db_volume. get('volume_ attachment' )) service File "/usr/lib/ python3/ dist-packages/ oslo_versionedo bjects/ base.py" , line 1133, in obj_make_list service **extra_args) service File "/usr/lib/ python3/ dist-packages/ cinder/ objects/ volume_ attachment. py", line 102, in _from_db_object service if 'volume' in expected_attrs and hasattr( db_attachment, 'volume'): service File "/usr/lib/ python3/ dist-packages/ sqlalchemy/ orm/attributes. py", line 242, in __get__ service return self.impl. get(instance_ state(instance) , dict_) service File "/usr/lib/ python3/ dist-packages/ sqlalchemy/ orm/attributes. py", line 601, in get service value = self.callable_ (state, passive) service File "/usr/lib/ python3/ dist-packages/ sqlalchemy/ orm/strategies. py", line 596, in _load_for_state service (orm_util. state_str( state), self.key) service sqlalchemy. orm.exc. DetachedInstanc eError: Parent instance <VolumeAttachment at 0x7f04ba5ed3c8> is not bound to a Session; lazy load operation of attribute 'volume' cannot proceed (Background on this error at: http:// sqlalche. me/e/bhk3)
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
2019-07-01 10:29:22.947 16745 ERROR oslo_service.
Should I open a new bug report? I think this is related to this one. I already looked into the code and the patch is applied at my version.
ii cinder-api 2:14.0. 0-0ubuntu1~ cloud0 all Cinder storage service - API server 0-0ubuntu1~ cloud0 all Cinder storage service - common files 0-0ubuntu1~ cloud0 all Cinder storage service - Scheduler server 0-0ubuntu1~ cloud0 all Cinder storage service - Volume server 0-0ubuntu1~ cloud0 all Cinder Python 3 libraries
ii cinder-common 2:14.0.
ii cinder-scheduler 2:14.0.
ii cinder-volume 2:14.0.
ii python3-cinder 2:14.0.