)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"7c5c03c0fdd553439bcc60de421357e31b0e2239","unresolved":false,"context_lines":[{"line_number":12,"context_line":"Two new fields, for project and user ID, have been added to the"},{"line_number":13,"context_line":"AllocationList object, and the method AllocationList.create_all() has"},{"line_number":14,"context_line":"been changed to ensure that records are written to the consumers,"},{"line_number":15,"context_line":"projects, and users tables when project_id and user_id are not None."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"After an upgrade, new allocations will write consumer records and"},{"line_number":18,"context_line":"existing allocations will have corresponding consumer records written"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":18,"id":"5f201791_0e61e8a9","line":15,"range":{"start_line":15,"start_character":55,"end_line":15,"end_character":67},"updated":"2017-06-23 20:50:32.000000000","message":"project_id and user_id are required with PUT /allocations in the new microversion, so the \u0027not None\u0027 is a bit confusing, but maybe this is just here to explain that the object code will handle older microversions (and computes) where the project id and user id aren\u0027t provided.","commit_id":"a909673682cdd8f02ef0ae5e8c6f061640e320ff"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"7c5c03c0fdd553439bcc60de421357e31b0e2239","unresolved":false,"context_lines":[{"line_number":14,"context_line":"been changed to ensure that records are written to the consumers,"},{"line_number":15,"context_line":"projects, and users tables when project_id and user_id are not None."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"After an upgrade, new allocations will write consumer records and"},{"line_number":18,"context_line":"existing allocations will have corresponding consumer records written"},{"line_number":19,"context_line":"when they are updated as part of the resource tracker periodic task for"},{"line_number":20,"context_line":"updating available resources."},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"Part of blueprint placement-project-user"},{"line_number":23,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":18,"id":"5f201791_4e6480e4","line":20,"range":{"start_line":17,"start_character":62,"end_line":20,"end_character":29},"updated":"2017-06-23 20:50:32.000000000","message":"I wonder if this is going to impact us when we move claims to the scheduler. I don\u0027t remember what we\u0027re going to do about allocations in the periodic task once it starts realizing that the allocations were already created for it. Something to keep in mind for later.","commit_id":"a909673682cdd8f02ef0ae5e8c6f061640e320ff"}],"nova/api/openstack/placement/handlers/allocation.py":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"194266c2d52c639478a1821659255f5b6b402002","unresolved":false,"context_lines":[{"line_number":288,"context_line":"    return req.response"},{"line_number":289,"context_line":""},{"line_number":290,"context_line":""},{"line_number":291,"context_line":"@wsgi_wrapper.PlacementWsgify"},{"line_number":292,"context_line":"@microversion.version_handler(\u00271.8\u0027)"},{"line_number":293,"context_line":"@util.require_content(\u0027application/json\u0027)"},{"line_number":294,"context_line":"def set_allocations(req):"}],"source_content_type":"text/x-python","patch_set":1,"id":"df140735_e341423b","line":291,"updated":"2017-05-31 21:17:44.000000000","message":"Think I need a \"# noqa\" here based on the example in resource_class.py, for multiple microversions of the same method.","commit_id":"fb83dd4dec5599d873236ae071a8f464d0e8bb6c"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"3c636266cb7a652ecf6e8e794a911f85438861cf","unresolved":false,"context_lines":[{"line_number":288,"context_line":"    return req.response"},{"line_number":289,"context_line":""},{"line_number":290,"context_line":""},{"line_number":291,"context_line":"@wsgi_wrapper.PlacementWsgify  # noqa"},{"line_number":292,"context_line":"@microversion.version_handler(\u00271.8\u0027)"},{"line_number":293,"context_line":"@util.require_content(\u0027application/json\u0027)"},{"line_number":294,"context_line":"def set_allocations(req):"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_b4710247","line":291,"updated":"2017-06-02 17:18:49.000000000","message":"yeah, as you identified earlier, this noqa things is required when doing the multiple method thing. which is ooogly, but oh well.","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"5bfc26e468d31be069e37d7a52af9d5a503d7279","unresolved":false,"context_lines":[{"line_number":288,"context_line":"    return req.response"},{"line_number":289,"context_line":""},{"line_number":290,"context_line":""},{"line_number":291,"context_line":"@wsgi_wrapper.PlacementWsgify  # noqa"},{"line_number":292,"context_line":"@microversion.version_handler(\u00271.8\u0027)"},{"line_number":293,"context_line":"@util.require_content(\u0027application/json\u0027)"},{"line_number":294,"context_line":"def set_allocations(req):"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_a852b139","line":291,"in_reply_to":"df140735_b4710247","updated":"2017-06-03 16:35:53.000000000","message":"Actually, I don\u0027t think there\u0027s a reason to have a completely different method for this. I\u0027m pushing an alternate that uses the same method and just handles project and user ID validation if microversion \u003e\u003d 1.8","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"ca4c18fbd582f50498db65f7265c7204157ea6cd","unresolved":false,"context_lines":[{"line_number":269,"context_line":"        objects\u003dallocation_objects,"},{"line_number":270,"context_line":"        project_id\u003ddata.get(\u0027project_id\u0027),"},{"line_number":271,"context_line":"        user_id\u003ddata.get(\u0027user_id\u0027),"},{"line_number":272,"context_line":"    )"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":"    try:"},{"line_number":275,"context_line":"        allocations.create_all()"}],"source_content_type":"text/x-python","patch_set":11,"id":"df140735_3401edb0","line":272,"updated":"2017-06-07 16:16:53.000000000","message":"So if I\u0027m calling with 1.7, the project/user fields are None in the table, right? I guess that makes sense and we let the computes heal this data over time.","commit_id":"4a1619935311ab6b8323d3d874185a9b07011e3f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f367f20892863e48ec74ff9a89fd3b561120f208","unresolved":false,"context_lines":[{"line_number":269,"context_line":"        objects\u003dallocation_objects,"},{"line_number":270,"context_line":"        project_id\u003ddata.get(\u0027project_id\u0027),"},{"line_number":271,"context_line":"        user_id\u003ddata.get(\u0027user_id\u0027),"},{"line_number":272,"context_line":"    )"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":"    try:"},{"line_number":275,"context_line":"        allocations.create_all()"}],"source_content_type":"text/x-python","patch_set":11,"id":"df140735_d297613a","line":272,"in_reply_to":"df140735_3401edb0","updated":"2017-06-07 17:21:10.000000000","message":"Looks like it, yeah. Before Jay\u0027s changes, I had it only writing consumer/project_id/user_id if both project_id and user_id were not None, to avoid writing any None values. But it might be fine to let it write None and be healed by computes.","commit_id":"4a1619935311ab6b8323d3d874185a9b07011e3f"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"634319149c47191e32c524cc5ecd1ef14f8d8835","unresolved":false,"context_lines":[{"line_number":269,"context_line":"        objects\u003dallocation_objects,"},{"line_number":270,"context_line":"        project_id\u003ddata.get(\u0027project_id\u0027),"},{"line_number":271,"context_line":"        user_id\u003ddata.get(\u0027user_id\u0027),"},{"line_number":272,"context_line":"    )"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":"    try:"},{"line_number":275,"context_line":"        allocations.create_all()"}],"source_content_type":"text/x-python","patch_set":11,"id":"df140735_0326a8b8","line":272,"in_reply_to":"df140735_d297613a","updated":"2017-06-07 18:50:29.000000000","message":"I think it\u0027ll end up as NULL in the DB if you don\u0027t provide it here anyway, so probably the same difference I\u0027d guess.","commit_id":"4a1619935311ab6b8323d3d874185a9b07011e3f"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"a260e1676e34b4c63d9e7774df03ac9c6bdd1040","unresolved":false,"context_lines":[{"line_number":232,"context_line":"def set_allocations(req):"},{"line_number":233,"context_line":"    context \u003d req.environ[\u0027placement.context\u0027]"},{"line_number":234,"context_line":"    consumer_uuid \u003d util.wsgi_path_item(req.environ, \u0027consumer_uuid\u0027)"},{"line_number":235,"context_line":"    want_version \u003d req.environ[microversion.MICROVERSION_ENVIRON]"},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"    schema \u003d ALLOCATION_SCHEMA"},{"line_number":238,"context_line":"    if want_version \u003e\u003d (1, 8):"}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_4c5cb57d","line":235,"range":{"start_line":235,"start_character":19,"end_line":235,"end_character":65},"updated":"2017-06-13 10:05:51.000000000","message":"Well, we already have a microversion version_handler decorator for that.\n\nHonestly, I\u0027d like to use it given we would be having the same Proxy design pattern for all the microversions so in case we would find an issue with that proxy, it would fix all the handlers.","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"de6ffcc8e78036ecc947ecb98e337e40fe5274d5","unresolved":false,"context_lines":[{"line_number":232,"context_line":"def set_allocations(req):"},{"line_number":233,"context_line":"    context \u003d req.environ[\u0027placement.context\u0027]"},{"line_number":234,"context_line":"    consumer_uuid \u003d util.wsgi_path_item(req.environ, \u0027consumer_uuid\u0027)"},{"line_number":235,"context_line":"    want_version \u003d req.environ[microversion.MICROVERSION_ENVIRON]"},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"    schema \u003d ALLOCATION_SCHEMA"},{"line_number":238,"context_line":"    if want_version \u003e\u003d (1, 8):"}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_0033ea15","line":235,"range":{"start_line":235,"start_character":19,"end_line":235,"end_character":65},"in_reply_to":"7f231b9d_4c5cb57d","updated":"2017-06-14 16:31:49.000000000","message":"Done","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"1ba06a86960447c56a698c5dfb7acd25985ae649","unresolved":false,"context_lines":[{"line_number":232,"context_line":"def set_allocations(req):"},{"line_number":233,"context_line":"    context \u003d req.environ[\u0027placement.context\u0027]"},{"line_number":234,"context_line":"    consumer_uuid \u003d util.wsgi_path_item(req.environ, \u0027consumer_uuid\u0027)"},{"line_number":235,"context_line":"    want_version \u003d req.environ[microversion.MICROVERSION_ENVIRON]"},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"    schema \u003d ALLOCATION_SCHEMA"},{"line_number":238,"context_line":"    if want_version \u003e\u003d (1, 8):"}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_d2e61e45","line":235,"range":{"start_line":235,"start_character":19,"end_line":235,"end_character":65},"in_reply_to":"7f231b9d_4c5cb57d","updated":"2017-06-13 10:24:25.000000000","message":"Humpf, we have other places where we directly verify the envvar there instead of using the decorator, so well, as you want...\n\nhttps://github.com/openstack/nova/blob/72960a33e094f74de76f23d75dbaaae07332fa6f/nova/api/openstack/placement/handlers/resource_provider.py#L263","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"10b12f890e17dbdec31df539ee890cbaee5ac18a","unresolved":false,"context_lines":[{"line_number":232,"context_line":"def set_allocations(req):"},{"line_number":233,"context_line":"    context \u003d req.environ[\u0027placement.context\u0027]"},{"line_number":234,"context_line":"    consumer_uuid \u003d util.wsgi_path_item(req.environ, \u0027consumer_uuid\u0027)"},{"line_number":235,"context_line":"    want_version \u003d req.environ[microversion.MICROVERSION_ENVIRON]"},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"    schema \u003d ALLOCATION_SCHEMA"},{"line_number":238,"context_line":"    if want_version \u003e\u003d (1, 8):"}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_cc7b1abc","line":235,"range":{"start_line":235,"start_character":19,"end_line":235,"end_character":65},"in_reply_to":"7f231b9d_d2e61e45","updated":"2017-06-13 14:43:19.000000000","message":"That\u0027s because that code predates the addition of the microversion version_handler() stuff and I copy/pasted from there :) Sorry about that. Can fix in a future pathc?","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"b8d36aef7f0049e6c654cdfb31f73c6f37a897db","unresolved":false,"context_lines":[{"line_number":282,"context_line":"@microversion.version_handler(\u00271.8\u0027)"},{"line_number":283,"context_line":"@util.require_content(\u0027application/json\u0027)"},{"line_number":284,"context_line":"def set_allocations(req):"},{"line_number":285,"context_line":"    return _set_allocations(req, ALLOCATION_SCHEMA_V1_8)"},{"line_number":286,"context_line":""},{"line_number":287,"context_line":""},{"line_number":288,"context_line":"@wsgi_wrapper.PlacementWsgify"}],"source_content_type":"text/x-python","patch_set":18,"id":"7f231b9d_6020f49b","line":285,"updated":"2017-06-19 10:14:47.000000000","message":"thanks for that","commit_id":"a909673682cdd8f02ef0ae5e8c6f061640e320ff"}],"nova/api/openstack/placement/microversion.py":[{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"a260e1676e34b4c63d9e7774df03ac9c6bdd1040","unresolved":false,"context_lines":[{"line_number":236,"context_line":"    raise webob.exc.HTTPNotFound()"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":""},{"line_number":239,"context_line":"def version_handler(min_ver, max_ver\u003dNone):"},{"line_number":240,"context_line":"    \"\"\"Decorator for versioning API methods."},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"    Add as a decorator to a placement API handler to constrain"}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_cf91d79b","line":239,"updated":"2017-06-13 10:05:51.000000000","message":"I\u0027m talking of that.","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"}],"nova/objects/resource_provider.py":[{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"5947086009be7e1e42b7751c2cddc85299bfe9b3","unresolved":false,"context_lines":[{"line_number":1334,"context_line":"                                project_id\u003dproject_id,"},{"line_number":1335,"context_line":"                                user_id\u003duser_id))"},{"line_number":1336,"context_line":"                        except db_exc.DBDuplicateEntry:"},{"line_number":1337,"context_line":"                            pass"},{"line_number":1338,"context_line":""},{"line_number":1339,"context_line":"            # Generation checking happens here. If the inventory for"},{"line_number":1340,"context_line":"            # this resource provider changed out from under us,"}],"source_content_type":"text/x-python","patch_set":1,"id":"df140735_e3db82ea","line":1337,"updated":"2017-05-31 21:51:41.000000000","message":"Is the first select to check for existence necessary? Couldn\u0027t you just do the insert, since if it exists, a DBDuplicateEntry will be caught and ignored?","commit_id":"fb83dd4dec5599d873236ae071a8f464d0e8bb6c"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"7d4b6346705e7115db0da4b6c6bae0141d5fd2e2","unresolved":false,"context_lines":[{"line_number":1334,"context_line":"                                project_id\u003dproject_id,"},{"line_number":1335,"context_line":"                                user_id\u003duser_id))"},{"line_number":1336,"context_line":"                        except db_exc.DBDuplicateEntry:"},{"line_number":1337,"context_line":"                            pass"},{"line_number":1338,"context_line":""},{"line_number":1339,"context_line":"            # Generation checking happens here. If the inventory for"},{"line_number":1340,"context_line":"            # this resource provider changed out from under us,"}],"source_content_type":"text/x-python","patch_set":1,"id":"df140735_431eae70","line":1337,"in_reply_to":"df140735_e3db82ea","updated":"2017-05-31 22:07:28.000000000","message":"Right, I meant to put a comment here asking whether it should just go ahead and try the insert every time?\n\nI was thinking, if we have to try a consumer record insert per allocation, there might be a lot of duplicates. That is, DBDuplicateEntry might be a really common thing and I was concerned about trying something that will be commonly rejected (wastefully) in write mode vs checking for existence first in read mode. For a set of allocations, I wasn\u0027t sure if they would often be for the same consumer, for example.\n\nI\u0027m ready to change this to what the consensus ends up being.","commit_id":"fb83dd4dec5599d873236ae071a8f464d0e8bb6c"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"69f865ed32f50c04fca203de4149bab4ca0dc95c","unresolved":false,"context_lines":[{"line_number":1595,"context_line":"    VERSION \u003d \u00271.3\u0027"},{"line_number":1596,"context_line":""},{"line_number":1597,"context_line":"    fields \u003d {"},{"line_number":1598,"context_line":"        \u0027objects\u0027: fields.ListOfObjectsField(\u0027Allocation\u0027),"},{"line_number":1599,"context_line":"    }"},{"line_number":1600,"context_line":""},{"line_number":1601,"context_line":"    @staticmethod"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_a80cf1a4","line":1598,"updated":"2017-06-03 15:41:29.000000000","message":"How about adding project_id and user_id to AllocationList as fields?","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"31184d6ffce454124d09e10649e3e4631e2fa5dd","unresolved":false,"context_lines":[{"line_number":1669,"context_line":"                result \u003d conn.execute(ins_stmt)"},{"line_number":1670,"context_line":"                alloc.id \u003d result.lastrowid"},{"line_number":1671,"context_line":""},{"line_number":1672,"context_line":"                if project_id and user_id:"},{"line_number":1673,"context_line":"                    # Add the consumer if it doesn\u0027t already exist"},{"line_number":1674,"context_line":"                    sel_stmt \u003d sa.select([_CONSUMER_TBL.c.uuid]).where("},{"line_number":1675,"context_line":"                        _CONSUMER_TBL.c.uuid \u003d\u003d alloc.consumer_id)"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_08fbdd46","line":1672,"updated":"2017-06-03 16:09:41.000000000","message":"The consumer ID, project ID and user ID do not change for each resource iterated here, so there\u0027s only a need to ensure the consumer record exists for the first alloc in allocs...","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"3c636266cb7a652ecf6e8e794a911f85438861cf","unresolved":false,"context_lines":[{"line_number":1681,"context_line":"                                project_id\u003dproject_id,"},{"line_number":1682,"context_line":"                                user_id\u003duser_id))"},{"line_number":1683,"context_line":"                        except db_exc.DBDuplicateEntry:"},{"line_number":1684,"context_line":"                            pass"},{"line_number":1685,"context_line":""},{"line_number":1686,"context_line":"            # Generation checking happens here. If the inventory for"},{"line_number":1687,"context_line":"            # this resource provider changed out from under us,"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_5f32bf5f","line":1684,"updated":"2017-06-02 17:18:49.000000000","message":"I see there was already some discussion on earlier versions about this block of code\n\nAs written this means that it\u0027s never possible for a consumer uuid to be associated with a different user or project (project and user A a time A, project and user B at time B).\n\nFor instances/servers that\u0027s what we would expect. For the life of the instance it\u0027s that user, yeah?\n\nAre there things that can be consumers (and keep the same uuid) which might have different \"owners\" in their lifetime? I think physical stuff in this case, like a way of representing a baremetal instance.\n\nI don\u0027t know the answer to this, but if we imagine that there\u0027s ever a chance, then this needs to be upsert or something of that ilk?\n\nWe can\u0027t really predict what will use the placement service, but we\u0027d like to make sure that every{one,thing} can.\n\n(These are not good thoughts to be trying to express on a friday evening)","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"19bb274c8027575d976cccc55a7216333b3660f9","unresolved":false,"context_lines":[{"line_number":1681,"context_line":"                                project_id\u003dproject_id,"},{"line_number":1682,"context_line":"                                user_id\u003duser_id))"},{"line_number":1683,"context_line":"                        except db_exc.DBDuplicateEntry:"},{"line_number":1684,"context_line":"                            pass"},{"line_number":1685,"context_line":""},{"line_number":1686,"context_line":"            # Generation checking happens here. If the inventory for"},{"line_number":1687,"context_line":"            # this resource provider changed out from under us,"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_9a8bc51d","line":1684,"in_reply_to":"df140735_5f32bf5f","updated":"2017-06-02 17:33:42.000000000","message":"Hm, yeah, I had assumed (for no real reason) that a consumer can\u0027t change project/user once created. Maybe it makes more sense for this to be an upsert like you said, because basically we want to stay synced with allocations, I think. I guess I\u0027m not sure.","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"4f38c003af2712e17939914fa8e0e3e85cfe1567","unresolved":false,"context_lines":[{"line_number":1588,"context_line":"    return list(res_providers.values())"},{"line_number":1589,"context_line":""},{"line_number":1590,"context_line":""},{"line_number":1591,"context_line":"def _ensure_lookup(conn, tbl, external_id):"},{"line_number":1592,"context_line":"    \"\"\"Ensures the supplied external project ID exists in the projects lookup"},{"line_number":1593,"context_line":"    table and if not, adds it. Returns the internal project ID."},{"line_number":1594,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_9453826b","line":1591,"updated":"2017-06-04 20:48:07.000000000","message":"this is a confusing name","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"1d3c11853156669083d3fc276f2ef595641fb6d0","unresolved":false,"context_lines":[{"line_number":1588,"context_line":"    return list(res_providers.values())"},{"line_number":1589,"context_line":""},{"line_number":1590,"context_line":""},{"line_number":1591,"context_line":"def _ensure_lookup(conn, tbl, external_id):"},{"line_number":1592,"context_line":"    \"\"\"Ensures the supplied external project ID exists in the projects lookup"},{"line_number":1593,"context_line":"    table and if not, adds it. Returns the internal project ID."},{"line_number":1594,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_d79a1c60","line":1591,"in_reply_to":"df140735_9453826b","updated":"2017-06-04 23:26:20.000000000","message":"Done","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"4f38c003af2712e17939914fa8e0e3e85cfe1567","unresolved":false,"context_lines":[{"line_number":1590,"context_line":""},{"line_number":1591,"context_line":"def _ensure_lookup(conn, tbl, external_id):"},{"line_number":1592,"context_line":"    \"\"\"Ensures the supplied external project ID exists in the projects lookup"},{"line_number":1593,"context_line":"    table and if not, adds it. Returns the internal project ID."},{"line_number":1594,"context_line":""},{"line_number":1595,"context_line":"    :param conn: DB connection object to use"},{"line_number":1596,"context_line":"    :param external_id: The Keystone string project identifier"}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_b458c687","line":1593,"updated":"2017-06-04 20:48:07.000000000","message":"Wrong docstring for the generic query","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"1d3c11853156669083d3fc276f2ef595641fb6d0","unresolved":false,"context_lines":[{"line_number":1590,"context_line":""},{"line_number":1591,"context_line":"def _ensure_lookup(conn, tbl, external_id):"},{"line_number":1592,"context_line":"    \"\"\"Ensures the supplied external project ID exists in the projects lookup"},{"line_number":1593,"context_line":"    table and if not, adds it. Returns the internal project ID."},{"line_number":1594,"context_line":""},{"line_number":1595,"context_line":"    :param conn: DB connection object to use"},{"line_number":1596,"context_line":"    :param external_id: The Keystone string project identifier"}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_b7a568a4","line":1593,"in_reply_to":"df140735_b458c687","updated":"2017-06-04 23:26:20.000000000","message":"Done","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"4f38c003af2712e17939914fa8e0e3e85cfe1567","unresolved":false,"context_lines":[{"line_number":1593,"context_line":"    table and if not, adds it. Returns the internal project ID."},{"line_number":1594,"context_line":""},{"line_number":1595,"context_line":"    :param conn: DB connection object to use"},{"line_number":1596,"context_line":"    :param external_id: The Keystone string project identifier"},{"line_number":1597,"context_line":"    \"\"\""},{"line_number":1598,"context_line":"    # Grab the project internal ID if it exists in the projects table"},{"line_number":1599,"context_line":"    sel \u003d sa.select([tbl.c.id]).where("}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_744eaec1","line":1596,"updated":"2017-06-04 20:48:07.000000000","message":"project or user","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"4f38c003af2712e17939914fa8e0e3e85cfe1567","unresolved":false,"context_lines":[{"line_number":1595,"context_line":"    :param conn: DB connection object to use"},{"line_number":1596,"context_line":"    :param external_id: The Keystone string project identifier"},{"line_number":1597,"context_line":"    \"\"\""},{"line_number":1598,"context_line":"    # Grab the project internal ID if it exists in the projects table"},{"line_number":1599,"context_line":"    sel \u003d sa.select([tbl.c.id]).where("},{"line_number":1600,"context_line":"        tbl.c.external_id \u003d\u003d external_id"},{"line_number":1601,"context_line":"    )"}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_34ca761a","line":1598,"updated":"2017-06-04 20:48:07.000000000","message":"project or user","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"1d3c11853156669083d3fc276f2ef595641fb6d0","unresolved":false,"context_lines":[{"line_number":1595,"context_line":"    :param conn: DB connection object to use"},{"line_number":1596,"context_line":"    :param external_id: The Keystone string project identifier"},{"line_number":1597,"context_line":"    \"\"\""},{"line_number":1598,"context_line":"    # Grab the project internal ID if it exists in the projects table"},{"line_number":1599,"context_line":"    sel \u003d sa.select([tbl.c.id]).where("},{"line_number":1600,"context_line":"        tbl.c.external_id \u003d\u003d external_id"},{"line_number":1601,"context_line":"    )"}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_97a02492","line":1598,"in_reply_to":"df140735_34ca761a","updated":"2017-06-04 23:26:20.000000000","message":"Done","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"4f38c003af2712e17939914fa8e0e3e85cfe1567","unresolved":false,"context_lines":[{"line_number":1684,"context_line":"            # Grab the user internal ID if it exists in the users table"},{"line_number":1685,"context_line":"            uid \u003d _ensure_user(conn, self.user_id)"},{"line_number":1686,"context_line":""},{"line_number":1687,"context_line":"            # Add the consumer if it doesn\u0027t already exist"},{"line_number":1688,"context_line":"            sel_stmt \u003d sa.select([_CONSUMER_TBL.c.uuid]).where("},{"line_number":1689,"context_line":"                _CONSUMER_TBL.c.uuid \u003d\u003d consumer_id)"},{"line_number":1690,"context_line":"            result \u003d conn.execute(sel_stmt).fetchall()"}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_74e34ea5","line":1687,"updated":"2017-06-04 20:48:07.000000000","message":"My comments from ps3 about whether or not a consumer can ever have a different pid or uid still apply here. As written there can never be a consuer id which is used by different users. That feels unsafe. More details in my comments on ps3","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"624ca3761f4f379f1dc6cf649835d351330e59af","unresolved":false,"context_lines":[{"line_number":1684,"context_line":"            # Grab the user internal ID if it exists in the users table"},{"line_number":1685,"context_line":"            uid \u003d _ensure_user(conn, self.user_id)"},{"line_number":1686,"context_line":""},{"line_number":1687,"context_line":"            # Add the consumer if it doesn\u0027t already exist"},{"line_number":1688,"context_line":"            sel_stmt \u003d sa.select([_CONSUMER_TBL.c.uuid]).where("},{"line_number":1689,"context_line":"                _CONSUMER_TBL.c.uuid \u003d\u003d consumer_id)"},{"line_number":1690,"context_line":"            result \u003d conn.execute(sel_stmt).fetchall()"}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_a2d03f55","line":1687,"in_reply_to":"df140735_4e6e2fca","updated":"2017-06-06 21:06:54.000000000","message":"The thing is, though, at the API level we have zero control over what a consumer_uuid is or whether it is used again. It is only an arbitrary identifier and nothing else (yet) prevents it from being used again.\n\nSo some other system can come along and re-use consumer uuids even if nova does not. Would it be stupid to do so, probably, but it is currently possible so we need some form of defense.","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"1d3c11853156669083d3fc276f2ef595641fb6d0","unresolved":false,"context_lines":[{"line_number":1684,"context_line":"            # Grab the user internal ID if it exists in the users table"},{"line_number":1685,"context_line":"            uid \u003d _ensure_user(conn, self.user_id)"},{"line_number":1686,"context_line":""},{"line_number":1687,"context_line":"            # Add the consumer if it doesn\u0027t already exist"},{"line_number":1688,"context_line":"            sel_stmt \u003d sa.select([_CONSUMER_TBL.c.uuid]).where("},{"line_number":1689,"context_line":"                _CONSUMER_TBL.c.uuid \u003d\u003d consumer_id)"},{"line_number":1690,"context_line":"            result \u003d conn.execute(sel_stmt).fetchall()"}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_f7976039","line":1687,"in_reply_to":"df140735_74e34ea5","updated":"2017-06-04 23:26:20.000000000","message":"Well, until instances, volumes, or networks can be owned by \u003e1 project, this is correct. How about we handle that case when/if we ever get to it?","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"bee25748aeef1d85704b9364832c80020aa7eecf","unresolved":false,"context_lines":[{"line_number":1684,"context_line":"            # Grab the user internal ID if it exists in the users table"},{"line_number":1685,"context_line":"            uid \u003d _ensure_user(conn, self.user_id)"},{"line_number":1686,"context_line":""},{"line_number":1687,"context_line":"            # Add the consumer if it doesn\u0027t already exist"},{"line_number":1688,"context_line":"            sel_stmt \u003d sa.select([_CONSUMER_TBL.c.uuid]).where("},{"line_number":1689,"context_line":"                _CONSUMER_TBL.c.uuid \u003d\u003d consumer_id)"},{"line_number":1690,"context_line":"            result \u003d conn.execute(sel_stmt).fetchall()"}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_4e6e2fca","line":1687,"in_reply_to":"df140735_7d7a0aba","updated":"2017-06-06 20:21:33.000000000","message":"I think my concern with the idea of a long lived id is the possibility of orphaning another project/user. For example, if Alloc1 gives consumer_id\u003d1 with project\u003d\u0027foo\u0027 and user\u003d\u0027bar\u0027, then Alloc2 comes along and gives consumer_id\u003d1 with project\u003d\u0027baz\u0027 and user\u003d\u0027bob\u0027, then Alloc1 has just changed owners completely.\n\nIt\u0027s hard to think about this without knowing exactly what a \u0027consumer\u0027 could be. I keep thinking about it as an entity that is owned by a project and user. And that a project/user combo can have more than one consumer_id but not the other way around. And that new Allocations shouldn\u0027t change the owners of existing Allocations. But again, maybe I\u0027m missing some other possible use of \u0027consumer\u0027.","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"2157ffed49e6fac748eaaed48f4444f0f6098a25","unresolved":false,"context_lines":[{"line_number":1684,"context_line":"            # Grab the user internal ID if it exists in the users table"},{"line_number":1685,"context_line":"            uid \u003d _ensure_user(conn, self.user_id)"},{"line_number":1686,"context_line":""},{"line_number":1687,"context_line":"            # Add the consumer if it doesn\u0027t already exist"},{"line_number":1688,"context_line":"            sel_stmt \u003d sa.select([_CONSUMER_TBL.c.uuid]).where("},{"line_number":1689,"context_line":"                _CONSUMER_TBL.c.uuid \u003d\u003d consumer_id)"},{"line_number":1690,"context_line":"            result \u003d conn.execute(sel_stmt).fetchall()"}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_ded53045","line":1687,"in_reply_to":"df140735_a2d03f55","updated":"2017-06-07 15:26:49.000000000","message":"Perhaps in the future, Chris, but at this point I\u0027m just not concerned about this.","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"5293f203c66afb0239b3ef79e75a61ea87dbc637","unresolved":false,"context_lines":[{"line_number":1684,"context_line":"            # Grab the user internal ID if it exists in the users table"},{"line_number":1685,"context_line":"            uid \u003d _ensure_user(conn, self.user_id)"},{"line_number":1686,"context_line":""},{"line_number":1687,"context_line":"            # Add the consumer if it doesn\u0027t already exist"},{"line_number":1688,"context_line":"            sel_stmt \u003d sa.select([_CONSUMER_TBL.c.uuid]).where("},{"line_number":1689,"context_line":"                _CONSUMER_TBL.c.uuid \u003d\u003d consumer_id)"},{"line_number":1690,"context_line":"            result \u003d conn.execute(sel_stmt).fetchall()"}],"source_content_type":"text/x-python","patch_set":5,"id":"bf091321_d80e8d31","line":1687,"in_reply_to":"df140735_ded53045","updated":"2017-06-07 20:06:22.000000000","message":"The fact that consumer ids are UUIDs means that the only way there could be a problem is not only if a service re-uses consumer uuids, but re-uses them for a different project. So I would say that a) we need to document that this is not a good thing to do, and b) we could add code to check for an existing consumer_uuid that has a different project_id, and raise a 409 in that case.","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"ecc2ad3230e14e76e2db701d44264be093326432","unresolved":false,"context_lines":[{"line_number":1684,"context_line":"            # Grab the user internal ID if it exists in the users table"},{"line_number":1685,"context_line":"            uid \u003d _ensure_user(conn, self.user_id)"},{"line_number":1686,"context_line":""},{"line_number":1687,"context_line":"            # Add the consumer if it doesn\u0027t already exist"},{"line_number":1688,"context_line":"            sel_stmt \u003d sa.select([_CONSUMER_TBL.c.uuid]).where("},{"line_number":1689,"context_line":"                _CONSUMER_TBL.c.uuid \u003d\u003d consumer_id)"},{"line_number":1690,"context_line":"            result \u003d conn.execute(sel_stmt).fetchall()"}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_7d7a0aba","line":1687,"in_reply_to":"df140735_f7976039","updated":"2017-06-05 08:03:22.000000000","message":"That\u0027s not quite the concern. The concern is whether any arbitrary consumer can have a long lived id that would have a different project and/or user associated at a second or later allocation.\n\nArbitrary in the sense of something we haven\u0027t planned for yet and in the sense of a consumer id can represent _anything_ and an allocation can be against arbitrary (in both sense) resource providers.\n\nI agree that this is likely something we can deal with later, but a note of some kind might be handy so that we aren\u0027t surprised when we have incorrect usages  because a consumer uuid was long lived.","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"bee25748aeef1d85704b9364832c80020aa7eecf","unresolved":false,"context_lines":[{"line_number":1733,"context_line":"            # First delete any existing allocations for that rp/consumer combo."},{"line_number":1734,"context_line":"            _delete_current_allocs(conn, allocs)"},{"line_number":1735,"context_line":"            before_gens \u003d _check_capacity_exceeded(conn, allocs)"},{"line_number":1736,"context_line":"            self._ensure_consumer_project_user(conn, allocs[0].consumer_id)"},{"line_number":1737,"context_line":"            # Now add the allocations that were passed in."},{"line_number":1738,"context_line":"            for alloc in allocs:"},{"line_number":1739,"context_line":"                rp \u003d alloc.resource_provider"}],"source_content_type":"text/x-python","patch_set":5,"id":"df140735_0eadd7e9","line":1736,"updated":"2017-06-06 20:21:33.000000000","message":"Question: I was just thinking, we write consumers here. What about deleting consumers? Should we do something like, when _delete_allocations, if the consumer is no longer associated with any allocations, delete the consumer?","commit_id":"de1d6b42f69f5ff7abb14ba92ddf2c67ab45cc41"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"e218500011dc92fcf69adcff46eec40b74f46616","unresolved":false,"context_lines":[{"line_number":1733,"context_line":"            # First delete any existing allocations for that rp/consumer combo."},{"line_number":1734,"context_line":"            _delete_current_allocs(conn, allocs)"},{"line_number":1735,"context_line":"            before_gens \u003d _check_capacity_exceeded(conn, allocs)"},{"line_number":1736,"context_line":"            self._ensure_consumer_project_user(conn, allocs[0].consumer_id)"},{"line_number":1737,"context_line":"            # Now add the allocations that were passed in."},{"line_number":1738,"context_line":"            for alloc in allocs:"},{"line_number":1739,"context_line":"                rp \u003d alloc.resource_provider"}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_ae16ebf0","line":1736,"range":{"start_line":1736,"start_character":53,"end_line":1736,"end_character":62},"updated":"2017-06-06 20:36:38.000000000","message":"Just wanted to note here that this is a bit dangerous considering each Allocation object can specify its own consumer_id that is different and if that happens, those usages will not be findable by the \"get by project/user\" API. So we\u0027re relying on ourselves to never call _set_allocations() with Allocations that have differing consumer_id.","commit_id":"642d58cad6b97fc27dd7555cbd990f0aacb0c857"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"0020e071deeb352577ac7c9ebafa356853160bcd","unresolved":false,"context_lines":[{"line_number":1733,"context_line":"            # First delete any existing allocations for that rp/consumer combo."},{"line_number":1734,"context_line":"            _delete_current_allocs(conn, allocs)"},{"line_number":1735,"context_line":"            before_gens \u003d _check_capacity_exceeded(conn, allocs)"},{"line_number":1736,"context_line":"            self._ensure_consumer_project_user(conn, allocs[0].consumer_id)"},{"line_number":1737,"context_line":"            # Now add the allocations that were passed in."},{"line_number":1738,"context_line":"            for alloc in allocs:"},{"line_number":1739,"context_line":"                rp \u003d alloc.resource_provider"}],"source_content_type":"text/x-python","patch_set":10,"id":"9f0e0f27_f90eea30","line":1736,"range":{"start_line":1736,"start_character":53,"end_line":1736,"end_character":62},"in_reply_to":"9f0e0f27_d64775bc","updated":"2017-06-09 13:44:44.000000000","message":"Uhm, we don\u0027t allow setting allocations for \u003e1 consumer. So... no, that\u0027s not what I think we should do.","commit_id":"642d58cad6b97fc27dd7555cbd990f0aacb0c857"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"caa1286233813cd6fb65a78379a46f235da7d0a2","unresolved":false,"context_lines":[{"line_number":1733,"context_line":"            # First delete any existing allocations for that rp/consumer combo."},{"line_number":1734,"context_line":"            _delete_current_allocs(conn, allocs)"},{"line_number":1735,"context_line":"            before_gens \u003d _check_capacity_exceeded(conn, allocs)"},{"line_number":1736,"context_line":"            self._ensure_consumer_project_user(conn, allocs[0].consumer_id)"},{"line_number":1737,"context_line":"            # Now add the allocations that were passed in."},{"line_number":1738,"context_line":"            for alloc in allocs:"},{"line_number":1739,"context_line":"                rp \u003d alloc.resource_provider"}],"source_content_type":"text/x-python","patch_set":10,"id":"9f0e0f27_d64775bc","line":1736,"range":{"start_line":1736,"start_character":53,"end_line":1736,"end_character":62},"in_reply_to":"9f0e0f27_e3c87d75","updated":"2017-06-09 13:32:40.000000000","message":"So you\u0027re proposing changing the object model for Allocations? Isn\u0027t that a bit drastic? Wouldn\u0027t the simpler solution be to run `self._ensure_consumer_project_user()` on the set of consumer_ids for the given allocations?","commit_id":"642d58cad6b97fc27dd7555cbd990f0aacb0c857"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"232a4c59452378621fdc4a2cda3054d6417c17a5","unresolved":false,"context_lines":[{"line_number":1733,"context_line":"            # First delete any existing allocations for that rp/consumer combo."},{"line_number":1734,"context_line":"            _delete_current_allocs(conn, allocs)"},{"line_number":1735,"context_line":"            before_gens \u003d _check_capacity_exceeded(conn, allocs)"},{"line_number":1736,"context_line":"            self._ensure_consumer_project_user(conn, allocs[0].consumer_id)"},{"line_number":1737,"context_line":"            # Now add the allocations that were passed in."},{"line_number":1738,"context_line":"            for alloc in allocs:"},{"line_number":1739,"context_line":"                rp \u003d alloc.resource_provider"}],"source_content_type":"text/x-python","patch_set":10,"id":"9f0e0f27_e3c87d75","line":1736,"range":{"start_line":1736,"start_character":53,"end_line":1736,"end_character":62},"in_reply_to":"df140735_81f759d5","updated":"2017-06-09 12:42:41.000000000","message":"We should have an Allocation object that has the project, user, and consumer UUIDs and a collection of AllocationRecord objects that contain the resources associated with the providers in that allocation.","commit_id":"642d58cad6b97fc27dd7555cbd990f0aacb0c857"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"5832001cc03f4727416293b033e755faaadcff80","unresolved":false,"context_lines":[{"line_number":1733,"context_line":"            # First delete any existing allocations for that rp/consumer combo."},{"line_number":1734,"context_line":"            _delete_current_allocs(conn, allocs)"},{"line_number":1735,"context_line":"            before_gens \u003d _check_capacity_exceeded(conn, allocs)"},{"line_number":1736,"context_line":"            self._ensure_consumer_project_user(conn, allocs[0].consumer_id)"},{"line_number":1737,"context_line":"            # Now add the allocations that were passed in."},{"line_number":1738,"context_line":"            for alloc in allocs:"},{"line_number":1739,"context_line":"                rp \u003d alloc.resource_provider"}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_be827cff","line":1736,"range":{"start_line":1736,"start_character":53,"end_line":1736,"end_character":62},"in_reply_to":"df140735_ae16ebf0","updated":"2017-06-07 15:33:50.000000000","message":"Agreed. We should actually remove the damn consumer_id field from the Allocation object entirely and only have it on the AllocationList object.","commit_id":"642d58cad6b97fc27dd7555cbd990f0aacb0c857"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"e591591917556e678f1ea5e6ac48bd2dbe29a79c","unresolved":false,"context_lines":[{"line_number":1733,"context_line":"            # First delete any existing allocations for that rp/consumer combo."},{"line_number":1734,"context_line":"            _delete_current_allocs(conn, allocs)"},{"line_number":1735,"context_line":"            before_gens \u003d _check_capacity_exceeded(conn, allocs)"},{"line_number":1736,"context_line":"            self._ensure_consumer_project_user(conn, allocs[0].consumer_id)"},{"line_number":1737,"context_line":"            # Now add the allocations that were passed in."},{"line_number":1738,"context_line":"            for alloc in allocs:"},{"line_number":1739,"context_line":"                rp \u003d alloc.resource_provider"}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_81f759d5","line":1736,"range":{"start_line":1736,"start_character":53,"end_line":1736,"end_character":62},"in_reply_to":"df140735_be827cff","updated":"2017-06-07 20:07:18.000000000","message":"There is no requirement that an AllocationList only contain allocations for the same consumer_id. How would that work for the result of AllocationList.get_all_by_resource_provider_uuid()?","commit_id":"642d58cad6b97fc27dd7555cbd990f0aacb0c857"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"ca4c18fbd582f50498db65f7265c7204157ea6cd","unresolved":false,"context_lines":[{"line_number":1763,"context_line":"                        project_id\u003dpid,"},{"line_number":1764,"context_line":"                        user_id\u003duid))"},{"line_number":1765,"context_line":"                except db_exc.DBDuplicateEntry:"},{"line_number":1766,"context_line":"                    pass"},{"line_number":1767,"context_line":""},{"line_number":1768,"context_line":"    @db_api.api_context_manager.writer"},{"line_number":1769,"context_line":"    def _set_allocations(self, context, allocs):"}],"source_content_type":"text/x-python","patch_set":11,"id":"df140735_9481d94d","line":1766,"updated":"2017-06-07 16:16:53.000000000","message":"I guess this assumes that our racing thread peer had the same idea about our user/project. Probably a safe assumption :)","commit_id":"4a1619935311ab6b8323d3d874185a9b07011e3f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f367f20892863e48ec74ff9a89fd3b561120f208","unresolved":false,"context_lines":[{"line_number":1763,"context_line":"                        project_id\u003dpid,"},{"line_number":1764,"context_line":"                        user_id\u003duid))"},{"line_number":1765,"context_line":"                except db_exc.DBDuplicateEntry:"},{"line_number":1766,"context_line":"                    pass"},{"line_number":1767,"context_line":""},{"line_number":1768,"context_line":"    @db_api.api_context_manager.writer"},{"line_number":1769,"context_line":"    def _set_allocations(self, context, allocs):"}],"source_content_type":"text/x-python","patch_set":11,"id":"df140735_d233e161","line":1766,"in_reply_to":"df140735_9481d94d","updated":"2017-06-07 17:21:10.000000000","message":"Yeah, in earlier PS we were discussing checking for existence first vs just going ahead and trying the insert and passing on DuplicateEntry. I had been thinking duplicate consumers might be quite common, so I was thinking not to create contention by trying to write every time and instead read first. Still can race so handle the possibility of DuplicateEntry.\n\nAs mentioned in the earlier PS, I\u0027m happy to change it to always try a write instead of reading first, depending on what people think the access pattern will be.","commit_id":"4a1619935311ab6b8323d3d874185a9b07011e3f"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"a260e1676e34b4c63d9e7774df03ac9c6bdd1040","unresolved":false,"context_lines":[{"line_number":1660,"context_line":"    \"\"\"Ensures the supplied external ID exists in the specified lookup table"},{"line_number":1661,"context_line":"    and if not, adds it. Returns the internal ID."},{"line_number":1662,"context_line":""},{"line_number":1663,"context_line":"    :param conn: DB connection object to use"},{"line_number":1664,"context_line":"    :param external_id: The Keystone string project or user identifier"},{"line_number":1665,"context_line":"    \"\"\""},{"line_number":1666,"context_line":"    # Grab the project internal ID if it exists in the projects table"}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_2f2bab30","line":1663,"updated":"2017-06-13 10:05:51.000000000","message":"you\u0027re missing one docstring arg:\n\n :param tbl: the lookup table to verify","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"de6ffcc8e78036ecc947ecb98e337e40fe5274d5","unresolved":false,"context_lines":[{"line_number":1660,"context_line":"    \"\"\"Ensures the supplied external ID exists in the specified lookup table"},{"line_number":1661,"context_line":"    and if not, adds it. Returns the internal ID."},{"line_number":1662,"context_line":""},{"line_number":1663,"context_line":"    :param conn: DB connection object to use"},{"line_number":1664,"context_line":"    :param external_id: The Keystone string project or user identifier"},{"line_number":1665,"context_line":"    \"\"\""},{"line_number":1666,"context_line":"    # Grab the project internal ID if it exists in the projects table"}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_a03d56de","line":1663,"in_reply_to":"7f231b9d_2f2bab30","updated":"2017-06-14 16:31:49.000000000","message":"Done","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"a260e1676e34b4c63d9e7774df03ac9c6bdd1040","unresolved":false,"context_lines":[{"line_number":1661,"context_line":"    and if not, adds it. Returns the internal ID."},{"line_number":1662,"context_line":""},{"line_number":1663,"context_line":"    :param conn: DB connection object to use"},{"line_number":1664,"context_line":"    :param external_id: The Keystone string project or user identifier"},{"line_number":1665,"context_line":"    \"\"\""},{"line_number":1666,"context_line":"    # Grab the project internal ID if it exists in the projects table"},{"line_number":1667,"context_line":"    sel \u003d sa.select([tbl.c.id]).where("}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_0f746f67","line":1664,"range":{"start_line":1664,"start_character":28,"end_line":1664,"end_character":59},"updated":"2017-06-13 10:05:51.000000000","message":"nit: the docstring makes that helper method dependent of the callers, ie. we would need to modify that docstring if we use another caller or removing one.\n\nRather, I should propose :\n :param external_id: The external identifier for the lookup table","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"de6ffcc8e78036ecc947ecb98e337e40fe5274d5","unresolved":false,"context_lines":[{"line_number":1661,"context_line":"    and if not, adds it. Returns the internal ID."},{"line_number":1662,"context_line":""},{"line_number":1663,"context_line":"    :param conn: DB connection object to use"},{"line_number":1664,"context_line":"    :param external_id: The Keystone string project or user identifier"},{"line_number":1665,"context_line":"    \"\"\""},{"line_number":1666,"context_line":"    # Grab the project internal ID if it exists in the projects table"},{"line_number":1667,"context_line":"    sel \u003d sa.select([tbl.c.id]).where("}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_8026dacd","line":1664,"range":{"start_line":1664,"start_character":28,"end_line":1664,"end_character":59},"in_reply_to":"7f231b9d_0f746f67","updated":"2017-06-14 16:31:49.000000000","message":"Done","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"a260e1676e34b4c63d9e7774df03ac9c6bdd1040","unresolved":false,"context_lines":[{"line_number":1667,"context_line":"    sel \u003d sa.select([tbl.c.id]).where("},{"line_number":1668,"context_line":"        tbl.c.external_id \u003d\u003d external_id"},{"line_number":1669,"context_line":"    )"},{"line_number":1670,"context_line":"    res \u003d conn.execute(sel).fetchall()"},{"line_number":1671,"context_line":"    if not res:"},{"line_number":1672,"context_line":"        try:"},{"line_number":1673,"context_line":"            res \u003d conn.execute(tbl.insert().values(external_id\u003dexternal_id))"}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_6fd6432a","line":1670,"range":{"start_line":1670,"start_character":28,"end_line":1670,"end_character":38},"updated":"2017-06-13 10:05:51.000000000","message":"if you\u0027re always taking the first later, why not use .first() instead ?","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"a260e1676e34b4c63d9e7774df03ac9c6bdd1040","unresolved":false,"context_lines":[{"line_number":1763,"context_line":"                        project_id\u003dpid,"},{"line_number":1764,"context_line":"                        user_id\u003duid))"},{"line_number":1765,"context_line":"                except db_exc.DBDuplicateEntry:"},{"line_number":1766,"context_line":"                    pass"},{"line_number":1767,"context_line":""},{"line_number":1768,"context_line":"    @db_api.api_context_manager.writer"},{"line_number":1769,"context_line":"    def _set_allocations(self, context, allocs):"}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_afa7bba7","line":1766,"updated":"2017-06-13 10:05:51.000000000","message":"nit: a comment explaining it\u0027s fine to pass here because there is no way to have two different consumer requests having the same consumer UUID with different project and user IDs.\n\nI mean, it\u0027s not possible to have two instances having the same UUID so the only reason why we could have a duplicate entry is because it\u0027s the same instance being allocated, so with the same user/project IDs.","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"de6ffcc8e78036ecc947ecb98e337e40fe5274d5","unresolved":false,"context_lines":[{"line_number":1763,"context_line":"                        project_id\u003dpid,"},{"line_number":1764,"context_line":"                        user_id\u003duid))"},{"line_number":1765,"context_line":"                except db_exc.DBDuplicateEntry:"},{"line_number":1766,"context_line":"                    pass"},{"line_number":1767,"context_line":""},{"line_number":1768,"context_line":"    @db_api.api_context_manager.writer"},{"line_number":1769,"context_line":"    def _set_allocations(self, context, allocs):"}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_402c42ab","line":1766,"in_reply_to":"7f231b9d_afa7bba7","updated":"2017-06-14 16:31:49.000000000","message":"Done","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"e5df5df0f64b95b57a5fd84eef7cf4ed70fc2d46","unresolved":false,"context_lines":[{"line_number":1687,"context_line":"    table and if not, adds it. Returns the internal project ID."},{"line_number":1688,"context_line":""},{"line_number":1689,"context_line":"    :param conn: DB connection object to use"},{"line_number":1690,"context_line":"    :param external_id: The external project or user identifier"},{"line_number":1691,"context_line":"    :type external_id: string"},{"line_number":1692,"context_line":"    \"\"\""},{"line_number":1693,"context_line":"    return _ensure_lookup_table_entry(conn, _PROJECT_TBL, external_id)"}],"source_content_type":"text/x-python","patch_set":15,"id":"7f231b9d_7b237357","line":1690,"updated":"2017-06-14 16:40:12.000000000","message":"is project here","commit_id":"725ad278eca5d27c78392e081a17df9c17f54c82"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"2879cf720a0354e26c9d36f0213540cf5651b047","unresolved":false,"context_lines":[{"line_number":1687,"context_line":"    table and if not, adds it. Returns the internal project ID."},{"line_number":1688,"context_line":""},{"line_number":1689,"context_line":"    :param conn: DB connection object to use"},{"line_number":1690,"context_line":"    :param external_id: The external project or user identifier"},{"line_number":1691,"context_line":"    :type external_id: string"},{"line_number":1692,"context_line":"    \"\"\""},{"line_number":1693,"context_line":"    return _ensure_lookup_table_entry(conn, _PROJECT_TBL, external_id)"}],"source_content_type":"text/x-python","patch_set":15,"id":"7f231b9d_9b376f4e","line":1690,"in_reply_to":"7f231b9d_7b237357","updated":"2017-06-14 16:43:57.000000000","message":"I knew I\u0027d mess up a docstring somehow.","commit_id":"725ad278eca5d27c78392e081a17df9c17f54c82"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"e5df5df0f64b95b57a5fd84eef7cf4ed70fc2d46","unresolved":false,"context_lines":[{"line_number":1698,"context_line":"    and if not, adds it. Returns the internal user ID."},{"line_number":1699,"context_line":""},{"line_number":1700,"context_line":"    :param conn: DB connection object to use"},{"line_number":1701,"context_line":"    :param external_id: The external project or user identifier"},{"line_number":1702,"context_line":"    :type external_id: string"},{"line_number":1703,"context_line":"    \"\"\""},{"line_number":1704,"context_line":"    return _ensure_lookup_table_entry(conn, _USER_TBL, external_id)"}],"source_content_type":"text/x-python","patch_set":15,"id":"7f231b9d_3b197b21","line":1701,"updated":"2017-06-14 16:40:12.000000000","message":"is user here","commit_id":"725ad278eca5d27c78392e081a17df9c17f54c82"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"7c5c03c0fdd553439bcc60de421357e31b0e2239","unresolved":false,"context_lines":[{"line_number":1677,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":1678,"context_line":"            # Another thread added it just before us, so just read the"},{"line_number":1679,"context_line":"            # internal ID that that thread created..."},{"line_number":1680,"context_line":"            res \u003d conn.execute(sel).fetchall()"},{"line_number":1681,"context_line":""},{"line_number":1682,"context_line":"    return res[0][0]"},{"line_number":1683,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"5f201791_ce99b06e","line":1680,"range":{"start_line":1680,"start_character":36,"end_line":1680,"end_character":44},"updated":"2017-06-23 20:50:32.000000000","message":"fetchall is weird for something that should only have a single entry, I\u0027d use fetchone() or first() here instead, but it probably doesn\u0027t make a big difference.","commit_id":"a909673682cdd8f02ef0ae5e8c6f061640e320ff"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"7c5c03c0fdd553439bcc60de421357e31b0e2239","unresolved":false,"context_lines":[{"line_number":1679,"context_line":"            # internal ID that that thread created..."},{"line_number":1680,"context_line":"            res \u003d conn.execute(sel).fetchall()"},{"line_number":1681,"context_line":""},{"line_number":1682,"context_line":"    return res[0][0]"},{"line_number":1683,"context_line":""},{"line_number":1684,"context_line":""},{"line_number":1685,"context_line":"def _ensure_project(conn, external_id):"}],"source_content_type":"text/x-python","patch_set":18,"id":"5f201791_8efa9872","line":1682,"range":{"start_line":1682,"start_character":11,"end_line":1682,"end_character":20},"updated":"2017-06-23 20:50:32.000000000","message":"I guess this is first result, first field (which is the id)? Would be nicer if we could just do something like first().id.","commit_id":"a909673682cdd8f02ef0ae5e8c6f061640e320ff"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"e43225ef973e7425b2d410dd9978a41d0c6f0c5d","unresolved":false,"context_lines":[{"line_number":1715,"context_line":"    fields \u003d {"},{"line_number":1716,"context_line":"        \u0027objects\u0027: fields.ListOfObjectsField(\u0027Allocation\u0027),"},{"line_number":1717,"context_line":"        \u0027project_id\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":1718,"context_line":"        \u0027user_id\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":1719,"context_line":"    }"},{"line_number":1720,"context_line":""},{"line_number":1721,"context_line":"    @staticmethod"}],"source_content_type":"text/x-python","patch_set":18,"id":"7f287b81_a9efbfe7","line":1718,"updated":"2017-09-03 23:45:32.000000000","message":"When we added these fields, they didn\u0027t get added to the output in any particular way. For example, if get a list of allocations by rp or consumer, the created AllocationList object doesn\u0027t get the info.\n\nThis is mostly okay, because we don\u0027t use it, but is a bit weird as I\u0027m exploring moving the fields elsewhere.","commit_id":"a909673682cdd8f02ef0ae5e8c6f061640e320ff"}],"nova/scheduler/client/report.py":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"a6f031d2d05972efa29c1df6eb79820870af8730","unresolved":false,"context_lines":[{"line_number":876,"context_line":"            \u0027user_id\u0027: user_id,"},{"line_number":877,"context_line":"        }"},{"line_number":878,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer_uuid"},{"line_number":879,"context_line":"        r \u003d self.put(url, payload)"},{"line_number":880,"context_line":"        if r.status_code !\u003d 204:"},{"line_number":881,"context_line":"            LOG.warning("},{"line_number":882,"context_line":"                \u0027Unable to submit allocation for instance \u0027"}],"source_content_type":"text/x-python","patch_set":12,"id":"7f231b9d_3872e1e4","line":879,"updated":"2017-06-13 03:13:19.000000000","message":"we should pass the microversion 1.8 at here, otherwise we can\u0027t update with new field in the API. I saw a lot of message in the log\nhttp://logs.openstack.org/34/469634/12/check/gate-tempest-dsvm-neutron-full-ubuntu-xenial/56d8abe/logs/screen-n-cpu.txt.gz#_Jun_12_22_00_17_707953","commit_id":"c38020671be29d82ec2f7b6646c2543d3e81009e"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"53787b7df3944923e7faeeae6eb8ada27f791b4d","unresolved":false,"context_lines":[{"line_number":876,"context_line":"            \u0027user_id\u0027: user_id,"},{"line_number":877,"context_line":"        }"},{"line_number":878,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer_uuid"},{"line_number":879,"context_line":"        r \u003d self.put(url, payload)"},{"line_number":880,"context_line":"        if r.status_code !\u003d 204:"},{"line_number":881,"context_line":"            LOG.warning("},{"line_number":882,"context_line":"                \u0027Unable to submit allocation for instance \u0027"}],"source_content_type":"text/x-python","patch_set":12,"id":"7f231b9d_f3300aeb","line":879,"in_reply_to":"7f231b9d_3872e1e4","updated":"2017-06-13 03:21:54.000000000","message":"Thanks for catching that, I had thought this would default to the latest microversion.","commit_id":"c38020671be29d82ec2f7b6646c2543d3e81009e"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"8f9df6ff4b49bb33adffbacc327ad35c566ed621","unresolved":false,"context_lines":[{"line_number":877,"context_line":"        }"},{"line_number":878,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer_uuid"},{"line_number":879,"context_line":"        r \u003d self.put(url, payload, version\u003d\u00271.8\u0027)"},{"line_number":880,"context_line":"        if r.status_code \u003d\u003d 400:"},{"line_number":881,"context_line":"            # microversion 1.8 not available so try the earlier way"},{"line_number":882,"context_line":"            # TODO(melwitt): Remove this when we can be sure all placement"},{"line_number":883,"context_line":"            # servers support version 1.8."}],"source_content_type":"text/x-python","patch_set":13,"id":"7f231b9d_c5f30173","line":880,"range":{"start_line":880,"start_character":11,"end_line":880,"end_character":31},"updated":"2017-06-13 04:42:06.000000000","message":"When the 1.8 not available, you will get 406 returned.","commit_id":"ca46ca4acb7dfc1941b1586bc294fc5550a62dee"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"7c5c03c0fdd553439bcc60de421357e31b0e2239","unresolved":false,"context_lines":[{"line_number":877,"context_line":"        }"},{"line_number":878,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer_uuid"},{"line_number":879,"context_line":"        r \u003d self.put(url, payload, version\u003d\u00271.8\u0027)"},{"line_number":880,"context_line":"        if r.status_code \u003d\u003d 406:"},{"line_number":881,"context_line":"            # microversion 1.8 not available so try the earlier way"},{"line_number":882,"context_line":"            # TODO(melwitt): Remove this when we can be sure all placement"},{"line_number":883,"context_line":"            # servers support version 1.8."}],"source_content_type":"text/x-python","patch_set":18,"id":"5f201791_2e8ee4cf","line":880,"range":{"start_line":880,"start_character":28,"end_line":880,"end_character":31},"updated":"2017-06-23 20:50:32.000000000","message":"I was confused by the 405 usage with the 1.5 microversion, but apparently this should be 406 if asking for 1.8 in an Ocata placement API:\n\nhttps://github.com/openstack/nova/blob/master/nova/api/openstack/placement/microversion.py#L187","commit_id":"a909673682cdd8f02ef0ae5e8c6f061640e320ff"}],"nova/tests/functional/api/openstack/placement/gabbits/allocations-1-8.yaml":[{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"a260e1676e34b4c63d9e7774df03ac9c6bdd1040","unresolved":false,"context_lines":[{"line_number":85,"context_line":"                DISK_GB: 10"},{"line_number":86,"context_line":"      project_id: $ENVIRON[\u0027PROJECT_ID\u0027]"},{"line_number":87,"context_line":"      user_id: $ENVIRON[\u0027USER_ID\u0027]"},{"line_number":88,"context_line":"  status: 204"}],"source_content_type":"text/x-yaml","patch_set":14,"id":"7f231b9d_0ffa2f74","line":88,"updated":"2017-06-13 10:05:51.000000000","message":"++","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"7c5c03c0fdd553439bcc60de421357e31b0e2239","unresolved":false,"context_lines":[{"line_number":5,"context_line":"    request_headers:"},{"line_number":6,"context_line":"        x-auth-token: admin"},{"line_number":7,"context_line":"        accept: application/json"},{"line_number":8,"context_line":"        OpenStack-API-Version: placement 1.8"},{"line_number":9,"context_line":""},{"line_number":10,"context_line":"tests:"},{"line_number":11,"context_line":""}],"source_content_type":"text/x-yaml","patch_set":18,"id":"5f201791_ee4fcc8f","line":8,"range":{"start_line":8,"start_character":41,"end_line":8,"end_character":44},"updated":"2017-06-23 20:50:32.000000000","message":"Can you add a test that if you try to do a PUT /allocations with project_id and user_id with microversion\u003c1.8 that you get a failure?","commit_id":"a909673682cdd8f02ef0ae5e8c6f061640e320ff"}],"nova/tests/functional/compute/test_resource_tracker.py":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"3c636266cb7a652ecf6e8e794a911f85438861cf","unresolved":false,"context_lines":[{"line_number":123,"context_line":"            task_state\u003dtask_states.SPAWNING,"},{"line_number":124,"context_line":"            power_state\u003dpower_state.RUNNING,"},{"line_number":125,"context_line":"            project_id\u003d\u0027project\u0027,"},{"line_number":126,"context_line":"            user_id\u003d\u0027user\u0027,"},{"line_number":127,"context_line":"        ),"},{"line_number":128,"context_line":"    }"},{"line_number":129,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_7f52233d","line":126,"updated":"2017-06-02 17:18:49.000000000","message":"It presumably doesn\u0027t really matter, but should we make these uuids.project1 and uuids.user1 or what have you for clean livin\u0027?","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"5bfc26e468d31be069e37d7a52af9d5a503d7279","unresolved":false,"context_lines":[{"line_number":123,"context_line":"            task_state\u003dtask_states.SPAWNING,"},{"line_number":124,"context_line":"            power_state\u003dpower_state.RUNNING,"},{"line_number":125,"context_line":"            project_id\u003d\u0027project\u0027,"},{"line_number":126,"context_line":"            user_id\u003d\u0027user\u0027,"},{"line_number":127,"context_line":"        ),"},{"line_number":128,"context_line":"    }"},{"line_number":129,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_285ea143","line":126,"in_reply_to":"df140735_68e939b5","updated":"2017-06-03 16:35:53.000000000","message":"Done","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"19bb274c8027575d976cccc55a7216333b3660f9","unresolved":false,"context_lines":[{"line_number":123,"context_line":"            task_state\u003dtask_states.SPAWNING,"},{"line_number":124,"context_line":"            power_state\u003dpower_state.RUNNING,"},{"line_number":125,"context_line":"            project_id\u003d\u0027project\u0027,"},{"line_number":126,"context_line":"            user_id\u003d\u0027user\u0027,"},{"line_number":127,"context_line":"        ),"},{"line_number":128,"context_line":"    }"},{"line_number":129,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_9a906545","line":126,"in_reply_to":"df140735_7f52233d","updated":"2017-06-02 17:33:42.000000000","message":"I\u0027m cool with changing it.","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"69f865ed32f50c04fca203de4149bab4ca0dc95c","unresolved":false,"context_lines":[{"line_number":123,"context_line":"            task_state\u003dtask_states.SPAWNING,"},{"line_number":124,"context_line":"            power_state\u003dpower_state.RUNNING,"},{"line_number":125,"context_line":"            project_id\u003d\u0027project\u0027,"},{"line_number":126,"context_line":"            user_id\u003d\u0027user\u0027,"},{"line_number":127,"context_line":"        ),"},{"line_number":128,"context_line":"    }"},{"line_number":129,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_68e939b5","line":126,"in_reply_to":"df140735_7f52233d","updated":"2017-06-03 15:41:29.000000000","message":"agreed.","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"}],"nova/tests/functional/db/test_resource_provider.py":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"3c636266cb7a652ecf6e8e794a911f85438861cf","unresolved":false,"context_lines":[{"line_number":1228,"context_line":"                                                 objects\u003d[allocation1,"},{"line_number":1229,"context_line":"                                                          allocation2])"},{"line_number":1230,"context_line":"        allocation_list.create_all_with_project_user(self.context.project_id,"},{"line_number":1231,"context_line":"                                                     self.context.user_id)"},{"line_number":1232,"context_line":""},{"line_number":1233,"context_line":""},{"line_number":1234,"context_line":"class UsageListTestCase(ResourceProviderBaseCase):"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_7a535118","line":1231,"updated":"2017-06-02 17:18:49.000000000","message":"this is WIPping, I\u0027m guessing?","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"5bfc26e468d31be069e37d7a52af9d5a503d7279","unresolved":false,"context_lines":[{"line_number":1228,"context_line":"                                                 objects\u003d[allocation1,"},{"line_number":1229,"context_line":"                                                          allocation2])"},{"line_number":1230,"context_line":"        allocation_list.create_all_with_project_user(self.context.project_id,"},{"line_number":1231,"context_line":"                                                     self.context.user_id)"},{"line_number":1232,"context_line":""},{"line_number":1233,"context_line":""},{"line_number":1234,"context_line":"class UsageListTestCase(ResourceProviderBaseCase):"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_3c14a643","line":1231,"in_reply_to":"df140735_1ad21501","updated":"2017-06-03 16:35:53.000000000","message":"I added some validation that lookup records were created.","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"1f5b1671fbc4753812c01868145950b5377625c5","unresolved":false,"context_lines":[{"line_number":1228,"context_line":"                                                 objects\u003d[allocation1,"},{"line_number":1229,"context_line":"                                                          allocation2])"},{"line_number":1230,"context_line":"        allocation_list.create_all_with_project_user(self.context.project_id,"},{"line_number":1231,"context_line":"                                                     self.context.user_id)"},{"line_number":1232,"context_line":""},{"line_number":1233,"context_line":""},{"line_number":1234,"context_line":"class UsageListTestCase(ResourceProviderBaseCase):"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_2e811afc","line":1231,"in_reply_to":"df140735_1ad21501","updated":"2017-06-02 18:04:32.000000000","message":"That is, it\u0027s tested in the next patch \"GET /usages\" but not here in this patch. But technically it should be tested here in this patch.","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"19bb274c8027575d976cccc55a7216333b3660f9","unresolved":false,"context_lines":[{"line_number":1228,"context_line":"                                                 objects\u003d[allocation1,"},{"line_number":1229,"context_line":"                                                          allocation2])"},{"line_number":1230,"context_line":"        allocation_list.create_all_with_project_user(self.context.project_id,"},{"line_number":1231,"context_line":"                                                     self.context.user_id)"},{"line_number":1232,"context_line":""},{"line_number":1233,"context_line":""},{"line_number":1234,"context_line":"class UsageListTestCase(ResourceProviderBaseCase):"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_1ad21501","line":1231,"in_reply_to":"df140735_7a535118","updated":"2017-06-02 17:33:42.000000000","message":"Eh, not really. There\u0027s not a method for reading consumers in this patch, so I punted about it. I separated the read of the usages (allocations + consumers joined table) into the next patch in the series along with GET /usages.\n\nSo to test this properly, I could add a private method on the object that reads consumers, solely for testing, or I could define a method here in the test file for reading consumers and do it that way. What do you think?","commit_id":"6100dc0f98a1aebb6b7db565d30d87b423f01315"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"7c5c03c0fdd553439bcc60de421357e31b0e2239","unresolved":false,"context_lines":[{"line_number":1234,"context_line":"        )"},{"line_number":1235,"context_line":"        allocation_list.create_all()"},{"line_number":1236,"context_line":""},{"line_number":1237,"context_line":"        # Verify that we have records in the consumers, projects, and users"},{"line_number":1238,"context_line":"        # table for the information used in the above allocation creation"},{"line_number":1239,"context_line":"        with self.api_db.get_engine().connect() as conn:"},{"line_number":1240,"context_line":"            tbl \u003d rp_obj._PROJECT_TBL"},{"line_number":1241,"context_line":"            sel \u003d sa.select([tbl.c.id]).where("}],"source_content_type":"text/x-python","patch_set":18,"id":"5f201791_6eadfc2f","line":1238,"range":{"start_line":1237,"start_character":8,"end_line":1238,"end_character":73},"updated":"2017-06-23 20:50:32.000000000","message":"How about testing the case that the consumers/projects/users tables already have the entries so we don\u0027t attempt the insert?","commit_id":"a909673682cdd8f02ef0ae5e8c6f061640e320ff"}],"nova/tests/unit/scheduler/client/test_report.py":[{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"5947086009be7e1e42b7751c2cddc85299bfe9b3","unresolved":false,"context_lines":[{"line_number":1437,"context_line":"        expected \u003d {"},{"line_number":1438,"context_line":"            \u0027allocations\u0027: ["},{"line_number":1439,"context_line":"                {\u0027resource_provider\u0027: {\u0027uuid\u0027: cn.uuid},"},{"line_number":1440,"context_line":"                 \u0027resources\u0027: mock_a.return_value}],"},{"line_number":1441,"context_line":"            \u0027project_id\u0027: inst.project_id,"},{"line_number":1442,"context_line":"            \u0027user_id\u0027: inst.user_id,"},{"line_number":1443,"context_line":"        }"}],"source_content_type":"text/x-python","patch_set":1,"id":"df140735_a3feaa34","line":1440,"range":{"start_line":1440,"start_character":30,"end_line":1440,"end_character":49},"updated":"2017-05-31 21:51:41.000000000","message":"Where is this set?","commit_id":"fb83dd4dec5599d873236ae071a8f464d0e8bb6c"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"7d4b6346705e7115db0da4b6c6bae0141d5fd2e2","unresolved":false,"context_lines":[{"line_number":1437,"context_line":"        expected \u003d {"},{"line_number":1438,"context_line":"            \u0027allocations\u0027: ["},{"line_number":1439,"context_line":"                {\u0027resource_provider\u0027: {\u0027uuid\u0027: cn.uuid},"},{"line_number":1440,"context_line":"                 \u0027resources\u0027: mock_a.return_value}],"},{"line_number":1441,"context_line":"            \u0027project_id\u0027: inst.project_id,"},{"line_number":1442,"context_line":"            \u0027user_id\u0027: inst.user_id,"},{"line_number":1443,"context_line":"        }"}],"source_content_type":"text/x-python","patch_set":1,"id":"df140735_c60e4c31","line":1440,"range":{"start_line":1440,"start_character":30,"end_line":1440,"end_character":49},"in_reply_to":"df140735_a3feaa34","updated":"2017-05-31 22:07:28.000000000","message":"That was already there, but, if unset it will return a MagicMock whose ref can be compared in the assertion. It\u0027s a way to express \"what the mocked function returned\" if you don\u0027t care about setting it to a specific return value.","commit_id":"fb83dd4dec5599d873236ae071a8f464d0e8bb6c"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"a260e1676e34b4c63d9e7774df03ac9c6bdd1040","unresolved":false,"context_lines":[{"line_number":1519,"context_line":"        self.assertTrue(mock_warn.called)"},{"line_number":1520,"context_line":""},{"line_number":1521,"context_line":"    @mock.patch(\u0027nova.scheduler.client.report.SchedulerReportClient.\u0027"},{"line_number":1522,"context_line":"                \u0027delete\u0027)"},{"line_number":1523,"context_line":"    def test_update_instance_allocation_delete(self, mock_delete):"},{"line_number":1524,"context_line":"        cn \u003d objects.ComputeNode(uuid\u003duuids.cn)"},{"line_number":1525,"context_line":"        inst \u003d objects.Instance(uuid\u003duuids.inst)"}],"source_content_type":"text/x-python","patch_set":14,"id":"7f231b9d_0f28efdf","line":1522,"updated":"2017-06-13 10:05:51.000000000","message":"++ too, good tests sfor me.","commit_id":"55b0bac97e6e799789a03776dc2ecaa2ff81a223"}]}
