Refactor federation SQL backend
Refactor federation SQL backend

- Move non database related operation out of the transaction
- Use with sql.transaction() as session to open new db transactions
- Remove unnecessary session = sql.get_session() line from SP operation.

Change-Id: I5ae70268e25b0ec58c7e9328fba4507611e1242e

vivekdhayaal/keystone,maestro-hybrid-cloud/keystone,promptworks/keystone,ajayaa/keystone,promptworks/keystone,jumpstarter-io/keystone,dstanek/keystone,rushiagr/keystone,takeshineshiro/keystone,klmitch/keystone,rushiagr/keystone,takeshineshiro/keystone,idjaw/keystone,mahak/keystone,dims/keystone,nuxeh/keystone,mahak/keystone,rushiagr/keystone,dims/keystone,ilay09/keystone,himanshu-setia/keystone,vivekdhayaal/keystone,dstanek/keystone,jamielennox/keystone,vivekdhayaal/keystone,rajalokan/keystone,UTSA-ICS/keystone-kerberos,rajalokan/keystone,cernops/keystone,promptworks/keystone,maestro-hybrid-cloud/keystone,rajalokan/keystone,openstack/keystone,jonnary/keystone,klmitch/keystone,jamielennox/keystone,UTSA-ICS/keystone-kerberos,himanshu-setia/keystone,cernops/keystone,jumpstarter-io/keystone,roopali8/keystone,jonnary/keystone,ajayaa/keystone,openstack/keystone,ilay09/keystone,jumpstarter-io/keystone,mahak/keystone,roopali8/keystone,openstack/keystone,nuxeh/keystone,ilay09/keystone,dstanek/keystone,nuxeh/keystone,idjaw/keystone