Ask Your Question

Revision history [back]

oslo is a common code project (and it is a bit strict to sync upstream code from oslo to each project.), the link you provided in neutron is exactly oslo code. you can read https://wiki.openstack.org/wiki/Oslo for more detail.

some projects will define their own get_session, but just a simple wrapper to oslo's get_session, or maybe some special case cannot be met in specific low level driver so particular code should handle that. usually, openstack projects use oslo get_session directly, for i.e., nova, keystone, cinder, glance.

Neutron has written a simple helper function get_session, which just changes the default value of parameter sqlite_fk(which means SqliteForeignKeys) in oslo get_session, you can dig deeper to figure out why it does that, and I think this is another question.

-------------------details can be ignored--------------------- zqfan@openstack-dev:~/openstack/nova/nova$ grep -n 'def get_session' ./ -r ./openstack/common/db/sqlalchemy/session.py:412:def get_session(autocommit=True, expire_on_commit=False, ./tests/virt/xenapi/test_xenapi.py:128:def get_session(): ./virt/hyperv/basevolumeutils.py:105: def get_session_id_from_mounted_disk(self, physical_drive_path): ./virt/baremetal/db/sqlalchemy/session.py:48:def get_session(autocommit=True, expire_on_commit=False): ./virt/xenapi/client/session.py:151: def get_session_id(self):

zqfan@openstack-dev:~/openstack/cinder/cinder$ grep -n 'def get_session' ./ -r ./openstack/common/db/sqlalchemy/session.py:370:def get_session(autocommit=True, expire_on_commit=False, ./volume/drivers/xenapi/lib.py:361: def get_session(self):

zqfan@openstack-dev:~/openstack/neutron/neutron$ grep -n 'def get_session' ./ -r./openstack/common/db/sqlalchemy/session.py:414:def get_session(autocommit=True, expire_on_commit=False, ./db/api.py:46:def get_session(autocommit=True, expire_on_commit=False):