)]}'
{"nova/db/sqlalchemy/api.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"03f52ad9b6c4207a0a3d1e1c9024b837e7617a5e","unresolved":false,"context_lines":[{"line_number":2765,"context_line":"@require_admin_context"},{"line_number":2766,"context_line":"def reservation_create(context, uuid, usage, project_id, resource, delta,"},{"line_number":2767,"context_line":"                       expire):"},{"line_number":2768,"context_line":"    return _reservation_create(context, uuid, usage, project_id, resource,"},{"line_number":2769,"context_line":"                               delta, expire)"},{"line_number":2770,"context_line":""},{"line_number":2771,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAPH%2F%2Fo48%3D","line":2768,"updated":"2013-05-28 19:37:46.000000000","message":"What\u0027s the purpose of this curious little dance?  As far as I can tell, you\u0027ve just added a slightly less efficient alias for the original reservation_create()…\n\nIf all you\u0027re thinking of is trying to prevent the session variable from being passed in to reservation_create(), this is already done; the function that actually gets called is nova.db.api.reservation_create(), which does not have a session argument and does not pass one in to this actual backend implementation of the function; thus, the only possible consumers of reservation_create() that *can* pass in a session are those functions within this file, such as quota_reserve().","commit_id":"94abf63072c983a14a0892899c2b0724ef89b88e"},{"author":{"_account_id":6172,"name":"Boris Pavlovic","email":"boris@pavlovic.me","username":"boris-42"},"change_message_id":"de39e1d156837ca274c95770e5d8a5ef4cbf16b2","unresolved":false,"context_lines":[{"line_number":2765,"context_line":"@require_admin_context"},{"line_number":2766,"context_line":"def reservation_create(context, uuid, usage, project_id, resource, delta,"},{"line_number":2767,"context_line":"                       expire):"},{"line_number":2768,"context_line":"    return _reservation_create(context, uuid, usage, project_id, resource,"},{"line_number":2769,"context_line":"                               delta, expire)"},{"line_number":2770,"context_line":""},{"line_number":2771,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAPH%2F%2FmSY%3D","line":2768,"in_reply_to":"AAAAPH%2F%2FmV0%3D","updated":"2013-05-29 16:29:32.000000000","message":"We have BP db-session-cleanup about it, and there is a whole documentation about working with sqlalchemy and sessions.\nDocument nova/openstack/common/db/sqlalchemy/session.py. \n\nIn 116 line we have written about passing session as a parameter:\n\n\"Passing an active session between methods. Sessions should only be passed to private methods.\"","commit_id":"94abf63072c983a14a0892899c2b0724ef89b88e"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"23b3c12af6736f33e8b5fec108cc517891c3d7d8","unresolved":false,"context_lines":[{"line_number":2765,"context_line":"@require_admin_context"},{"line_number":2766,"context_line":"def reservation_create(context, uuid, usage, project_id, resource, delta,"},{"line_number":2767,"context_line":"                       expire):"},{"line_number":2768,"context_line":"    return _reservation_create(context, uuid, usage, project_id, resource,"},{"line_number":2769,"context_line":"                               delta, expire)"},{"line_number":2770,"context_line":""},{"line_number":2771,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAPH%2F%2FmV0%3D","line":2768,"in_reply_to":"AAAAPH%2F%2Fnhw%3D","updated":"2013-05-29 16:08:30.000000000","message":"Well, there are some methods where we have to pass the session in—though obviously this isn\u0027t one of them—so there\u0027s always that potential for someone to copy-pasta the session parameter in.  Personally, I think our database API suffers from extremely poor design, but that\u0027s neither here nor there…\n\nAnyway, I would suggest that you include a comment here explaining your reasoning, whether or not you continue this separation (which I won\u0027t object to further).  That will be helpful for other reviewers, and may hopefully clue in copy-and-pasters as to the caveats…","commit_id":"94abf63072c983a14a0892899c2b0724ef89b88e"},{"author":{"_account_id":6172,"name":"Boris Pavlovic","email":"boris@pavlovic.me","username":"boris-42"},"change_message_id":"aa87cdfa28c3b4fc189647d0ed1b98730db9d1df","unresolved":false,"context_lines":[{"line_number":2765,"context_line":"@require_admin_context"},{"line_number":2766,"context_line":"def reservation_create(context, uuid, usage, project_id, resource, delta,"},{"line_number":2767,"context_line":"                       expire):"},{"line_number":2768,"context_line":"    return _reservation_create(context, uuid, usage, project_id, resource,"},{"line_number":2769,"context_line":"                               delta, expire)"},{"line_number":2770,"context_line":""},{"line_number":2771,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAPH%2F%2Fnhw%3D","line":2768,"in_reply_to":"AAAAPH%2F%2Fo48%3D","updated":"2013-05-29 08:06:38.000000000","message":"Kevin, I disagree with your position. \nWe shouldn\u0027t pass session in public methods, even in sqlalchemy backend.\nThis is very important, because for a half year I saw a tons of situation, when new contributors, that are not familiar with nova, nova.db are copy pasting such parts of code, then they put session parameter also in db.api and this creates a tons of problems. So I have to spend a lot of time, to describe each time situation with session parameter, and then I hear something like: \"I copied it from here...\". So I have to aslo tell that not all code is well written in sqla implementation...\n\nSo I would prefer that we don\u0027t use sql.session in public methods at all. It is not so bad for performance.","commit_id":"94abf63072c983a14a0892899c2b0724ef89b88e"}]}
