)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"374bb33b281592076f0431f7a558345c776c82a0","unresolved":false,"context_lines":[{"line_number":14,"context_line":"/allocations requests."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"TODO:"},{"line_number":17,"context_line":"* consider bundling consumer_uuid with consumer_generation in a single"},{"line_number":18,"context_line":"  nova internal object instead of passing them as two separate parameter"},{"line_number":19,"context_line":"* find and solve the cases when HTTP 409 Conflict can be received due to"},{"line_number":20,"context_line":"  consumer generation conflict."},{"line_number":21,"context_line":"* update unit test to pass"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_96493367","line":18,"range":{"start_line":17,"start_character":2,"end_line":18,"end_character":22},"updated":"2018-07-18 20:35:45.000000000","message":"Yeah, we should totally define a Consumer object.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"f668ba9d963b167f758571176cd78c288673db92","unresolved":false,"context_lines":[{"line_number":14,"context_line":"/allocations requests."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"TODO:"},{"line_number":17,"context_line":"* consider bundling consumer_uuid with consumer_generation in a single"},{"line_number":18,"context_line":"  nova internal object instead of passing them as two separate parameter"},{"line_number":19,"context_line":"* find and solve the cases when HTTP 409 Conflict can be received due to"},{"line_number":20,"context_line":"  consumer generation conflict."},{"line_number":21,"context_line":"* update unit test to pass"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_aa3dce29","line":18,"range":{"start_line":17,"start_character":2,"end_line":18,"end_character":22},"in_reply_to":"5f7c97a3_0c7bc279","updated":"2018-07-19 12:26:11.000000000","message":"Yeah, I agree that this should be a plain old python object. No major logic in the object. I can even start with a named tuple as Chris suggests.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"d30d42b3e91283bf22f8e8350db0bf1e1c191f88","unresolved":false,"context_lines":[{"line_number":14,"context_line":"/allocations requests."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"TODO:"},{"line_number":17,"context_line":"* consider bundling consumer_uuid with consumer_generation in a single"},{"line_number":18,"context_line":"  nova internal object instead of passing them as two separate parameter"},{"line_number":19,"context_line":"* find and solve the cases when HTTP 409 Conflict can be received due to"},{"line_number":20,"context_line":"  consumer generation conflict."},{"line_number":21,"context_line":"* update unit test to pass"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_da532e14","line":18,"range":{"start_line":17,"start_character":2,"end_line":18,"end_character":22},"in_reply_to":"5f7c97a3_1438bbd1","updated":"2018-07-19 20:45:57.000000000","message":"I was being totally facetious.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"75145fd69456b51e7c180a79cf86cedc855aa226","unresolved":false,"context_lines":[{"line_number":14,"context_line":"/allocations requests."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"TODO:"},{"line_number":17,"context_line":"* consider bundling consumer_uuid with consumer_generation in a single"},{"line_number":18,"context_line":"  nova internal object instead of passing them as two separate parameter"},{"line_number":19,"context_line":"* find and solve the cases when HTTP 409 Conflict can be received due to"},{"line_number":20,"context_line":"  consumer generation conflict."},{"line_number":21,"context_line":"* update unit test to pass"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_1438bbd1","line":18,"range":{"start_line":17,"start_character":2,"end_line":18,"end_character":22},"in_reply_to":"5f7c97a3_96493367","updated":"2018-07-19 20:04:09.000000000","message":"-1. The nova scheduler report client doesn\u0027t import nova.api.openstack.placement.objects. None of the reportclient methods pass any objects at all, actually. Just dicts.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"384dba85759c6822fdea0965ff792f85660e7c0b","unresolved":false,"context_lines":[{"line_number":14,"context_line":"/allocations requests."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"TODO:"},{"line_number":17,"context_line":"* consider bundling consumer_uuid with consumer_generation in a single"},{"line_number":18,"context_line":"  nova internal object instead of passing them as two separate parameter"},{"line_number":19,"context_line":"* find and solve the cases when HTTP 409 Conflict can be received due to"},{"line_number":20,"context_line":"  consumer generation conflict."},{"line_number":21,"context_line":"* update unit test to pass"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_0c7bc279","line":18,"range":{"start_line":17,"start_character":2,"end_line":18,"end_character":22},"in_reply_to":"5f7c97a3_96493367","updated":"2018-07-19 10:15:08.000000000","message":"Avoid the temptation of the object becoming something more than a data carrier by using a named tuple?","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"c395b2e60ff17f912c000fd439585c247fe0c30a","unresolved":false,"context_lines":[{"line_number":14,"context_line":"/allocations requests."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"TODO:"},{"line_number":17,"context_line":"* consider bundling consumer_uuid with consumer_generation in a single"},{"line_number":18,"context_line":"  nova internal object instead of passing them as two separate parameter"},{"line_number":19,"context_line":"* find and solve the cases when HTTP 409 Conflict can be received due to"},{"line_number":20,"context_line":"  consumer generation conflict."},{"line_number":21,"context_line":"* update unit test to pass"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_81d314d3","line":18,"range":{"start_line":17,"start_character":2,"end_line":18,"end_character":22},"in_reply_to":"5f7c97a3_aa3dce29","updated":"2018-07-19 16:22:39.000000000","message":"I was able to contain the generation handling in the report client so we don\u0027t need the object at all.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"374bb33b281592076f0431f7a558345c776c82a0","unresolved":false,"context_lines":[{"line_number":16,"context_line":"TODO:"},{"line_number":17,"context_line":"* consider bundling consumer_uuid with consumer_generation in a single"},{"line_number":18,"context_line":"  nova internal object instead of passing them as two separate parameter"},{"line_number":19,"context_line":"* find and solve the cases when HTTP 409 Conflict can be received due to"},{"line_number":20,"context_line":"  consumer generation conflict."},{"line_number":21,"context_line":"* update unit test to pass"},{"line_number":22,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_760c97ea","line":19,"range":{"start_line":19,"start_character":11,"end_line":19,"end_character":65},"updated":"2018-07-18 20:35:45.000000000","message":"Retries like https://review.openstack.org/#/c/556669/","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"f668ba9d963b167f758571176cd78c288673db92","unresolved":false,"context_lines":[{"line_number":16,"context_line":"TODO:"},{"line_number":17,"context_line":"* consider bundling consumer_uuid with consumer_generation in a single"},{"line_number":18,"context_line":"  nova internal object instead of passing them as two separate parameter"},{"line_number":19,"context_line":"* find and solve the cases when HTTP 409 Conflict can be received due to"},{"line_number":20,"context_line":"  consumer generation conflict."},{"line_number":21,"context_line":"* update unit test to pass"},{"line_number":22,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_6a15769a","line":19,"range":{"start_line":19,"start_character":11,"end_line":19,"end_character":65},"in_reply_to":"5f7c97a3_760c97ea","updated":"2018-07-19 12:26:11.000000000","message":"Thanks.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"93361ddabfac73d44fb6f52a7688288f8b1d0533","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Use placement 1.28 in scheduler report client"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The placement API version 1.28 introduced consumer generation as a way"},{"line_number":10,"context_line":"to make updating allocation safe even if it done from multiple places."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"This patch bumps the used api version in the scheduler report client to"},{"line_number":13,"context_line":"1.28 and includes the plumbing to provide consumer generation in PUT"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"5f7c97a3_ecd7b4f3","line":10,"range":{"start_line":10,"start_character":41,"end_line":10,"end_character":48},"updated":"2018-07-27 01:33:34.000000000","message":"it is done","commit_id":"1db6c84868bd0b5821ddac80ef6b3558eeff2d27"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"6f03c3e7781eaf03f58450c0fd6b8ada2954a704","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Use placement 1.28 in scheduler report client"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The placement API version 1.28 introduced consumer generation as a way"},{"line_number":10,"context_line":"to make updating allocation safe even if it done from multiple places."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"This patch bumps the used api version in the scheduler report client to"},{"line_number":13,"context_line":"1.28 and includes the plumbing to provide consumer generation in PUT"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"5f7c97a3_d99073f6","line":10,"range":{"start_line":10,"start_character":41,"end_line":10,"end_character":48},"in_reply_to":"5f7c97a3_ecd7b4f3","updated":"2018-07-27 10:16:02.000000000","message":"Done","commit_id":"1db6c84868bd0b5821ddac80ef6b3558eeff2d27"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"93361ddabfac73d44fb6f52a7688288f8b1d0533","unresolved":false,"context_lines":[{"line_number":17,"context_line":"reported by Placement."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Note that almost every instance move operation uses the migration.uuid"},{"line_number":20,"context_line":"to hold thesource node allocation while attempting to allocate on the"},{"line_number":21,"context_line":"destination for the instance. The only exception is evacuation as during"},{"line_number":22,"context_line":"evacuation both the source and the destination allocations are held by"},{"line_number":23,"context_line":"the instance.uuid as consumer."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"5f7c97a3_0cdb1020","line":20,"range":{"start_line":20,"start_character":8,"end_line":20,"end_character":17},"updated":"2018-07-27 01:33:34.000000000","message":"needs a space","commit_id":"1db6c84868bd0b5821ddac80ef6b3558eeff2d27"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"6f03c3e7781eaf03f58450c0fd6b8ada2954a704","unresolved":false,"context_lines":[{"line_number":17,"context_line":"reported by Placement."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Note that almost every instance move operation uses the migration.uuid"},{"line_number":20,"context_line":"to hold thesource node allocation while attempting to allocate on the"},{"line_number":21,"context_line":"destination for the instance. The only exception is evacuation as during"},{"line_number":22,"context_line":"evacuation both the source and the destination allocations are held by"},{"line_number":23,"context_line":"the instance.uuid as consumer."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"5f7c97a3_f9952fe4","line":20,"range":{"start_line":20,"start_character":8,"end_line":20,"end_character":17},"in_reply_to":"5f7c97a3_0cdb1020","updated":"2018-07-27 10:16:02.000000000","message":"Done","commit_id":"1db6c84868bd0b5821ddac80ef6b3558eeff2d27"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":23,"context_line":"  build of a new instance or during the move of an existing"},{"line_number":24,"context_line":"  instance and the source allocation is held by the migration_uuid. In"},{"line_number":25,"context_line":"  this case if Placement returns consumer generation conflict then there"},{"line_number":26,"context_line":"  is a serious inconsistencies about that consumer. So this patch"},{"line_number":27,"context_line":"  ensures that the operation is aborted."},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"* The caller knows that there is allocation on the consumer before"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":25,"id":"3f79a3b5_d4cc8d8b","line":26,"range":{"start_line":26,"start_character":15,"end_line":26,"end_character":30},"updated":"2018-10-01 16:21:15.000000000","message":"s/inconsistencies/inconsistency/","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":23,"context_line":"  build of a new instance or during the move of an existing"},{"line_number":24,"context_line":"  instance and the source allocation is held by the migration_uuid. In"},{"line_number":25,"context_line":"  this case if Placement returns consumer generation conflict then there"},{"line_number":26,"context_line":"  is a serious inconsistencies about that consumer. So this patch"},{"line_number":27,"context_line":"  ensures that the operation is aborted."},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"* The caller knows that there is allocation on the consumer before"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":25,"id":"3f79a3b5_264ca274","line":26,"range":{"start_line":26,"start_character":15,"end_line":26,"end_character":30},"in_reply_to":"3f79a3b5_d4cc8d8b","updated":"2018-10-02 14:03:18.000000000","message":"Done","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":29,"context_line":"* The caller knows that there is allocation on the consumer before"},{"line_number":30,"context_line":"  calling claim and reads the current allocation from Placement. The"},{"line_number":31,"context_line":"  only example of this in the current codebase is forced evacuation. In"},{"line_number":32,"context_line":"  this case the caller provides the consumer_generation to the"},{"line_number":33,"context_line":"  claim_resources. If Placement returns consumer generaton conflict then"},{"line_number":34,"context_line":"  the caller aborts the operation."},{"line_number":35,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":25,"id":"3f79a3b5_74a339b2","line":32,"range":{"start_line":32,"start_character":59,"end_line":32,"end_character":62},"updated":"2018-10-01 16:21:15.000000000","message":"s/the//","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":29,"context_line":"* The caller knows that there is allocation on the consumer before"},{"line_number":30,"context_line":"  calling claim and reads the current allocation from Placement. The"},{"line_number":31,"context_line":"  only example of this in the current codebase is forced evacuation. In"},{"line_number":32,"context_line":"  this case the caller provides the consumer_generation to the"},{"line_number":33,"context_line":"  claim_resources. If Placement returns consumer generaton conflict then"},{"line_number":34,"context_line":"  the caller aborts the operation."},{"line_number":35,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":25,"id":"3f79a3b5_86401634","line":32,"range":{"start_line":32,"start_character":59,"end_line":32,"end_character":62},"in_reply_to":"3f79a3b5_74a339b2","updated":"2018-10-02 14:03:18.000000000","message":"Done","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":26,"context_line":"  is a serious inconsistency about that consumer. So this patch"},{"line_number":27,"context_line":"  ensures that the operation is aborted."},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"* The caller knows that there is allocation on the consumer before"},{"line_number":30,"context_line":"  calling claim and reads the current allocation from Placement. The"},{"line_number":31,"context_line":"  only example of this in the current codebase is forced evacuation. In"},{"line_number":32,"context_line":"  this case the caller provides the consumer_generation to"},{"line_number":33,"context_line":"  claim_resources. If Placement returns consumer generaton conflict then"},{"line_number":34,"context_line":"  the caller aborts the operation."},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"* The scheduler wants to claim resources for a non-forced evacuation."},{"line_number":37,"context_line":"  The scheduler does not know that it is an evacuate operation and the"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":28,"id":"3f79a3b5_990cdbeb","line":34,"range":{"start_line":29,"start_character":0,"end_line":34,"end_character":34},"updated":"2018-10-03 16:25:03.000000000","message":"Not having dug into the code yet, I suspect this is similar to the DELETE case from the first patch. I.e. we\u0027re only closing a teeny bit of the race window. So I\u0027ll be looking for a similar comment there...\n\n[Later] Yeah, see inline.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":26,"context_line":"  is a serious inconsistency about that consumer. So this patch"},{"line_number":27,"context_line":"  ensures that the operation is aborted."},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"* The caller knows that there is allocation on the consumer before"},{"line_number":30,"context_line":"  calling claim and reads the current allocation from Placement. The"},{"line_number":31,"context_line":"  only example of this in the current codebase is forced evacuation. In"},{"line_number":32,"context_line":"  this case the caller provides the consumer_generation to"},{"line_number":33,"context_line":"  claim_resources. If Placement returns consumer generaton conflict then"},{"line_number":34,"context_line":"  the caller aborts the operation."},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"* The scheduler wants to claim resources for a non-forced evacuation."},{"line_number":37,"context_line":"  The scheduler does not know that it is an evacuate operation and the"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":28,"id":"3f79a3b5_4c9c2e0c","line":34,"range":{"start_line":29,"start_character":0,"end_line":34,"end_character":34},"in_reply_to":"3f79a3b5_990cdbeb","updated":"2018-10-04 11:47:56.000000000","message":"Done inline.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":41,"context_line":"  claim_resources code needs to read the actual consumer generation"},{"line_number":42,"context_line":"  from Placement. If during this claim Placement returns consumer"},{"line_number":43,"context_line":"  generaton conflict then claim_resource will raise and let the caller"},{"line_number":44,"context_line":"  abort the opertion."},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"Blueprint: use-nested-allocation-candidates"},{"line_number":47,"context_line":"Change-Id: I097732754b67bd5cf50abd15db7da3f013b6cdd5"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":28,"id":"3f79a3b5_591ba31a","line":44,"updated":"2018-10-03 16:25:03.000000000","message":"ditto","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":41,"context_line":"  claim_resources code needs to read the actual consumer generation"},{"line_number":42,"context_line":"  from Placement. If during this claim Placement returns consumer"},{"line_number":43,"context_line":"  generaton conflict then claim_resource will raise and let the caller"},{"line_number":44,"context_line":"  abort the opertion."},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"Blueprint: use-nested-allocation-candidates"},{"line_number":47,"context_line":"Change-Id: I097732754b67bd5cf50abd15db7da3f013b6cdd5"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":28,"id":"3f79a3b5_4cb50e7c","line":44,"in_reply_to":"3f79a3b5_591ba31a","updated":"2018-10-04 11:47:56.000000000","message":"Done inline.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"}],"nova/cmd/status.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"374bb33b281592076f0431f7a558345c776c82a0","unresolved":false,"context_lines":[{"line_number":52,"context_line":"PLACEMENT_DOCS_LINK \u003d \u0027https://docs.openstack.org/nova/latest\u0027 \\"},{"line_number":53,"context_line":"                      \u0027/user/placement.html\u0027"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"# NOTE(gibi): 1.28 is required to make allocation updates safe by using"},{"line_number":56,"context_line":"# consumer generations"},{"line_number":57,"context_line":"# NOTE: If you bump this version, remember to update the history"},{"line_number":58,"context_line":"# section in the nova-status man page (doc/source/cli/nova-status)."}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_d626cbcc","line":55,"updated":"2018-07-18 20:35:45.000000000","message":"You need to do more stuff than this when bumping the minimum - see I4369f7fb1453e896864222fa407437982be8f6b5","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"c395b2e60ff17f912c000fd439585c247fe0c30a","unresolved":false,"context_lines":[{"line_number":52,"context_line":"PLACEMENT_DOCS_LINK \u003d \u0027https://docs.openstack.org/nova/latest\u0027 \\"},{"line_number":53,"context_line":"                      \u0027/user/placement.html\u0027"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"# NOTE(gibi): 1.28 is required to make allocation updates safe by using"},{"line_number":56,"context_line":"# consumer generations"},{"line_number":57,"context_line":"# NOTE: If you bump this version, remember to update the history"},{"line_number":58,"context_line":"# section in the nova-status man page (doc/source/cli/nova-status)."}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_244ece38","line":55,"in_reply_to":"5f7c97a3_d626cbcc","updated":"2018-07-19 16:22:39.000000000","message":"Thanks for the pointer. Done.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"}],"nova/compute/manager.py":[{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"9f0d300063f66e4b4478b4903b033aa9614c6f81","unresolved":false,"context_lines":[{"line_number":4042,"context_line":"        # node, which are now held by the migration"},{"line_number":4043,"context_line":"        orig_alloc \u003d self.reportclient.get_allocations_for_consumer("},{"line_number":4044,"context_line":"            context, migration.uuid, include_project_user\u003dTrue)"},{"line_number":4045,"context_line":"        if not orig_alloc[\u0027allocations\u0027]:"},{"line_number":4046,"context_line":"            orig_consumer_generation \u003d None"},{"line_number":4047,"context_line":"        else:"},{"line_number":4048,"context_line":"            orig_consumer_generation \u003d orig_alloc[\u0027consumer_generation\u0027]"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_b637864b","line":4045,"updated":"2018-07-19 05:02:31.000000000","message":"Are you sure key \u0027allocations\u0027 exist in dict orig_alloc as many of the unit test cases are failing because of keyerror here.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"f668ba9d963b167f758571176cd78c288673db92","unresolved":false,"context_lines":[{"line_number":4042,"context_line":"        # node, which are now held by the migration"},{"line_number":4043,"context_line":"        orig_alloc \u003d self.reportclient.get_allocations_for_consumer("},{"line_number":4044,"context_line":"            context, migration.uuid, include_project_user\u003dTrue)"},{"line_number":4045,"context_line":"        if not orig_alloc[\u0027allocations\u0027]:"},{"line_number":4046,"context_line":"            orig_consumer_generation \u003d None"},{"line_number":4047,"context_line":"        else:"},{"line_number":4048,"context_line":"            orig_consumer_generation \u003d orig_alloc[\u0027consumer_generation\u0027]"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_65d36960","line":4045,"in_reply_to":"5f7c97a3_b637864b","updated":"2018-07-19 12:26:11.000000000","message":"I haven\u0027t looked at the unit test yet, I used the functional tests to guide me. Here we are asking for the allocations tight to the migration (e.g. the allocation on the source host) at this point that should exits in placement as we are about to revert to it. So in this particular place the consumer should exists so we can expect the \u0027allocations\u0027 key in the result.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"}],"nova/conductor/manager.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":932,"context_line":"                                {\u0027vm_state\u0027: vm_states.ERROR,"},{"line_number":933,"context_line":"                                 \u0027task_state\u0027: None}, ex, request_spec)"},{"line_number":934,"context_line":"                            LOG.warning(\u0027Rebuild failed: %s\u0027,"},{"line_number":935,"context_line":"                                        six.text_type(ex), instance\u003dinstance)"},{"line_number":936,"context_line":""},{"line_number":937,"context_line":"            else:"},{"line_number":938,"context_line":"                # At this point, the user is either:"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_b4a23196","line":935,"updated":"2018-10-01 16:21:15.000000000","message":"✓","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":928,"context_line":"                        if migration:"},{"line_number":929,"context_line":"                            migration.status \u003d \u0027error\u0027"},{"line_number":930,"context_line":"                            migration.save()"},{"line_number":931,"context_line":"                        with excutils.save_and_reraise_exception():"},{"line_number":932,"context_line":"                            self._set_vm_state_and_notify("},{"line_number":933,"context_line":"                                context,"},{"line_number":934,"context_line":"                                instance.uuid,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_d9d49321","line":931,"range":{"start_line":931,"start_character":24,"end_line":931,"end_character":67},"updated":"2018-10-03 16:25:03.000000000","message":"This needs to move up, to immediately after the `except` clause.\n\n(The point of save_and_reraise is to capture the context from the caught exception before we do anything that might change it. Things like migration.save() could very well do that. Even setting migration.status, if that happens to go through a nontrivial @property setter.\n\nAs a general rule, save_and_reraise should always go immediately after the `except` clause. I can\u0027t think of an exception (hah) to that.)","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":928,"context_line":"                        if migration:"},{"line_number":929,"context_line":"                            migration.status \u003d \u0027error\u0027"},{"line_number":930,"context_line":"                            migration.save()"},{"line_number":931,"context_line":"                        with excutils.save_and_reraise_exception():"},{"line_number":932,"context_line":"                            self._set_vm_state_and_notify("},{"line_number":933,"context_line":"                                context,"},{"line_number":934,"context_line":"                                instance.uuid,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_71b6a4de","line":931,"range":{"start_line":931,"start_character":24,"end_line":931,"end_character":67},"in_reply_to":"3f79a3b5_d9d49321","updated":"2018-10-04 11:47:56.000000000","message":"Good point. Done.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":998,"context_line":"                    if orig_image_ref and orig_image_ref !\u003d image_ref:"},{"line_number":999,"context_line":"                        instance.image_ref \u003d orig_image_ref"},{"line_number":1000,"context_line":"                        instance.save()"},{"line_number":1001,"context_line":"                    with excutils.save_and_reraise_exception():"},{"line_number":1002,"context_line":"                        self._set_vm_state_and_notify(context, instance.uuid,"},{"line_number":1003,"context_line":"                                \u0027rebuild_server\u0027,"},{"line_number":1004,"context_line":"                                {\u0027vm_state\u0027: vm_states.ERROR,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_79d77f23","line":1001,"range":{"start_line":1001,"start_character":19,"end_line":1001,"end_character":63},"updated":"2018-10-03 16:25:03.000000000","message":"ditto (though this one would be unrelated, sad-face).\n\nI guess you pasted the above from here.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":998,"context_line":"                    if orig_image_ref and orig_image_ref !\u003d image_ref:"},{"line_number":999,"context_line":"                        instance.image_ref \u003d orig_image_ref"},{"line_number":1000,"context_line":"                        instance.save()"},{"line_number":1001,"context_line":"                    with excutils.save_and_reraise_exception():"},{"line_number":1002,"context_line":"                        self._set_vm_state_and_notify(context, instance.uuid,"},{"line_number":1003,"context_line":"                                \u0027rebuild_server\u0027,"},{"line_number":1004,"context_line":"                                {\u0027vm_state\u0027: vm_states.ERROR,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_31acac86","line":1001,"range":{"start_line":1001,"start_character":19,"end_line":1001,"end_character":63},"in_reply_to":"3f79a3b5_79d77f23","updated":"2018-10-04 11:47:56.000000000","message":"Very well be it. :/","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"4724bbe158cf7628abc7888b97b8ac2d18b2ade2","unresolved":false,"context_lines":[{"line_number":989,"context_line":"                            selection.nodename, selection.limits)"},{"line_number":990,"context_line":"                except (exception.NoValidHost,"},{"line_number":991,"context_line":"                        exception.UnsupportedPolicyException,"},{"line_number":992,"context_line":"                        exception.AllocationUpdateFailed) as ex:"},{"line_number":993,"context_line":"                    if migration:"},{"line_number":994,"context_line":"                        migration.status \u003d \u0027error\u0027"},{"line_number":995,"context_line":"                        migration.save()"}],"source_content_type":"text/x-python","patch_set":29,"id":"3f79a3b5_7d2f523d","line":992,"range":{"start_line":992,"start_character":23,"end_line":992,"end_character":64},"updated":"2018-10-04 13:21:02.000000000","message":"OK, so this is the third bullet point from the commit message. Since the scheduler doesn\u0027t know that we\u0027re doing an evacuate, it will raise AllocationUpdateFailed when calling claim_resources() and hitting a consumer generation conflict (due to providing consumer_generation\u003dNone but there already being a consumer record for the instance).\n\nHowever, this will only happen if something has somehow created an allocation for the instance consumer UUID in between the time that we \"moved\" the allocation to the migration consumer UUID and this point in time. So, the chances of this are pretty remote, considering the state checks we have in the system to prevent other actions during a migration action.\n\nWe just set the evacuating instance to an error state here, then, which is appropriate considering this should only occur in extremely unlikely scenarios that should not occur in \"normal\" operations.","commit_id":"37301f2f278a3702369eec957402e36d53068973"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"62db2abf17ab28445eb8f05bfbd865f3b6ee5bcb","unresolved":false,"context_lines":[{"line_number":989,"context_line":"                            selection.nodename, selection.limits)"},{"line_number":990,"context_line":"                except (exception.NoValidHost,"},{"line_number":991,"context_line":"                        exception.UnsupportedPolicyException,"},{"line_number":992,"context_line":"                        exception.AllocationUpdateFailed) as ex:"},{"line_number":993,"context_line":"                    if migration:"},{"line_number":994,"context_line":"                        migration.status \u003d \u0027error\u0027"},{"line_number":995,"context_line":"                        migration.save()"}],"source_content_type":"text/x-python","patch_set":29,"id":"3f79a3b5_865bec84","line":992,"range":{"start_line":992,"start_character":23,"end_line":992,"end_character":64},"in_reply_to":"3f79a3b5_7d2f523d","updated":"2018-10-05 08:25:34.000000000","message":"It is more complicated unfortunately.\n\nEvacuate does not move the source host allocation to the migration uuid. (I have a TODO on my list from the PTG to improve evacuate code path from this perspective.) So when scheduler hits the claim_resources() code that code detects that there is already allocation on this instance uuid consumer (the source host allocation) by reading the allocation from placement. Then merge the dest host allocation into source host allocation. As there was allocation on the instance_uuid the consumer generation is not None but claim_resources() knows this since it read that allocation from placement. If between that GET and the final PUT at the end of claim_resources() the cosumer is changed in placement then we raise AllocationUpdateFailed and fail the evacuation. \n\nIn general you are right that it is an unlikely event due to the small window between the GET and the PUT.","commit_id":"37301f2f278a3702369eec957402e36d53068973"}],"nova/conductor/tasks/live_migrate.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":108,"context_line":"            # ComputeTaskManager."},{"line_number":109,"context_line":"            # NOTE(gibi): consumer_generation \u003d None as we expect that the"},{"line_number":110,"context_line":"            # source host allocation is held by the migration therefore the"},{"line_number":111,"context_line":"            # instance is a new, empty consumer for the dest allocation. If"},{"line_number":112,"context_line":"            # this assumption fails then placement will return consumer"},{"line_number":113,"context_line":"            # generation conflict and this call raise a AllocationUpdateFailed"},{"line_number":114,"context_line":"            # exception. We let that propagate here to abort the migration."}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_f41e6972","line":111,"range":{"start_line":111,"start_character":14,"end_line":111,"end_character":71},"updated":"2018-10-01 16:21:15.000000000","message":"How exactly is this true? Did we already allocate resources against the migration consumer UUID? If so, I suppose doing that would delete the instance consumer record because of this?\n\nhttps://github.com/openstack/nova/blob/1792e2f5e9b17ffc7bb9ca4d8e5ae84524c4ceb6/nova/api/openstack/placement/objects/resource_provider.py#L2224-L2225","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":108,"context_line":"            # ComputeTaskManager."},{"line_number":109,"context_line":"            # NOTE(gibi): consumer_generation \u003d None as we expect that the"},{"line_number":110,"context_line":"            # source host allocation is held by the migration therefore the"},{"line_number":111,"context_line":"            # instance is a new, empty consumer for the dest allocation. If"},{"line_number":112,"context_line":"            # this assumption fails then placement will return consumer"},{"line_number":113,"context_line":"            # generation conflict and this call raise a AllocationUpdateFailed"},{"line_number":114,"context_line":"            # exception. We let that propagate here to abort the migration."}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_cccb971a","line":111,"range":{"start_line":111,"start_character":14,"end_line":111,"end_character":71},"in_reply_to":"3f79a3b5_f41e6972","updated":"2018-10-02 14:03:18.000000000","message":"The L82 above moved the source allocation from the instance.uuid consumer to the migration.uuid consumer and in that step the instance.uuid consumer become empty and therefore autodeleted by placement","commit_id":"65bb8e604c597138995edbed6d1688109427a733"}],"nova/scheduler/client/report.py":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"384dba85759c6822fdea0965ff792f85660e7c0b","unresolved":false,"context_lines":[{"line_number":1465,"context_line":"            raise exception.ResourceProviderSyncFailed()"},{"line_number":1466,"context_line":""},{"line_number":1467,"context_line":"    @safe_connect"},{"line_number":1468,"context_line":"    def get_consumer_generation(self, context, consumer):"},{"line_number":1469,"context_line":"        \"\"\" Gets the current generation of given consumer from placement"},{"line_number":1470,"context_line":""},{"line_number":1471,"context_line":"        :param context: The nova.context.RequestContext auth context"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_acf64ed7","line":1468,"updated":"2018-07-19 10:15:08.000000000","message":"Having this method at all (or perhaps public) seems redundant and a bit wrong to me.\n\nIn the majority of cases when we want to write allocations they are going to be brand new for a new consumer (we\u0027re making a claim for an instance). In that case the generation we want to use is \u0027null\u0027.\n\nIn the common case we should try that first.\n\nIn the other cases, getting the generation should be buried within the method that is managing the allocations, such as set_and_clear_allocations.\n\nThat is: revert_allocation_for_migration should not know or care about generations, set_and_clear_allocations should.\n\nI think. I\u0027m not entirely sure, but from my standpoint having consumer generation awareness outside the report client is a layer violation.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"c395b2e60ff17f912c000fd439585c247fe0c30a","unresolved":false,"context_lines":[{"line_number":1465,"context_line":"            raise exception.ResourceProviderSyncFailed()"},{"line_number":1466,"context_line":""},{"line_number":1467,"context_line":"    @safe_connect"},{"line_number":1468,"context_line":"    def get_consumer_generation(self, context, consumer):"},{"line_number":1469,"context_line":"        \"\"\" Gets the current generation of given consumer from placement"},{"line_number":1470,"context_line":""},{"line_number":1471,"context_line":"        :param context: The nova.context.RequestContext auth context"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_21d480e9","line":1468,"in_reply_to":"5f7c97a3_2ab53e7d","updated":"2018-07-19 16:22:39.000000000","message":"It went better than I expected. I don\u0027t need this function any more.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"f668ba9d963b167f758571176cd78c288673db92","unresolved":false,"context_lines":[{"line_number":1465,"context_line":"            raise exception.ResourceProviderSyncFailed()"},{"line_number":1466,"context_line":""},{"line_number":1467,"context_line":"    @safe_connect"},{"line_number":1468,"context_line":"    def get_consumer_generation(self, context, consumer):"},{"line_number":1469,"context_line":"        \"\"\" Gets the current generation of given consumer from placement"},{"line_number":1470,"context_line":""},{"line_number":1471,"context_line":"        :param context: The nova.context.RequestContext auth context"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_2ab53e7d","line":1468,"in_reply_to":"5f7c97a3_acf64ed7","updated":"2018-07-19 12:26:11.000000000","message":"\u003e Having this method at all (or perhaps public) seems redundant and a\n \u003e bit wrong to me.\n \u003e \n \u003e In the majority of cases when we want to write allocations they are\n \u003e going to be brand new for a new consumer (we\u0027re making a claim for\n \u003e an instance). In that case the generation we want to use is \u0027null\u0027.\n \u003e \n \u003e In the common case we should try that first.\n\nTotally agree. I only use this function in the current patch where nova modifies an existing consumer. \n* nova.compute.manager.ComputeManager#_revert_allocation\n* nova.conductor.tasks.migrate.revert_allocation_for_migration\n\nSo it is totally doable to not use this in simple, create-new-consumer cases.\n\n \u003e \n \u003e In the other cases, getting the generation should be buried within\n \u003e the method that is managing the allocations, such as\n \u003e set_and_clear_allocations.\n\nYesterday when I walked home from the office I had the two competing thought (mostly due to retry):\n* extend the scope of retry as the get_consumer_generation needs to happen inside the retry block\n* move all the get consumer calls down to the call stack into the report client (e.g in set_and_clear_allocations)\n\nNow after reading your comment and Eric\u0027s suggestion below to have a single place for getting consumers, I feel that the second option is the one I have to try. I fear that some of the processing of the allocations happening outside of the report client (like doubling in case of resize on same host) will make it non-trivial, but I will try. \n\n \u003e \n \u003e That is: revert_allocation_for_migration should not know or care\n \u003e about generations, set_and_clear_allocations should.\n \u003e \n \u003e I think. I\u0027m not entirely sure, but from my standpoint having\n \u003e consumer generation awareness outside the report client is a layer\n \u003e violation.\n\nI share your view. My first instinct was to hide this violation by wrapping consumer_uuid and consumer_generation into an object and let the report client users only see that object but your suggestion sounds better than that.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"374bb33b281592076f0431f7a558345c776c82a0","unresolved":false,"context_lines":[{"line_number":1472,"context_line":"        :param consumer: UUID of the consumer"},{"line_number":1473,"context_line":"        :return: the generation or None if the consumer does not exists"},{"line_number":1474,"context_line":"        \"\"\""},{"line_number":1475,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer"},{"line_number":1476,"context_line":"        resp \u003d self.get(url, version\u003dCONSUMER_GEN,"},{"line_number":1477,"context_line":"                        global_request_id\u003dcontext.global_id)"},{"line_number":1478,"context_line":"        if not resp:"},{"line_number":1479,"context_line":"            return None"},{"line_number":1480,"context_line":"        elif not resp.json()[\u0027allocations\u0027]:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_795488fd","line":1477,"range":{"start_line":1475,"start_character":0,"end_line":1477,"end_character":60},"updated":"2018-07-18 20:35:45.000000000","message":"Feel like we should dedup and do GET /allocations/{c} from just one method.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"c395b2e60ff17f912c000fd439585c247fe0c30a","unresolved":false,"context_lines":[{"line_number":1472,"context_line":"        :param consumer: UUID of the consumer"},{"line_number":1473,"context_line":"        :return: the generation or None if the consumer does not exists"},{"line_number":1474,"context_line":"        \"\"\""},{"line_number":1475,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer"},{"line_number":1476,"context_line":"        resp \u003d self.get(url, version\u003dCONSUMER_GEN,"},{"line_number":1477,"context_line":"                        global_request_id\u003dcontext.global_id)"},{"line_number":1478,"context_line":"        if not resp:"},{"line_number":1479,"context_line":"            return None"},{"line_number":1480,"context_line":"        elif not resp.json()[\u0027allocations\u0027]:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_e103e874","line":1477,"range":{"start_line":1475,"start_character":0,"end_line":1477,"end_character":60},"in_reply_to":"5f7c97a3_4a619a10","updated":"2018-07-19 16:22:39.000000000","message":"Done","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"384dba85759c6822fdea0965ff792f85660e7c0b","unresolved":false,"context_lines":[{"line_number":1472,"context_line":"        :param consumer: UUID of the consumer"},{"line_number":1473,"context_line":"        :return: the generation or None if the consumer does not exists"},{"line_number":1474,"context_line":"        \"\"\""},{"line_number":1475,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer"},{"line_number":1476,"context_line":"        resp \u003d self.get(url, version\u003dCONSUMER_GEN,"},{"line_number":1477,"context_line":"                        global_request_id\u003dcontext.global_id)"},{"line_number":1478,"context_line":"        if not resp:"},{"line_number":1479,"context_line":"            return None"},{"line_number":1480,"context_line":"        elif not resp.json()[\u0027allocations\u0027]:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_ccd5ca48","line":1477,"range":{"start_line":1475,"start_character":0,"end_line":1477,"end_character":60},"in_reply_to":"5f7c97a3_795488fd","updated":"2018-07-19 10:15:08.000000000","message":"agree","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"f668ba9d963b167f758571176cd78c288673db92","unresolved":false,"context_lines":[{"line_number":1472,"context_line":"        :param consumer: UUID of the consumer"},{"line_number":1473,"context_line":"        :return: the generation or None if the consumer does not exists"},{"line_number":1474,"context_line":"        \"\"\""},{"line_number":1475,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer"},{"line_number":1476,"context_line":"        resp \u003d self.get(url, version\u003dCONSUMER_GEN,"},{"line_number":1477,"context_line":"                        global_request_id\u003dcontext.global_id)"},{"line_number":1478,"context_line":"        if not resp:"},{"line_number":1479,"context_line":"            return None"},{"line_number":1480,"context_line":"        elif not resp.json()[\u0027allocations\u0027]:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_4a619a10","line":1477,"range":{"start_line":1475,"start_character":0,"end_line":1477,"end_character":60},"in_reply_to":"5f7c97a3_ccd5ca48","updated":"2018-07-19 12:26:11.000000000","message":"Let\u0027s do it.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"374bb33b281592076f0431f7a558345c776c82a0","unresolved":false,"context_lines":[{"line_number":1475,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer"},{"line_number":1476,"context_line":"        resp \u003d self.get(url, version\u003dCONSUMER_GEN,"},{"line_number":1477,"context_line":"                        global_request_id\u003dcontext.global_id)"},{"line_number":1478,"context_line":"        if not resp:"},{"line_number":1479,"context_line":"            return None"},{"line_number":1480,"context_line":"        elif not resp.json()[\u0027allocations\u0027]:"},{"line_number":1481,"context_line":"            return None"},{"line_number":1482,"context_line":"        else:"},{"line_number":1483,"context_line":"            return resp.json()[\u0027consumer_generation\u0027]"},{"line_number":1484,"context_line":""},{"line_number":1485,"context_line":""},{"line_number":1486,"context_line":"    # TODO(gibi): rename include_project_user to include_whole_response"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_56f87b7c","line":1483,"range":{"start_line":1478,"start_character":0,"end_line":1483,"end_character":53},"updated":"2018-07-18 20:35:45.000000000","message":"Ugh, several things going on here.\n\nWe need to quit doing this thing where \u0027not resp\u0027 behaves as if nothing is wrong, even when it is.\n\nAt 1.28:\n- \u0027not resp\u0027 is an error condition and we should raise an exception from here; and\n- The \u0027not resp.json()[\u0027allocations\u0027] thing, awful as it is, can stay. Though perhaps it would be nicer as\n\n return resp.json().get(\u0027consumer_generation\u0027)\n\nBut once [1] is merged:\n- \u0027not resp\u0027 should be split into 404, which *should* return None, and not-404 which should still raise an exception; and\n- We can get rid of the \u0027not resp.json()[\u0027allocations\u0027] condition entirely because it\u0027ll be impossible.\n\n[1] https://review.openstack.org/#/c/579163/","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"384dba85759c6822fdea0965ff792f85660e7c0b","unresolved":false,"context_lines":[{"line_number":1475,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer"},{"line_number":1476,"context_line":"        resp \u003d self.get(url, version\u003dCONSUMER_GEN,"},{"line_number":1477,"context_line":"                        global_request_id\u003dcontext.global_id)"},{"line_number":1478,"context_line":"        if not resp:"},{"line_number":1479,"context_line":"            return None"},{"line_number":1480,"context_line":"        elif not resp.json()[\u0027allocations\u0027]:"},{"line_number":1481,"context_line":"            return None"},{"line_number":1482,"context_line":"        else:"},{"line_number":1483,"context_line":"            return resp.json()[\u0027consumer_generation\u0027]"},{"line_number":1484,"context_line":""},{"line_number":1485,"context_line":""},{"line_number":1486,"context_line":"    # TODO(gibi): rename include_project_user to include_whole_response"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_8cdb5278","line":1483,"range":{"start_line":1478,"start_character":0,"end_line":1483,"end_character":53},"in_reply_to":"5f7c97a3_56f87b7c","updated":"2018-07-19 10:15:08.000000000","message":"\u003e We need to quit doing this thing where \u0027not resp\u0027 behaves as if\n \u003e nothing is wrong, even when it is.\n\nVery definitely.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"f668ba9d963b167f758571176cd78c288673db92","unresolved":false,"context_lines":[{"line_number":1475,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer"},{"line_number":1476,"context_line":"        resp \u003d self.get(url, version\u003dCONSUMER_GEN,"},{"line_number":1477,"context_line":"                        global_request_id\u003dcontext.global_id)"},{"line_number":1478,"context_line":"        if not resp:"},{"line_number":1479,"context_line":"            return None"},{"line_number":1480,"context_line":"        elif not resp.json()[\u0027allocations\u0027]:"},{"line_number":1481,"context_line":"            return None"},{"line_number":1482,"context_line":"        else:"},{"line_number":1483,"context_line":"            return resp.json()[\u0027consumer_generation\u0027]"},{"line_number":1484,"context_line":""},{"line_number":1485,"context_line":""},{"line_number":1486,"context_line":"    # TODO(gibi): rename include_project_user to include_whole_response"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_aa75ceca","line":1483,"range":{"start_line":1478,"start_character":0,"end_line":1483,"end_character":53},"in_reply_to":"5f7c97a3_8cdb5278","updated":"2018-07-19 12:26:11.000000000","message":"I agree. It is ugly as hell. I need to keep it this til [1] merges but I will add a TODO to remove it as soon as that happens.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"c395b2e60ff17f912c000fd439585c247fe0c30a","unresolved":false,"context_lines":[{"line_number":1475,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer"},{"line_number":1476,"context_line":"        resp \u003d self.get(url, version\u003dCONSUMER_GEN,"},{"line_number":1477,"context_line":"                        global_request_id\u003dcontext.global_id)"},{"line_number":1478,"context_line":"        if not resp:"},{"line_number":1479,"context_line":"            return None"},{"line_number":1480,"context_line":"        elif not resp.json()[\u0027allocations\u0027]:"},{"line_number":1481,"context_line":"            return None"},{"line_number":1482,"context_line":"        else:"},{"line_number":1483,"context_line":"            return resp.json()[\u0027consumer_generation\u0027]"},{"line_number":1484,"context_line":""},{"line_number":1485,"context_line":""},{"line_number":1486,"context_line":"    # TODO(gibi): rename include_project_user to include_whole_response"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_c1fcac72","line":1483,"range":{"start_line":1478,"start_character":0,"end_line":1483,"end_character":53},"in_reply_to":"5f7c97a3_aa75ceca","updated":"2018-07-19 16:22:39.000000000","message":"We don\u0027t need this function any more. Done","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"75145fd69456b51e7c180a79cf86cedc855aa226","unresolved":false,"context_lines":[{"line_number":1483,"context_line":"            return resp.json()[\u0027consumer_generation\u0027]"},{"line_number":1484,"context_line":""},{"line_number":1485,"context_line":""},{"line_number":1486,"context_line":"    # TODO(gibi): rename include_project_user to include_whole_response"},{"line_number":1487,"context_line":"    @safe_connect"},{"line_number":1488,"context_line":"    def get_allocations_for_consumer(self, context, consumer,"},{"line_number":1489,"context_line":"                                     include_project_user\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_34d61755","line":1486,"range":{"start_line":1486,"start_character":49,"end_line":1486,"end_character":71},"updated":"2018-07-19 20:04:09.000000000","message":"-1. we don\u0027t want the calling interface for the reportclient to be coupled so tightly to REST-y-ness like \"response\". Better I think to keep it as \"include_project_user\" because that indicates what the caller is expecting to receive in the returned dict.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"374bb33b281592076f0431f7a558345c776c82a0","unresolved":false,"context_lines":[{"line_number":1517,"context_line":"        :param consumer: UUID of the consumer"},{"line_number":1518,"context_line":"        :return: a tuple where the first item is a resources dict keyed by"},{"line_number":1519,"context_line":"                 resource classes and the second item is the"},{"line_number":1520,"context_line":"                 consumer_generation or None if the consumer does not exists."},{"line_number":1521,"context_line":"        \"\"\""},{"line_number":1522,"context_line":"        # NOTE(cdent): This trims to just the allocations being"},{"line_number":1523,"context_line":"        # used on this resource provider. In the future when there"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_f6e8a7a7","line":1520,"range":{"start_line":1520,"start_character":70,"end_line":1520,"end_character":76},"updated":"2018-07-18 20:35:45.000000000","message":"exist","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"c395b2e60ff17f912c000fd439585c247fe0c30a","unresolved":false,"context_lines":[{"line_number":1517,"context_line":"        :param consumer: UUID of the consumer"},{"line_number":1518,"context_line":"        :return: a tuple where the first item is a resources dict keyed by"},{"line_number":1519,"context_line":"                 resource classes and the second item is the"},{"line_number":1520,"context_line":"                 consumer_generation or None if the consumer does not exists."},{"line_number":1521,"context_line":"        \"\"\""},{"line_number":1522,"context_line":"        # NOTE(cdent): This trims to just the allocations being"},{"line_number":1523,"context_line":"        # used on this resource provider. In the future when there"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_61259809","line":1520,"range":{"start_line":1520,"start_character":70,"end_line":1520,"end_character":76},"in_reply_to":"5f7c97a3_f6e8a7a7","updated":"2018-07-19 16:22:39.000000000","message":"Done","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"374bb33b281592076f0431f7a558345c776c82a0","unresolved":false,"context_lines":[{"line_number":1527,"context_line":"        if allocations is None:"},{"line_number":1528,"context_line":"            # safe_connect can return None on 404"},{"line_number":1529,"context_line":"            allocations \u003d {}"},{"line_number":1530,"context_line":"            consumer_generation \u003d None"},{"line_number":1531,"context_line":"        elif not allocations[\u0027allocations\u0027]:"},{"line_number":1532,"context_line":"            consumer_generation \u003d None"},{"line_number":1533,"context_line":"        else:"},{"line_number":1534,"context_line":"            consumer_generation \u003d allocations[\u0027consumer_generation\u0027]"},{"line_number":1535,"context_line":"        return allocations[\u0027allocations\u0027].get("},{"line_number":1536,"context_line":"            rp_uuid, {}).get(\u0027resources\u0027, {}), consumer_generation"},{"line_number":1537,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_f66bc718","line":1534,"range":{"start_line":1530,"start_character":0,"end_line":1534,"end_character":68},"updated":"2018-07-18 20:35:45.000000000","message":"likewise","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"c395b2e60ff17f912c000fd439585c247fe0c30a","unresolved":false,"context_lines":[{"line_number":1527,"context_line":"        if allocations is None:"},{"line_number":1528,"context_line":"            # safe_connect can return None on 404"},{"line_number":1529,"context_line":"            allocations \u003d {}"},{"line_number":1530,"context_line":"            consumer_generation \u003d None"},{"line_number":1531,"context_line":"        elif not allocations[\u0027allocations\u0027]:"},{"line_number":1532,"context_line":"            consumer_generation \u003d None"},{"line_number":1533,"context_line":"        else:"},{"line_number":1534,"context_line":"            consumer_generation \u003d allocations[\u0027consumer_generation\u0027]"},{"line_number":1535,"context_line":"        return allocations[\u0027allocations\u0027].get("},{"line_number":1536,"context_line":"            rp_uuid, {}).get(\u0027resources\u0027, {}), consumer_generation"},{"line_number":1537,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_e111a8b0","line":1534,"range":{"start_line":1530,"start_character":0,"end_line":1534,"end_character":68},"in_reply_to":"5f7c97a3_f66bc718","updated":"2018-07-19 16:22:39.000000000","message":"I don\u0027t have to touch this function so this extra ugliness is gone.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"9f0d300063f66e4b4478b4903b033aa9614c6f81","unresolved":false,"context_lines":[{"line_number":1639,"context_line":"                # TODO(gibi): there is a possible race -\u003e HTTP 409 if another"},{"line_number":1640,"context_line":"                # client updates the consumer after with GET /allocations but"},{"line_number":1641,"context_line":"                # before the PUT /allocation below. We need to handle that."},{"line_number":1642,"context_line":"                consumer_generation \u003d body[\u0027consumer_generation\u0027]"},{"line_number":1643,"context_line":"                payload \u003d _move_operation_alloc_request(current_allocs, ar)"},{"line_number":1644,"context_line":""},{"line_number":1645,"context_line":"        payload[\u0027project_id\u0027] \u003d project_id"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_3664d620","line":1642,"updated":"2018-07-19 05:02:31.000000000","message":"same for here - \nKeyError: \u0027consumer_generation\u0027","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"f668ba9d963b167f758571176cd78c288673db92","unresolved":false,"context_lines":[{"line_number":1639,"context_line":"                # TODO(gibi): there is a possible race -\u003e HTTP 409 if another"},{"line_number":1640,"context_line":"                # client updates the consumer after with GET /allocations but"},{"line_number":1641,"context_line":"                # before the PUT /allocation below. We need to handle that."},{"line_number":1642,"context_line":"                consumer_generation \u003d body[\u0027consumer_generation\u0027]"},{"line_number":1643,"context_line":"                payload \u003d _move_operation_alloc_request(current_allocs, ar)"},{"line_number":1644,"context_line":""},{"line_number":1645,"context_line":"        payload[\u0027project_id\u0027] \u003d project_id"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_250c91e9","line":1642,"in_reply_to":"5f7c97a3_3664d620","updated":"2018-07-19 12:26:11.000000000","message":"L1630 with version\u003dCONSUMER_GEN and L1632 ensures that we can assume that consumer_generation is in the response. I guess it is the unit test that needs to be modified.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"374bb33b281592076f0431f7a558345c776c82a0","unresolved":false,"context_lines":[{"line_number":1646,"context_line":"        payload[\u0027user_id\u0027] \u003d user_id"},{"line_number":1647,"context_line":""},{"line_number":1648,"context_line":"        if (versionutils.convert_version_to_tuple("},{"line_number":1649,"context_line":"                allocation_request_version) \u003e\u003d (1, 28) and"},{"line_number":1650,"context_line":"                \u0027consumer_generation\u0027 not in payload):"},{"line_number":1651,"context_line":"            payload[\u0027consumer_generation\u0027] \u003d consumer_generation"},{"line_number":1652,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_96ecd392","line":1649,"range":{"start_line":1649,"start_character":16,"end_line":1649,"end_character":42},"updated":"2018-07-18 20:35:45.000000000","message":"Can\u0027t we get rid of this now?","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"c395b2e60ff17f912c000fd439585c247fe0c30a","unresolved":false,"context_lines":[{"line_number":1646,"context_line":"        payload[\u0027user_id\u0027] \u003d user_id"},{"line_number":1647,"context_line":""},{"line_number":1648,"context_line":"        if (versionutils.convert_version_to_tuple("},{"line_number":1649,"context_line":"                allocation_request_version) \u003e\u003d (1, 28) and"},{"line_number":1650,"context_line":"                \u0027consumer_generation\u0027 not in payload):"},{"line_number":1651,"context_line":"            payload[\u0027consumer_generation\u0027] \u003d consumer_generation"},{"line_number":1652,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_becd0f30","line":1649,"range":{"start_line":1649,"start_character":16,"end_line":1649,"end_character":42},"in_reply_to":"5f7c97a3_256d71ca","updated":"2018-07-19 16:22:39.000000000","message":"--later--\nBased of the commit message of https://review.openstack.org/#/c/536083/ I think we can have an upgrade situation where we still get \u003c1.28 allocation_request_version so we have to prepare for that.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"f668ba9d963b167f758571176cd78c288673db92","unresolved":false,"context_lines":[{"line_number":1646,"context_line":"        payload[\u0027user_id\u0027] \u003d user_id"},{"line_number":1647,"context_line":""},{"line_number":1648,"context_line":"        if (versionutils.convert_version_to_tuple("},{"line_number":1649,"context_line":"                allocation_request_version) \u003e\u003d (1, 28) and"},{"line_number":1650,"context_line":"                \u0027consumer_generation\u0027 not in payload):"},{"line_number":1651,"context_line":"            payload[\u0027consumer_generation\u0027] \u003d consumer_generation"},{"line_number":1652,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_256d71ca","line":1649,"range":{"start_line":1649,"start_character":16,"end_line":1649,"end_character":42},"in_reply_to":"5f7c97a3_96ecd392","updated":"2018-07-19 12:26:11.000000000","message":"in this particular case I think we can remove the version check. The rest of the modification in this commit makes sure that the report client always uses 1.28 for allocations so if there is no consumer_generation in the allocation then we can assume that this is a new claim and default the generation to None.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"374bb33b281592076f0431f7a558345c776c82a0","unresolved":false,"context_lines":[{"line_number":1830,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1831,"context_line":"                          \u0027involved in our attempt to post allocations for \u0027"},{"line_number":1832,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"},{"line_number":1833,"context_line":"                # TODO(gibi): the scope of this retry is to small as we have to"},{"line_number":1834,"context_line":"                # redo the get_allocations to get the new generation"},{"line_number":1835,"context_line":"                raise Retry(\u0027set_and_clear_allocations\u0027, reason)"},{"line_number":1836,"context_line":"            else:"},{"line_number":1837,"context_line":"                LOG.warning("}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_b64d4f9a","line":1834,"range":{"start_line":1833,"start_character":0,"end_line":1834,"end_character":68},"updated":"2018-07-18 20:35:45.000000000","message":"Yup, dis is broke.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"f668ba9d963b167f758571176cd78c288673db92","unresolved":false,"context_lines":[{"line_number":1830,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1831,"context_line":"                          \u0027involved in our attempt to post allocations for \u0027"},{"line_number":1832,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"},{"line_number":1833,"context_line":"                # TODO(gibi): the scope of this retry is to small as we have to"},{"line_number":1834,"context_line":"                # redo the get_allocations to get the new generation"},{"line_number":1835,"context_line":"                raise Retry(\u0027set_and_clear_allocations\u0027, reason)"},{"line_number":1836,"context_line":"            else:"},{"line_number":1837,"context_line":"                LOG.warning("}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_e5a77908","line":1834,"range":{"start_line":1833,"start_character":0,"end_line":1834,"end_character":68},"in_reply_to":"5f7c97a3_8c1032f6","updated":"2018-07-19 12:26:11.000000000","message":"If we can keep consumer_generation internal to the report client then the retry problem can be kept internal as well.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"384dba85759c6822fdea0965ff792f85660e7c0b","unresolved":false,"context_lines":[{"line_number":1830,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1831,"context_line":"                          \u0027involved in our attempt to post allocations for \u0027"},{"line_number":1832,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"},{"line_number":1833,"context_line":"                # TODO(gibi): the scope of this retry is to small as we have to"},{"line_number":1834,"context_line":"                # redo the get_allocations to get the new generation"},{"line_number":1835,"context_line":"                raise Retry(\u0027set_and_clear_allocations\u0027, reason)"},{"line_number":1836,"context_line":"            else:"},{"line_number":1837,"context_line":"                LOG.warning("}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_8c1032f6","line":1834,"range":{"start_line":1833,"start_character":0,"end_line":1834,"end_character":68},"in_reply_to":"5f7c97a3_b64d4f9a","updated":"2018-07-19 10:15:08.000000000","message":"It is _now_. In a pre-consumer-generation (only rp generation) world, it made perfect sense, and that it is broken now is part of why I\u0027m not entirely convinced about consumer generations. I\u0027m resigned to them, though.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"c395b2e60ff17f912c000fd439585c247fe0c30a","unresolved":false,"context_lines":[{"line_number":1830,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1831,"context_line":"                          \u0027involved in our attempt to post allocations for \u0027"},{"line_number":1832,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"},{"line_number":1833,"context_line":"                # TODO(gibi): the scope of this retry is to small as we have to"},{"line_number":1834,"context_line":"                # redo the get_allocations to get the new generation"},{"line_number":1835,"context_line":"                raise Retry(\u0027set_and_clear_allocations\u0027, reason)"},{"line_number":1836,"context_line":"            else:"},{"line_number":1837,"context_line":"                LOG.warning("}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_8165544b","line":1834,"range":{"start_line":1833,"start_character":0,"end_line":1834,"end_character":68},"in_reply_to":"5f7c97a3_e5a77908","updated":"2018-07-19 16:22:39.000000000","message":"I refactored (and renamed) this to not just the PUT but the GET allocations as well so the scope of the retry is now good.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"374bb33b281592076f0431f7a558345c776c82a0","unresolved":false,"context_lines":[{"line_number":1883,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1884,"context_line":"                          \u0027involved in our attempt to put allocations for \u0027"},{"line_number":1885,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"},{"line_number":1886,"context_line":"                raise Retry(\u0027put_allocations\u0027, reason)"},{"line_number":1887,"context_line":"            else:"},{"line_number":1888,"context_line":"                LOG.warning("},{"line_number":1889,"context_line":"                    \u0027Unable to submit allocation for instance \u0027"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_36593f5a","line":1886,"range":{"start_line":1886,"start_character":16,"end_line":1886,"end_character":54},"updated":"2018-07-18 20:35:45.000000000","message":"ditto\n\nBasically, it is invalid to have @retries and generation params on the same method.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"f668ba9d963b167f758571176cd78c288673db92","unresolved":false,"context_lines":[{"line_number":1883,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1884,"context_line":"                          \u0027involved in our attempt to put allocations for \u0027"},{"line_number":1885,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"},{"line_number":1886,"context_line":"                raise Retry(\u0027put_allocations\u0027, reason)"},{"line_number":1887,"context_line":"            else:"},{"line_number":1888,"context_line":"                LOG.warning("},{"line_number":1889,"context_line":"                    \u0027Unable to submit allocation for instance \u0027"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_4582ed53","line":1886,"range":{"start_line":1886,"start_character":16,"end_line":1886,"end_character":54},"in_reply_to":"5f7c97a3_36593f5a","updated":"2018-07-19 12:26:11.000000000","message":"Good observation. This also makes me like the idea to keep the consumer_generation internal to the report client.","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"c395b2e60ff17f912c000fd439585c247fe0c30a","unresolved":false,"context_lines":[{"line_number":1883,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1884,"context_line":"                          \u0027involved in our attempt to put allocations for \u0027"},{"line_number":1885,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"},{"line_number":1886,"context_line":"                raise Retry(\u0027put_allocations\u0027, reason)"},{"line_number":1887,"context_line":"            else:"},{"line_number":1888,"context_line":"                LOG.warning("},{"line_number":1889,"context_line":"                    \u0027Unable to submit allocation for instance \u0027"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_61c91858","line":1886,"range":{"start_line":1886,"start_character":16,"end_line":1886,"end_character":54},"in_reply_to":"5f7c97a3_4582ed53","updated":"2018-07-19 16:22:39.000000000","message":"-- alter --\nactually none of the caller really passes in consumer_generation so we can simply default that to None right now","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"374bb33b281592076f0431f7a558345c776c82a0","unresolved":false,"context_lines":[{"line_number":1896,"context_line":"    @safe_connect"},{"line_number":1897,"context_line":"    def delete_allocation_for_instance(self, context, uuid):"},{"line_number":1898,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % uuid"},{"line_number":1899,"context_line":"        # TODO(gibi): replace thish with PUT /allocations/{uuid} to ensure"},{"line_number":1900,"context_line":"        # consumer generation check"},{"line_number":1901,"context_line":"        r \u003d self.delete(url, global_request_id\u003dcontext.global_id)"},{"line_number":1902,"context_line":"        if r:"},{"line_number":1903,"context_line":"            LOG.info(\u0027Deleted allocation for instance %s\u0027, uuid)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_d651eb32","line":1900,"range":{"start_line":1899,"start_character":0,"end_line":1900,"end_character":35},"updated":"2018-07-18 20:35:45.000000000","message":"++","commit_id":"62ecede9cca454629a48a2c73639146f89f6fd59"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"71653973aa0cf04faf220403ed4df954c3affa30","unresolved":false,"context_lines":[{"line_number":49,"context_line":"POST_RPS_RETURNS_PAYLOAD_API_VERSION \u003d \u00271.20\u0027"},{"line_number":50,"context_line":"NESTED_PROVIDER_API_VERSION \u003d \u00271.14\u0027"},{"line_number":51,"context_line":"POST_ALLOCATIONS_API_VERSION \u003d \u00271.13\u0027"},{"line_number":52,"context_line":"ALLOCATION_PROJECT_USER \u003d \u00271.12\u0027"},{"line_number":53,"context_line":"CONSUMER_GEN \u003d \u00271.28\u0027"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_64a04137","line":52,"updated":"2018-07-19 20:18:32.000000000","message":"ALLOCATION_PROJECT_USER constant is no longer used and so can be removed.","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"06180f592da7a82d6e1322ed7857a7f9b8436910","unresolved":false,"context_lines":[{"line_number":49,"context_line":"POST_RPS_RETURNS_PAYLOAD_API_VERSION \u003d \u00271.20\u0027"},{"line_number":50,"context_line":"NESTED_PROVIDER_API_VERSION \u003d \u00271.14\u0027"},{"line_number":51,"context_line":"POST_ALLOCATIONS_API_VERSION \u003d \u00271.13\u0027"},{"line_number":52,"context_line":"ALLOCATION_PROJECT_USER \u003d \u00271.12\u0027"},{"line_number":53,"context_line":"CONSUMER_GEN \u003d \u00271.28\u0027"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_dabec0ad","line":52,"in_reply_to":"5f7c97a3_64a04137","updated":"2018-07-20 10:49:36.000000000","message":"Done","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"d30d42b3e91283bf22f8e8350db0bf1e1c191f88","unresolved":false,"context_lines":[{"line_number":50,"context_line":"NESTED_PROVIDER_API_VERSION \u003d \u00271.14\u0027"},{"line_number":51,"context_line":"POST_ALLOCATIONS_API_VERSION \u003d \u00271.13\u0027"},{"line_number":52,"context_line":"ALLOCATION_PROJECT_USER \u003d \u00271.12\u0027"},{"line_number":53,"context_line":"CONSUMER_GEN \u003d \u00271.28\u0027"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"def warn_limit(self, msg):"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_f58ac217","line":53,"range":{"start_line":53,"start_character":0,"end_line":53,"end_character":12},"updated":"2018-07-19 20:45:57.000000000","message":"Can we use the _VERSION suffix to conform with the rest.\n\nAnd also, since we forgot it originally, please do the same to L52 (whose only usage you\u0027ve replaced anyway via this change).","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"06180f592da7a82d6e1322ed7857a7f9b8436910","unresolved":false,"context_lines":[{"line_number":50,"context_line":"NESTED_PROVIDER_API_VERSION \u003d \u00271.14\u0027"},{"line_number":51,"context_line":"POST_ALLOCATIONS_API_VERSION \u003d \u00271.13\u0027"},{"line_number":52,"context_line":"ALLOCATION_PROJECT_USER \u003d \u00271.12\u0027"},{"line_number":53,"context_line":"CONSUMER_GEN \u003d \u00271.28\u0027"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"def warn_limit(self, msg):"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_fab93cc4","line":53,"range":{"start_line":53,"start_character":0,"end_line":53,"end_character":12},"in_reply_to":"5f7c97a3_f58ac217","updated":"2018-07-20 10:49:36.000000000","message":"Done","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"d30d42b3e91283bf22f8e8350db0bf1e1c191f88","unresolved":false,"context_lines":[{"line_number":1566,"context_line":"                                           allocations."},{"line_number":1567,"context_line":"        :returns: True if the allocations were created, False otherwise."},{"line_number":1568,"context_line":"        \"\"\""},{"line_number":1569,"context_line":"        # Older clients might not send the allocation_request_version, so"},{"line_number":1570,"context_line":"        # default to 1.10."},{"line_number":1571,"context_line":"        # TODO(alex_xu): In the rocky, all the client should send the"},{"line_number":1572,"context_line":"        # allocation_request_version. So remove this default value."},{"line_number":1573,"context_line":"        allocation_request_version \u003d allocation_request_version or \u00271.10\u0027"},{"line_number":1574,"context_line":"        # Ensure we don\u0027t change the supplied alloc request since it\u0027s used in"},{"line_number":1575,"context_line":"        # a loop within the scheduler against multiple instance claims"},{"line_number":1576,"context_line":"        ar \u003d copy.deepcopy(alloc_request)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_04994dce","line":1573,"range":{"start_line":1569,"start_character":0,"end_line":1573,"end_character":73},"updated":"2018-07-19 20:45:57.000000000","message":"This can go away now.","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"06180f592da7a82d6e1322ed7857a7f9b8436910","unresolved":false,"context_lines":[{"line_number":1566,"context_line":"                                           allocations."},{"line_number":1567,"context_line":"        :returns: True if the allocations were created, False otherwise."},{"line_number":1568,"context_line":"        \"\"\""},{"line_number":1569,"context_line":"        # Older clients might not send the allocation_request_version, so"},{"line_number":1570,"context_line":"        # default to 1.10."},{"line_number":1571,"context_line":"        # TODO(alex_xu): In the rocky, all the client should send the"},{"line_number":1572,"context_line":"        # allocation_request_version. So remove this default value."},{"line_number":1573,"context_line":"        allocation_request_version \u003d allocation_request_version or \u00271.10\u0027"},{"line_number":1574,"context_line":"        # Ensure we don\u0027t change the supplied alloc request since it\u0027s used in"},{"line_number":1575,"context_line":"        # a loop within the scheduler against multiple instance claims"},{"line_number":1576,"context_line":"        ar \u003d copy.deepcopy(alloc_request)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_1ace785a","line":1573,"range":{"start_line":1569,"start_character":0,"end_line":1573,"end_character":73},"in_reply_to":"5f7c97a3_04994dce","updated":"2018-07-20 10:49:36.000000000","message":"Done","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"d30d42b3e91283bf22f8e8350db0bf1e1c191f88","unresolved":false,"context_lines":[{"line_number":1575,"context_line":"        # a loop within the scheduler against multiple instance claims"},{"line_number":1576,"context_line":"        ar \u003d copy.deepcopy(alloc_request)"},{"line_number":1577,"context_line":""},{"line_number":1578,"context_line":"        # If the allocation_request_version less than 1.12, then convert the"},{"line_number":1579,"context_line":"        # allocation array format to the dict format. This conversion can be"},{"line_number":1580,"context_line":"        # remove in Rocky release."},{"line_number":1581,"context_line":"        if versionutils.convert_version_to_tuple("},{"line_number":1582,"context_line":"                allocation_request_version) \u003c (1, 12):"},{"line_number":1583,"context_line":"            ar \u003d {"},{"line_number":1584,"context_line":"                \u0027allocations\u0027: {"},{"line_number":1585,"context_line":"                    alloc[\u0027resource_provider\u0027][\u0027uuid\u0027]: {"},{"line_number":1586,"context_line":"                        \u0027resources\u0027: alloc[\u0027resources\u0027]"},{"line_number":1587,"context_line":"                    } for alloc in ar[\u0027allocations\u0027]"},{"line_number":1588,"context_line":"                }"},{"line_number":1589,"context_line":"            }"},{"line_number":1590,"context_line":"            allocation_request_version \u003d \u00271.12\u0027"},{"line_number":1591,"context_line":""},{"line_number":1592,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer_uuid"},{"line_number":1593,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_84ac7dee","line":1590,"range":{"start_line":1578,"start_character":0,"end_line":1590,"end_character":47},"updated":"2018-07-19 20:45:57.000000000","message":"This too","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"06180f592da7a82d6e1322ed7857a7f9b8436910","unresolved":false,"context_lines":[{"line_number":1575,"context_line":"        # a loop within the scheduler against multiple instance claims"},{"line_number":1576,"context_line":"        ar \u003d copy.deepcopy(alloc_request)"},{"line_number":1577,"context_line":""},{"line_number":1578,"context_line":"        # If the allocation_request_version less than 1.12, then convert the"},{"line_number":1579,"context_line":"        # allocation array format to the dict format. This conversion can be"},{"line_number":1580,"context_line":"        # remove in Rocky release."},{"line_number":1581,"context_line":"        if versionutils.convert_version_to_tuple("},{"line_number":1582,"context_line":"                allocation_request_version) \u003c (1, 12):"},{"line_number":1583,"context_line":"            ar \u003d {"},{"line_number":1584,"context_line":"                \u0027allocations\u0027: {"},{"line_number":1585,"context_line":"                    alloc[\u0027resource_provider\u0027][\u0027uuid\u0027]: {"},{"line_number":1586,"context_line":"                        \u0027resources\u0027: alloc[\u0027resources\u0027]"},{"line_number":1587,"context_line":"                    } for alloc in ar[\u0027allocations\u0027]"},{"line_number":1588,"context_line":"                }"},{"line_number":1589,"context_line":"            }"},{"line_number":1590,"context_line":"            allocation_request_version \u003d \u00271.12\u0027"},{"line_number":1591,"context_line":""},{"line_number":1592,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer_uuid"},{"line_number":1593,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_daa4804e","line":1590,"range":{"start_line":1578,"start_character":0,"end_line":1590,"end_character":47},"in_reply_to":"5f7c97a3_84ac7dee","updated":"2018-07-20 10:49:36.000000000","message":"Done","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"d30d42b3e91283bf22f8e8350db0bf1e1c191f88","unresolved":false,"context_lines":[{"line_number":1593,"context_line":""},{"line_number":1594,"context_line":"        payload \u003d ar"},{"line_number":1595,"context_line":""},{"line_number":1596,"context_line":"        # We assume that this is a new consumer if this is a move operation"},{"line_number":1597,"context_line":"        # then this will be set to the generation of the current consumer"},{"line_number":1598,"context_line":"        consumer_generation \u003d None"},{"line_number":1599,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_95e02ecd","line":1596,"range":{"start_line":1596,"start_character":46,"end_line":1596,"end_character":49},"updated":"2018-07-19 20:45:57.000000000","message":"Is this supposed to be a new sentence?","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"71653973aa0cf04faf220403ed4df954c3affa30","unresolved":false,"context_lines":[{"line_number":1593,"context_line":""},{"line_number":1594,"context_line":"        payload \u003d ar"},{"line_number":1595,"context_line":""},{"line_number":1596,"context_line":"        # We assume that this is a new consumer if this is a move operation"},{"line_number":1597,"context_line":"        # then this will be set to the generation of the current consumer"},{"line_number":1598,"context_line":"        consumer_generation \u003d None"},{"line_number":1599,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_84747dd1","line":1596,"range":{"start_line":1596,"start_character":32,"end_line":1596,"end_character":55},"updated":"2018-07-19 20:18:32.000000000","message":"s/a new consumer if this/a new consumer. If this/","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9398f44dcfabb37d26f88d4ef31fc53dcfd8683a","unresolved":false,"context_lines":[{"line_number":1593,"context_line":""},{"line_number":1594,"context_line":"        payload \u003d ar"},{"line_number":1595,"context_line":""},{"line_number":1596,"context_line":"        # We assume that this is a new consumer if this is a move operation"},{"line_number":1597,"context_line":"        # then this will be set to the generation of the current consumer"},{"line_number":1598,"context_line":"        consumer_generation \u003d None"},{"line_number":1599,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_eaa5a102","line":1596,"range":{"start_line":1596,"start_character":46,"end_line":1596,"end_character":49},"in_reply_to":"5f7c97a3_95e02ecd","updated":"2018-07-24 14:40:11.000000000","message":"Done","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"d30d42b3e91283bf22f8e8350db0bf1e1c191f88","unresolved":false,"context_lines":[{"line_number":1611,"context_line":"                # allocations above"},{"line_number":1612,"context_line":"                # TODO(gibi): there is a possible race -\u003e HTTP 409 if another"},{"line_number":1613,"context_line":"                # client updates the consumer after with GET /allocations but"},{"line_number":1614,"context_line":"                # before the PUT /allocation below. We need to handle that."},{"line_number":1615,"context_line":"                consumer_generation \u003d body[\u0027consumer_generation\u0027]"},{"line_number":1616,"context_line":"                payload \u003d _move_operation_alloc_request(current_allocs, ar)"},{"line_number":1617,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_c477d58d","line":1614,"range":{"start_line":1614,"start_character":52,"end_line":1614,"end_character":75},"updated":"2018-07-19 20:45:57.000000000","message":"Right, that\u0027s basically the whole point of this patch. It doesn\u0027t really help us to use 1.28 unless we\u0027re accounting for what\u0027s different about it.","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"71653973aa0cf04faf220403ed4df954c3affa30","unresolved":false,"context_lines":[{"line_number":1611,"context_line":"                # allocations above"},{"line_number":1612,"context_line":"                # TODO(gibi): there is a possible race -\u003e HTTP 409 if another"},{"line_number":1613,"context_line":"                # client updates the consumer after with GET /allocations but"},{"line_number":1614,"context_line":"                # before the PUT /allocation below. We need to handle that."},{"line_number":1615,"context_line":"                consumer_generation \u003d body[\u0027consumer_generation\u0027]"},{"line_number":1616,"context_line":"                payload \u003d _move_operation_alloc_request(current_allocs, ar)"},{"line_number":1617,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_07fdcf06","line":1614,"range":{"start_line":1614,"start_character":52,"end_line":1614,"end_character":75},"updated":"2018-07-19 20:18:32.000000000","message":"Sure, but we don\u0027t necessarily need to handle it *here*. The caller can/should be able to re-read and re-try the PUT if necessary/desired.","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"06180f592da7a82d6e1322ed7857a7f9b8436910","unresolved":false,"context_lines":[{"line_number":1611,"context_line":"                # allocations above"},{"line_number":1612,"context_line":"                # TODO(gibi): there is a possible race -\u003e HTTP 409 if another"},{"line_number":1613,"context_line":"                # client updates the consumer after with GET /allocations but"},{"line_number":1614,"context_line":"                # before the PUT /allocation below. We need to handle that."},{"line_number":1615,"context_line":"                consumer_generation \u003d body[\u0027consumer_generation\u0027]"},{"line_number":1616,"context_line":"                payload \u003d _move_operation_alloc_request(current_allocs, ar)"},{"line_number":1617,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_fa437c95","line":1614,"range":{"start_line":1614,"start_character":52,"end_line":1614,"end_character":75},"in_reply_to":"5f7c97a3_c477d58d","updated":"2018-07-20 10:49:36.000000000","message":"I see 4 cases calling claim_resources()\n1) new build: scheduler calls claim_resources \u003d\u003e we expect that it is a new consumer \u003d\u003e conflict means a serious inconsistency so we have to raise and I expect the caller to fail the build\n\n2) reschedule: conductor calls claim_resources() going through the alternatives \u003d\u003e we expect that it is a new consumer \u003d\u003e conflict means a serious inconsistency so we have to raise and the caller has to fail the build\n\n3) migration reschedule \u003d\u003e the source allocation is already held by the migration.uuid so this is basically a claim towards a new consumer therefore we have to raise in case of conflict.  Also I think the caller needs to fail the move in this case.\n\n4) force move bypass scheduler so , nova.scheduler.utils.claim_resources_on_destination() calls claim_resources() directly. As here the caller does the GET /allocations call also the caller needs to handle conflict therefore we can simply raise in case of conflict.","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d19a7562e66f023bfbdb688c5fdb8216130b4bc5","unresolved":false,"context_lines":[{"line_number":1611,"context_line":"                # allocations above"},{"line_number":1612,"context_line":"                # TODO(gibi): there is a possible race -\u003e HTTP 409 if another"},{"line_number":1613,"context_line":"                # client updates the consumer after with GET /allocations but"},{"line_number":1614,"context_line":"                # before the PUT /allocation below. We need to handle that."},{"line_number":1615,"context_line":"                consumer_generation \u003d body[\u0027consumer_generation\u0027]"},{"line_number":1616,"context_line":"                payload \u003d _move_operation_alloc_request(current_allocs, ar)"},{"line_number":1617,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_8f3a1695","line":1614,"range":{"start_line":1614,"start_character":52,"end_line":1614,"end_character":75},"in_reply_to":"5f7c97a3_fa437c95","updated":"2018-07-23 16:21:37.000000000","message":"The only case where we still double-up allocations for the same consumer (the instance_uuid) is evacuate. I\u0027ve added a PTG topic to discuss how to get rid of this last double up[1].\n\n\n[1]https://etherpad.openstack.org/p/nova-ptg-stein","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d5426cf9656d8a077ef04a742a89282daaa4f55e","unresolved":false,"context_lines":[{"line_number":1628,"context_line":"        if r.status_code !\u003d 204:"},{"line_number":1629,"context_line":"            # NOTE(jaypipes): Yes, it sucks doing string comparison like this"},{"line_number":1630,"context_line":"            # but we have no error codes, only error messages."},{"line_number":1631,"context_line":"            if \u0027concurrently updated\u0027 in r.text:"},{"line_number":1632,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1633,"context_line":"                          \u0027involved in our attempt to put allocations for \u0027"},{"line_number":1634,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_cfb1eee5","line":1631,"updated":"2018-07-23 16:31:00.000000000","message":"This will be a lot more complicated now as there are two types of conflicts:\n\n1) RP inventory updated during putting the allocation. Placement does not do server side retry and this client code now does a blind client side retry. This behavior have to be kept.\n\n2) There is a consumer generation conflict due to parallel allocation operations. Almost all of the caller of claim_resources() expects that a new consumer is created and if this is not the case the caller needs to know and the caller most probably needs to fail the high level operation as well. Except evacuation as that still does a double-up and might be able to handle a conflict by trying to double the new allocation up. \n\nAnyhow in 2) we have to raise an exception and let the caller handle the situation. For that we need to distinguish between 1) and 2) by error text and no separate error code exits from the two error cases in placement right now.","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9398f44dcfabb37d26f88d4ef31fc53dcfd8683a","unresolved":false,"context_lines":[{"line_number":1628,"context_line":"        if r.status_code !\u003d 204:"},{"line_number":1629,"context_line":"            # NOTE(jaypipes): Yes, it sucks doing string comparison like this"},{"line_number":1630,"context_line":"            # but we have no error codes, only error messages."},{"line_number":1631,"context_line":"            if \u0027concurrently updated\u0027 in r.text:"},{"line_number":1632,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1633,"context_line":"                          \u0027involved in our attempt to put allocations for \u0027"},{"line_number":1634,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_ed37fbda","line":1631,"in_reply_to":"5f7c97a3_cfb1eee5","updated":"2018-07-24 14:40:11.000000000","message":"Done","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"71653973aa0cf04faf220403ed4df954c3affa30","unresolved":false,"context_lines":[{"line_number":1739,"context_line":""},{"line_number":1740,"context_line":"    @safe_connect"},{"line_number":1741,"context_line":"    @retries"},{"line_number":1742,"context_line":"    def move_allocations(self, context, source_consumer_uuid,"},{"line_number":1743,"context_line":"                         target_consumer_uuid):"},{"line_number":1744,"context_line":"        \"\"\"Move allocations from one consumer to the other"},{"line_number":1745,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_27856b59","line":1742,"range":{"start_line":1742,"start_character":8,"end_line":1742,"end_character":24},"updated":"2018-07-19 20:18:32.000000000","message":"++ I like this name better. And I really like not leaking the consumer generations out of the reportclient API.","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d0a0af2bdf4c851e2ad1e5f34de2f3bae81d69b1","unresolved":false,"context_lines":[{"line_number":1758,"context_line":"                                global_request_id\u003dcontext.global_id).json()"},{"line_number":1759,"context_line":""},{"line_number":1760,"context_line":"        if target_alloc and target_alloc[\u0027allocations\u0027]:"},{"line_number":1761,"context_line":"            LOG.warning(\u0027Overwriting allocation current allocation \u0027"},{"line_number":1762,"context_line":"                        \u0027%(allocation)s on consumer %(consumer)s\u0027,"},{"line_number":1763,"context_line":"                        {\u0027allocation\u0027: target_alloc,"},{"line_number":1764,"context_line":"                         \u0027consumer\u0027: target_consumer_uuid})"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_e48c562f","line":1761,"range":{"start_line":1761,"start_character":37,"end_line":1761,"end_character":47},"updated":"2018-07-19 16:25:19.000000000","message":"strike","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"06180f592da7a82d6e1322ed7857a7f9b8436910","unresolved":false,"context_lines":[{"line_number":1758,"context_line":"                                global_request_id\u003dcontext.global_id).json()"},{"line_number":1759,"context_line":""},{"line_number":1760,"context_line":"        if target_alloc and target_alloc[\u0027allocations\u0027]:"},{"line_number":1761,"context_line":"            LOG.warning(\u0027Overwriting allocation current allocation \u0027"},{"line_number":1762,"context_line":"                        \u0027%(allocation)s on consumer %(consumer)s\u0027,"},{"line_number":1763,"context_line":"                        {\u0027allocation\u0027: target_alloc,"},{"line_number":1764,"context_line":"                         \u0027consumer\u0027: target_consumer_uuid})"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_5acab018","line":1761,"range":{"start_line":1761,"start_character":37,"end_line":1761,"end_character":47},"in_reply_to":"5f7c97a3_e48c562f","updated":"2018-07-20 10:49:36.000000000","message":"Done","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"71653973aa0cf04faf220403ed4df954c3affa30","unresolved":false,"context_lines":[{"line_number":1765,"context_line":""},{"line_number":1766,"context_line":"        new_allocs \u003d {"},{"line_number":1767,"context_line":"            source_consumer_uuid: {"},{"line_number":1768,"context_line":"                \u0027allocations\u0027: {},"},{"line_number":1769,"context_line":"                \u0027project_id\u0027: source_alloc[\u0027project_id\u0027],"},{"line_number":1770,"context_line":"                \u0027user_id\u0027: source_alloc[\u0027user_id\u0027],"},{"line_number":1771,"context_line":"                \u0027consumer_generation\u0027: source_alloc[\u0027consumer_generation\u0027]},"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_07d06f52","line":1768,"updated":"2018-07-19 20:18:32.000000000","message":"Might add a little code comment saying {} indicates we\u0027re removing all allocations against the source consumer.","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"06180f592da7a82d6e1322ed7857a7f9b8436910","unresolved":false,"context_lines":[{"line_number":1765,"context_line":""},{"line_number":1766,"context_line":"        new_allocs \u003d {"},{"line_number":1767,"context_line":"            source_consumer_uuid: {"},{"line_number":1768,"context_line":"                \u0027allocations\u0027: {},"},{"line_number":1769,"context_line":"                \u0027project_id\u0027: source_alloc[\u0027project_id\u0027],"},{"line_number":1770,"context_line":"                \u0027user_id\u0027: source_alloc[\u0027user_id\u0027],"},{"line_number":1771,"context_line":"                \u0027consumer_generation\u0027: source_alloc[\u0027consumer_generation\u0027]},"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_dadd60de","line":1768,"in_reply_to":"5f7c97a3_07d06f52","updated":"2018-07-20 10:49:36.000000000","message":"Done","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"71653973aa0cf04faf220403ed4df954c3affa30","unresolved":false,"context_lines":[{"line_number":1855,"context_line":"    def delete_allocation_for_instance(self, context, uuid):"},{"line_number":1856,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % uuid"},{"line_number":1857,"context_line":"        # TODO(gibi): replace thish with PUT /allocations/{uuid} to ensure"},{"line_number":1858,"context_line":"        # consumer generation check"},{"line_number":1859,"context_line":"        r \u003d self.delete(url, global_request_id\u003dcontext.global_id)"},{"line_number":1860,"context_line":"        if r:"},{"line_number":1861,"context_line":"            LOG.info(\u0027Deleted allocation for instance %s\u0027, uuid)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_0735cfa7","line":1858,"updated":"2018-07-19 20:18:32.000000000","message":"++","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"06180f592da7a82d6e1322ed7857a7f9b8436910","unresolved":false,"context_lines":[{"line_number":1855,"context_line":"    def delete_allocation_for_instance(self, context, uuid):"},{"line_number":1856,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % uuid"},{"line_number":1857,"context_line":"        # TODO(gibi): replace thish with PUT /allocations/{uuid} to ensure"},{"line_number":1858,"context_line":"        # consumer generation check"},{"line_number":1859,"context_line":"        r \u003d self.delete(url, global_request_id\u003dcontext.global_id)"},{"line_number":1860,"context_line":"        if r:"},{"line_number":1861,"context_line":"            LOG.info(\u0027Deleted allocation for instance %s\u0027, uuid)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_9aeda88f","line":1858,"in_reply_to":"5f7c97a3_0735cfa7","updated":"2018-07-20 10:49:36.000000000","message":"Hm, do we need require here that the caller passes in the expected allocation to be deleted and this function needs to match that to the actual state (or the expected consumer generation)? Without this information this function can only do a blind GET /allocations to get the generation and do a PUT /allocations with allocations:{} to delete that whatever it was.","commit_id":"2d72ba1242af28364b3001abb91776bf2ea0843c"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"971efafd7af034cf4f4c5ab35c85a4e70fc2c4c5","unresolved":false,"context_lines":[{"line_number":1832,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1833,"context_line":"                          \u0027involved in our attempt to put allocations for \u0027"},{"line_number":1834,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"},{"line_number":1835,"context_line":"                raise Retry(\u0027put_allocations\u0027, reason)"},{"line_number":1836,"context_line":"            else:"},{"line_number":1837,"context_line":"                LOG.warning("},{"line_number":1838,"context_line":"                    \u0027Unable to submit allocation for instance \u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_b58053c0","line":1835,"updated":"2018-07-25 10:46:20.000000000","message":"If this was a consumer generation conflict (which we don\u0027t expect but I guess need to guard against) then a retry is not warranted and won\u0027t help.","commit_id":"7ea59b66c564fe1ac42042f122bdd6ae707247bf"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"171da385b231dfbb0440e2c48e400c05ad5b035d","unresolved":false,"context_lines":[{"line_number":1832,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1833,"context_line":"                          \u0027involved in our attempt to put allocations for \u0027"},{"line_number":1834,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"},{"line_number":1835,"context_line":"                raise Retry(\u0027put_allocations\u0027, reason)"},{"line_number":1836,"context_line":"            else:"},{"line_number":1837,"context_line":"                LOG.warning("},{"line_number":1838,"context_line":"                    \u0027Unable to submit allocation for instance \u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_be6ed494","line":1835,"in_reply_to":"5f7c97a3_5fcc75bd","updated":"2018-07-26 12:24:16.000000000","message":"Done","commit_id":"7ea59b66c564fe1ac42042f122bdd6ae707247bf"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"171ae95220b578a35150e1631fdbe371a4691e44","unresolved":false,"context_lines":[{"line_number":1832,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1833,"context_line":"                          \u0027involved in our attempt to put allocations for \u0027"},{"line_number":1834,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"},{"line_number":1835,"context_line":"                raise Retry(\u0027put_allocations\u0027, reason)"},{"line_number":1836,"context_line":"            else:"},{"line_number":1837,"context_line":"                LOG.warning("},{"line_number":1838,"context_line":"                    \u0027Unable to submit allocation for instance \u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_5fcc75bd","line":1835,"in_reply_to":"5f7c97a3_b58053c0","updated":"2018-07-25 15:30:17.000000000","message":"True. I need to fix this.","commit_id":"7ea59b66c564fe1ac42042f122bdd6ae707247bf"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"971efafd7af034cf4f4c5ab35c85a4e70fc2c4c5","unresolved":false,"context_lines":[{"line_number":1845,"context_line":"    @safe_connect"},{"line_number":1846,"context_line":"    def delete_allocation_for_instance(self, context, uuid):"},{"line_number":1847,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % uuid"},{"line_number":1848,"context_line":"        # TODO(gibi): replace thish with PUT /allocations/{uuid} to ensure"},{"line_number":1849,"context_line":"        # consumer generation check"},{"line_number":1850,"context_line":"        r \u003d self.delete(url, global_request_id\u003dcontext.global_id)"},{"line_number":1851,"context_line":"        if r:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_b50b737a","line":1848,"range":{"start_line":1848,"start_character":30,"end_line":1848,"end_character":35},"updated":"2018-07-25 10:46:20.000000000","message":"this","commit_id":"7ea59b66c564fe1ac42042f122bdd6ae707247bf"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8f24760b123624e8b19812ba582e2d229f401b4a","unresolved":false,"context_lines":[{"line_number":1852,"context_line":"            \u0027consumer_generation\u0027: None"},{"line_number":1853,"context_line":"        }"},{"line_number":1854,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer_uuid"},{"line_number":1855,"context_line":"        r \u003d self.put(url, payload, version\u003dCONSUMER_GEN_VERSION,"},{"line_number":1856,"context_line":"                     global_request_id\u003dcontext.global_id)"},{"line_number":1857,"context_line":"        if r.status_code !\u003d 204:"},{"line_number":1858,"context_line":"            # NOTE(jaypipes): Yes, it sucks doing string comparison like this"}],"source_content_type":"text/x-python","patch_set":4,"id":"5f7c97a3_ff02210d","line":1855,"updated":"2018-07-25 15:51:53.000000000","message":"This will also bump the generation of the provider, which will now be out of sync in the cache. We either need to invalidate the cache entry or re-GET the provider and update the cache.\n\nNot sure how this is working today, because it\u0027s something that\u0027s new with consumer gen handling.","commit_id":"1103c69b509f7d7027df399e603d11b5f884c65a"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"171da385b231dfbb0440e2c48e400c05ad5b035d","unresolved":false,"context_lines":[{"line_number":1852,"context_line":"            \u0027consumer_generation\u0027: None"},{"line_number":1853,"context_line":"        }"},{"line_number":1854,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer_uuid"},{"line_number":1855,"context_line":"        r \u003d self.put(url, payload, version\u003dCONSUMER_GEN_VERSION,"},{"line_number":1856,"context_line":"                     global_request_id\u003dcontext.global_id)"},{"line_number":1857,"context_line":"        if r.status_code !\u003d 204:"},{"line_number":1858,"context_line":"            # NOTE(jaypipes): Yes, it sucks doing string comparison like this"}],"source_content_type":"text/x-python","patch_set":4,"id":"5f7c97a3_7e4fdc34","line":1855,"in_reply_to":"5f7c97a3_ff02210d","updated":"2018-07-26 12:24:16.000000000","message":"I have to look into this.","commit_id":"1103c69b509f7d7027df399e603d11b5f884c65a"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"93361ddabfac73d44fb6f52a7688288f8b1d0533","unresolved":false,"context_lines":[{"line_number":1512,"context_line":"        my_allocations \u003d _instance_to_allocations_dict(instance)"},{"line_number":1513,"context_line":"        allocations \u003d self.get_allocations_for_consumer("},{"line_number":1514,"context_line":"            context, instance.uuid, include_project_user\u003dTrue)"},{"line_number":1515,"context_line":"        current_resources \u003d allocations.get("},{"line_number":1516,"context_line":"            \u0027allocations\u0027, {}).get(rp_uuid, {}).get(\u0027resources\u0027, {})"},{"line_number":1517,"context_line":"        if current_resources \u003d\u003d my_allocations:"},{"line_number":1518,"context_line":"            allocstr \u003d \u0027,\u0027.join([\u0027%s\u003d%s\u0027 % (k, v)"},{"line_number":1519,"context_line":"                                 for k, v in my_allocations.items()])"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_8c7e40be","line":1516,"range":{"start_line":1515,"start_character":0,"end_line":1516,"end_character":68},"updated":"2018-07-27 01:33:34.000000000","message":"This line looks duplicated with what is done in \"get_allocations_for_consumer_by_provider\"... Now we can just use it, can\u0027t we?","commit_id":"1db6c84868bd0b5821ddac80ef6b3558eeff2d27"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"e7eed7933ae0893c18abb9522d1f00f80f3685bd","unresolved":false,"context_lines":[{"line_number":1512,"context_line":"        my_allocations \u003d _instance_to_allocations_dict(instance)"},{"line_number":1513,"context_line":"        allocations \u003d self.get_allocations_for_consumer("},{"line_number":1514,"context_line":"            context, instance.uuid, include_project_user\u003dTrue)"},{"line_number":1515,"context_line":"        current_resources \u003d allocations.get("},{"line_number":1516,"context_line":"            \u0027allocations\u0027, {}).get(rp_uuid, {}).get(\u0027resources\u0027, {})"},{"line_number":1517,"context_line":"        if current_resources \u003d\u003d my_allocations:"},{"line_number":1518,"context_line":"            allocstr \u003d \u0027,\u0027.join([\u0027%s\u003d%s\u0027 % (k, v)"},{"line_number":1519,"context_line":"                                 for k, v in my_allocations.items()])"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_aecd2b30","line":1516,"range":{"start_line":1515,"start_character":0,"end_line":1516,"end_character":68},"in_reply_to":"5f7c97a3_8c7e40be","updated":"2018-07-27 09:13:32.000000000","message":"No because we need \n    allocations.get(\u0027consumer_generation\u0027)\nat L1532","commit_id":"1db6c84868bd0b5821ddac80ef6b3558eeff2d27"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"93361ddabfac73d44fb6f52a7688288f8b1d0533","unresolved":false,"context_lines":[{"line_number":1581,"context_line":"        :returns: True if the allocations were created, False otherwise."},{"line_number":1582,"context_line":"        :raise ConsumerUpdateConflict: If consumer_generation in the"},{"line_number":1583,"context_line":"                                       alloc_request does not match with the"},{"line_number":1584,"context_line":"                                       placement view."},{"line_number":1585,"context_line":"        \"\"\""},{"line_number":1586,"context_line":"        # Ensure we don\u0027t change the supplied alloc request since it\u0027s used in"},{"line_number":1587,"context_line":"        # a loop within the scheduler against multiple instance claims"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_87085b25","line":1584,"updated":"2018-07-27 01:33:34.000000000","message":"IMO, the documents should be updated for more details to clarify that this function sees if consumer generation is in alloc_request to decide if it retries on the failure. But that sounds a little bit hacky to me... Can we refactor it to have the \"retry_on_consumer_conflict\" an explicit argument of this function for the readability?","commit_id":"1db6c84868bd0b5821ddac80ef6b3558eeff2d27"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"e7eed7933ae0893c18abb9522d1f00f80f3685bd","unresolved":false,"context_lines":[{"line_number":1581,"context_line":"        :returns: True if the allocations were created, False otherwise."},{"line_number":1582,"context_line":"        :raise ConsumerUpdateConflict: If consumer_generation in the"},{"line_number":1583,"context_line":"                                       alloc_request does not match with the"},{"line_number":1584,"context_line":"                                       placement view."},{"line_number":1585,"context_line":"        \"\"\""},{"line_number":1586,"context_line":"        # Ensure we don\u0027t change the supplied alloc request since it\u0027s used in"},{"line_number":1587,"context_line":"        # a loop within the scheduler against multiple instance claims"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_ce47477a","line":1584,"in_reply_to":"5f7c97a3_87085b25","updated":"2018-07-27 09:13:32.000000000","message":"Unfortunately the scheduler does not know when to set retry_on_consumer_conflict. It depends on the fact if the consumer (instance) has allocation already. See comment on L1616. Yeah it is pretty ugly to have such edge cases. I\u0027ve put an item to the stein PGT etherpad to discuss how to get rid of the only real double-up allocation left in nova, which is evacuation. If evacuation resource handling is cleaned up then the majority of the ugly edge cases will be gone and the  retry_on_consumer_conflict flag can be removed as in every other case we can simply raise in case of consumer conflict.","commit_id":"1db6c84868bd0b5821ddac80ef6b3558eeff2d27"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"b75bab89b78fd13bc401399965bcccb9dbb793b7","unresolved":false,"context_lines":[{"line_number":1711,"context_line":"        payload[\u0027user_id\u0027] \u003d user_id"},{"line_number":1712,"context_line":""},{"line_number":1713,"context_line":"        if (versionutils.convert_version_to_tuple("},{"line_number":1714,"context_line":"                allocation_request_version) \u003e\u003d (1, 28) and"},{"line_number":1715,"context_line":"                \u0027consumer_generation\u0027 not in payload):"},{"line_number":1716,"context_line":"            payload[\u0027consumer_generation\u0027] \u003d consumer_generation"},{"line_number":1717,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_637f0ade","line":1714,"updated":"2018-07-30 09:27:42.000000000","message":"make any sense to use CONSUMER_GENERATION_VERSION here, converting it","commit_id":"5ac965544c2a910c0dcfd748bca0619ccd25e1c3"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d617fbf3b21219f19b6df3a60e6a12ea11526ac6","unresolved":false,"context_lines":[{"line_number":1711,"context_line":"        payload[\u0027user_id\u0027] \u003d user_id"},{"line_number":1712,"context_line":""},{"line_number":1713,"context_line":"        if (versionutils.convert_version_to_tuple("},{"line_number":1714,"context_line":"                allocation_request_version) \u003e\u003d (1, 28) and"},{"line_number":1715,"context_line":"                \u0027consumer_generation\u0027 not in payload):"},{"line_number":1716,"context_line":"            payload[\u0027consumer_generation\u0027] \u003d consumer_generation"},{"line_number":1717,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_1910e657","line":1714,"in_reply_to":"5f7c97a3_637f0ade","updated":"2018-07-31 16:53:33.000000000","message":"Yeah, 1.28 is a magic number so it make sense to use the constant for it. Done.","commit_id":"5ac965544c2a910c0dcfd748bca0619ccd25e1c3"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"ef61267f86bde89bf10b79ee0b9c9196850f763a","unresolved":false,"context_lines":[{"line_number":1850,"context_line":""},{"line_number":1851,"context_line":"    @safe_connect"},{"line_number":1852,"context_line":"    @retries"},{"line_number":1853,"context_line":"    def move_allocations(self, context, source_consumer_uuid,"},{"line_number":1854,"context_line":"                         target_consumer_uuid):"},{"line_number":1855,"context_line":"        \"\"\"Move allocations from one consumer to the other"},{"line_number":1856,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_b6a9c625","line":1853,"range":{"start_line":1853,"start_character":8,"end_line":1853,"end_character":24},"updated":"2018-07-31 11:57:21.000000000","message":"test case failed is legit, some test case need updated because we rename this function.","commit_id":"5ac965544c2a910c0dcfd748bca0619ccd25e1c3"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d617fbf3b21219f19b6df3a60e6a12ea11526ac6","unresolved":false,"context_lines":[{"line_number":1850,"context_line":""},{"line_number":1851,"context_line":"    @safe_connect"},{"line_number":1852,"context_line":"    @retries"},{"line_number":1853,"context_line":"    def move_allocations(self, context, source_consumer_uuid,"},{"line_number":1854,"context_line":"                         target_consumer_uuid):"},{"line_number":1855,"context_line":"        \"\"\"Move allocations from one consumer to the other"},{"line_number":1856,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_3960420d","line":1853,"range":{"start_line":1853,"start_character":8,"end_line":1853,"end_character":24},"in_reply_to":"5f7c97a3_b6a9c625","updated":"2018-07-31 16:53:33.000000000","message":"a lot of unit test case fails. As I noted in the commit message it is known TODO to fix.","commit_id":"5ac965544c2a910c0dcfd748bca0619ccd25e1c3"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"b75bab89b78fd13bc401399965bcccb9dbb793b7","unresolved":false,"context_lines":[{"line_number":1859,"context_line":"        or both consumers during this call then Placement will detect that and"},{"line_number":1860,"context_line":"        this code will re-read the new state of the consumers and retry the"},{"line_number":1861,"context_line":"        operation. If you want to move a known piece of allocation from source"},{"line_number":1862,"context_line":"        to target then this function might not what you want as it always moves"},{"line_number":1863,"context_line":"        what source has in Placement."},{"line_number":1864,"context_line":""},{"line_number":1865,"context_line":"        :param context: The security context"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_835d867d","line":1862,"range":{"start_line":1862,"start_character":43,"end_line":1862,"end_character":51},"updated":"2018-07-30 09:27:42.000000000","message":"not be what","commit_id":"5ac965544c2a910c0dcfd748bca0619ccd25e1c3"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d617fbf3b21219f19b6df3a60e6a12ea11526ac6","unresolved":false,"context_lines":[{"line_number":1859,"context_line":"        or both consumers during this call then Placement will detect that and"},{"line_number":1860,"context_line":"        this code will re-read the new state of the consumers and retry the"},{"line_number":1861,"context_line":"        operation. If you want to move a known piece of allocation from source"},{"line_number":1862,"context_line":"        to target then this function might not what you want as it always moves"},{"line_number":1863,"context_line":"        what source has in Placement."},{"line_number":1864,"context_line":""},{"line_number":1865,"context_line":"        :param context: The security context"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_594c1e9c","line":1862,"range":{"start_line":1862,"start_character":43,"end_line":1862,"end_character":51},"in_reply_to":"5f7c97a3_835d867d","updated":"2018-07-31 16:53:33.000000000","message":"Done","commit_id":"5ac965544c2a910c0dcfd748bca0619ccd25e1c3"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":1777,"context_line":"        # a loop within the scheduler against multiple instance claims"},{"line_number":1778,"context_line":"        ar \u003d copy.deepcopy(alloc_request)"},{"line_number":1779,"context_line":""},{"line_number":1780,"context_line":"        # If the allocation_request_version less than 1.12, then convert the"},{"line_number":1781,"context_line":"        # allocation array format to the dict format. This conversion can be"},{"line_number":1782,"context_line":"        # remove in Rocky release."},{"line_number":1783,"context_line":"        if versionutils.convert_version_to_tuple("},{"line_number":1784,"context_line":"                allocation_request_version) \u003c (1, 12):"},{"line_number":1785,"context_line":"            ar \u003d {"},{"line_number":1786,"context_line":"                \u0027allocations\u0027: {"},{"line_number":1787,"context_line":"                    alloc[\u0027resource_provider\u0027][\u0027uuid\u0027]: {"},{"line_number":1788,"context_line":"                        \u0027resources\u0027: alloc[\u0027resources\u0027]"},{"line_number":1789,"context_line":"                    } for alloc in ar[\u0027allocations\u0027]"},{"line_number":1790,"context_line":"                }"},{"line_number":1791,"context_line":"            }"},{"line_number":1792,"context_line":"            allocation_request_version \u003d \u00271.12\u0027"},{"line_number":1793,"context_line":""},{"line_number":1794,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer_uuid"},{"line_number":1795,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_da4fd767","side":"PARENT","line":1792,"range":{"start_line":1780,"start_character":0,"end_line":1792,"end_character":47},"updated":"2018-10-01 16:21:15.000000000","message":"if we\u0027re requiring \u003e1.12 allocation request version, we should document that in claim_resources() docstring. Otherwise, we need to keep this block of code in-tact.","commit_id":"3a43a931d4e46a0aa66683da22482f3e78f26cd7"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":1777,"context_line":"        # a loop within the scheduler against multiple instance claims"},{"line_number":1778,"context_line":"        ar \u003d copy.deepcopy(alloc_request)"},{"line_number":1779,"context_line":""},{"line_number":1780,"context_line":"        # If the allocation_request_version less than 1.12, then convert the"},{"line_number":1781,"context_line":"        # allocation array format to the dict format. This conversion can be"},{"line_number":1782,"context_line":"        # remove in Rocky release."},{"line_number":1783,"context_line":"        if versionutils.convert_version_to_tuple("},{"line_number":1784,"context_line":"                allocation_request_version) \u003c (1, 12):"},{"line_number":1785,"context_line":"            ar \u003d {"},{"line_number":1786,"context_line":"                \u0027allocations\u0027: {"},{"line_number":1787,"context_line":"                    alloc[\u0027resource_provider\u0027][\u0027uuid\u0027]: {"},{"line_number":1788,"context_line":"                        \u0027resources\u0027: alloc[\u0027resources\u0027]"},{"line_number":1789,"context_line":"                    } for alloc in ar[\u0027allocations\u0027]"},{"line_number":1790,"context_line":"                }"},{"line_number":1791,"context_line":"            }"},{"line_number":1792,"context_line":"            allocation_request_version \u003d \u00271.12\u0027"},{"line_number":1793,"context_line":""},{"line_number":1794,"context_line":"        url \u003d \u0027/allocations/%s\u0027 % consumer_uuid"},{"line_number":1795,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_0cef4f87","side":"PARENT","line":1792,"range":{"start_line":1780,"start_character":0,"end_line":1792,"end_character":47},"in_reply_to":"3f79a3b5_da4fd767","updated":"2018-10-02 14:03:18.000000000","message":"to get nested allocation candidates from placement in the next patch nova needs to use \u003e\u003d1.29 in GET /a_c and therefore the returned allocation candidates has a structure that conforms to that API version. Therefore scheduler passes down \u003e\u003d 1.29 when calling claim_resources with the selected allocation candidate. So by supporting nested a_c we implicitly force nova to at least support 1.29 \u003e\u003d in claim_resources too. \n\nAs far as I understand the original intention of the deleted code was to handle ongoing server lifecycle operation (like boot with re-schedule) during control plane (e.g. scheduler report client) upgrade.  So that this code can handle a bit older alloc_request hitting a new reportclient due to inflight operation during upgrade. As the comment above the code says the \u003c1.12 support can be removed in Rocky.\n\nThe new code I added:\n\nif (versionutils.convert_version_to_tuple(\n                allocation_request_version) \u003e\u003d\n                versionutils.convert_version_to_tuple(\n                    CONSUMER_GENERATION_VERSION) and\n                \u0027consumer_generation\u0027 not in payload):\n            payload[\u0027consumer_generation\u0027] \u003d consumer_generation\n\ntriest to replicate the same case just between 1.12 \u003d\u003c version \u003c 1.28 so it only adds the consumer generation if the requested version requires it (and placement accepts it in the request).\n\nI know that this whole use case is pretty thin and I\u0027m happy to drop all this compatibility code and document that claim_resources requires version \u003e\u003d 1.28 (and in the next patch 1.29) if you agree.","commit_id":"3a43a931d4e46a0aa66683da22482f3e78f26cd7"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":1732,"context_line":"        :param consumer: UUID of the consumer"},{"line_number":1733,"context_line":"        :return: the resources dict of the consumer\u0027s allocation keyed by"},{"line_number":1734,"context_line":"                 resource classes"},{"line_number":1735,"context_line":"        \"\"\""},{"line_number":1736,"context_line":"        # NOTE(cdent): This trims to just the allocations being"},{"line_number":1737,"context_line":"        # used on this resource provider. In the future when there"},{"line_number":1738,"context_line":"        # are shared resources there might be other providers."}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_741c9976","line":1735,"updated":"2018-10-01 16:21:15.000000000","message":"thx for adding this docstring. ++","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":1774,"context_line":"        :param alloc_request: The JSON body of the request to make to the"},{"line_number":1775,"context_line":"                              placement\u0027s PUT /allocations API"},{"line_number":1776,"context_line":"        :param project_id: The project_id associated with the allocations."},{"line_number":1777,"context_line":"        :param user_id: The user_id associated with the allocations."},{"line_number":1778,"context_line":"        :param allocation_request_version: The microversion used to request the"},{"line_number":1779,"context_line":"                                           allocations."},{"line_number":1780,"context_line":"        :returns: True if the allocations were created, False otherwise."}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_7af9e37f","line":1777,"updated":"2018-10-01 16:21:15.000000000","message":"It does seem a little weird that we\u0027re not just adding a consumer_generation named kwarg to this function and instead are relying on the function itself to calculate this information. I think it would make the function less complex and more maintainable if we removed the process of getting the consumer\u0027s generation out of the function and required callers to specify it. The scheduler would always pass in None and the conductor live migration task would grab the consumer\u0027s current known generation (or pass in a cached generation if we ever do that).","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":1774,"context_line":"        :param alloc_request: The JSON body of the request to make to the"},{"line_number":1775,"context_line":"                              placement\u0027s PUT /allocations API"},{"line_number":1776,"context_line":"        :param project_id: The project_id associated with the allocations."},{"line_number":1777,"context_line":"        :param user_id: The user_id associated with the allocations."},{"line_number":1778,"context_line":"        :param allocation_request_version: The microversion used to request the"},{"line_number":1779,"context_line":"                                           allocations."},{"line_number":1780,"context_line":"        :returns: True if the allocations were created, False otherwise."}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_cf22a954","line":1777,"in_reply_to":"3f79a3b5_7af9e37f","updated":"2018-10-02 14:03:18.000000000","message":"There still be cases when this function needs to grab the current consumer generation and this is evacuate. See the comments in L1808. But I can add a kwargs defaulted to None for the normal code path.","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":1808,"context_line":"                    # this is non-forced evacuation. Evacuation does not use"},{"line_number":1809,"context_line":"                    # the migration.uuid to hold the source host allocation"},{"line_number":1810,"context_line":"                    # therefore when the scheduler calls claim_resources() then"},{"line_number":1811,"context_line":"                    # the two allocations needs to be combined. Scheduler does"},{"line_number":1812,"context_line":"                    # not know that this is not a new consumer as it only sees"},{"line_number":1813,"context_line":"                    # allocation candidates."},{"line_number":1814,"context_line":"                    # Therefore we need to user the consumer generation from"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_9af15f03","line":1811,"range":{"start_line":1811,"start_character":42,"end_line":1811,"end_character":47},"updated":"2018-10-01 16:21:15.000000000","message":"need","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":1808,"context_line":"                    # this is non-forced evacuation. Evacuation does not use"},{"line_number":1809,"context_line":"                    # the migration.uuid to hold the source host allocation"},{"line_number":1810,"context_line":"                    # therefore when the scheduler calls claim_resources() then"},{"line_number":1811,"context_line":"                    # the two allocations needs to be combined. Scheduler does"},{"line_number":1812,"context_line":"                    # not know that this is not a new consumer as it only sees"},{"line_number":1813,"context_line":"                    # allocation candidates."},{"line_number":1814,"context_line":"                    # Therefore we need to user the consumer generation from"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_ef9c450e","line":1811,"range":{"start_line":1811,"start_character":42,"end_line":1811,"end_character":47},"in_reply_to":"3f79a3b5_9af15f03","updated":"2018-10-02 14:03:18.000000000","message":"Done","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":1811,"context_line":"                    # the two allocations needs to be combined. Scheduler does"},{"line_number":1812,"context_line":"                    # not know that this is not a new consumer as it only sees"},{"line_number":1813,"context_line":"                    # allocation candidates."},{"line_number":1814,"context_line":"                    # Therefore we need to user the consumer generation from"},{"line_number":1815,"context_line":"                    # the above GET."},{"line_number":1816,"context_line":"                    consumer_generation \u003d body[\u0027consumer_generation\u0027]"},{"line_number":1817,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_1add4f6c","line":1814,"range":{"start_line":1814,"start_character":43,"end_line":1814,"end_character":47},"updated":"2018-10-01 16:21:15.000000000","message":"use","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":1811,"context_line":"                    # the two allocations needs to be combined. Scheduler does"},{"line_number":1812,"context_line":"                    # not know that this is not a new consumer as it only sees"},{"line_number":1813,"context_line":"                    # allocation candidates."},{"line_number":1814,"context_line":"                    # Therefore we need to user the consumer generation from"},{"line_number":1815,"context_line":"                    # the above GET."},{"line_number":1816,"context_line":"                    consumer_generation \u003d body[\u0027consumer_generation\u0027]"},{"line_number":1817,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_8f87d1b6","line":1814,"range":{"start_line":1814,"start_character":43,"end_line":1814,"end_character":47},"in_reply_to":"3f79a3b5_1add4f6c","updated":"2018-10-02 14:03:18.000000000","message":"Done","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":1819,"context_line":"                    # claim_resources_on_destination() provides the consumer"},{"line_number":1820,"context_line":"                    # generation it sees in the conductor when generates the"},{"line_number":1821,"context_line":"                    # request."},{"line_number":1822,"context_line":"                    consumer_generation \u003d ar[\u0027consumer_generation\u0027]"},{"line_number":1823,"context_line":"                payload \u003d _move_operation_alloc_request(current_allocs, ar)"},{"line_number":1824,"context_line":""},{"line_number":1825,"context_line":"        payload[\u0027project_id\u0027] \u003d project_id"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_1ab6af26","line":1822,"updated":"2018-10-01 16:21:15.000000000","message":"I like the code comments above. ++\n\nthough I suppose it might be simpler to write:\n\n consumer_gen \u003d ar.get(\u0027consumer_generation\u0027, body[\u0027consumer_generation\u0027])","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":1819,"context_line":"                    # claim_resources_on_destination() provides the consumer"},{"line_number":1820,"context_line":"                    # generation it sees in the conductor when generates the"},{"line_number":1821,"context_line":"                    # request."},{"line_number":1822,"context_line":"                    consumer_generation \u003d ar[\u0027consumer_generation\u0027]"},{"line_number":1823,"context_line":"                payload \u003d _move_operation_alloc_request(current_allocs, ar)"},{"line_number":1824,"context_line":""},{"line_number":1825,"context_line":"        payload[\u0027project_id\u0027] \u003d project_id"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_2f655d1d","line":1822,"in_reply_to":"3f79a3b5_1ab6af26","updated":"2018-10-02 14:03:18.000000000","message":"agree that the code can be simplified but that would make the code comments (you like :)) substantially less contextual.","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":1828,"context_line":"        if (versionutils.convert_version_to_tuple("},{"line_number":1829,"context_line":"                allocation_request_version) \u003e\u003d"},{"line_number":1830,"context_line":"                versionutils.convert_version_to_tuple("},{"line_number":1831,"context_line":"                    CONSUMER_GENERATION_VERSION) and"},{"line_number":1832,"context_line":"                \u0027consumer_generation\u0027 not in payload):"},{"line_number":1833,"context_line":"            payload[\u0027consumer_generation\u0027] \u003d consumer_generation"},{"line_number":1834,"context_line":""},{"line_number":1835,"context_line":"        r \u003d self.put(url, payload, version\u003dallocation_request_version,"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_1aa30f9d","line":1832,"range":{"start_line":1831,"start_character":48,"end_line":1832,"end_character":52},"updated":"2018-10-01 16:21:15.000000000","message":"Is \u0027consumer_generation\u0027 ever in payload, if payload is an allocation request object, which has a structure like so:\n\nhttps://github.com/openstack/nova/blob/1792e2f5e9b17ffc7bb9ca4d8e5ae84524c4ceb6/nova/api/openstack/placement/handlers/allocation_candidate.py#L34-L71","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":1828,"context_line":"        if (versionutils.convert_version_to_tuple("},{"line_number":1829,"context_line":"                allocation_request_version) \u003e\u003d"},{"line_number":1830,"context_line":"                versionutils.convert_version_to_tuple("},{"line_number":1831,"context_line":"                    CONSUMER_GENERATION_VERSION) and"},{"line_number":1832,"context_line":"                \u0027consumer_generation\u0027 not in payload):"},{"line_number":1833,"context_line":"            payload[\u0027consumer_generation\u0027] \u003d consumer_generation"},{"line_number":1834,"context_line":""},{"line_number":1835,"context_line":"        r \u003d self.put(url, payload, version\u003dallocation_request_version,"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_cf1ce967","line":1832,"range":{"start_line":1831,"start_character":48,"end_line":1832,"end_character":52},"in_reply_to":"3f79a3b5_1aa30f9d","updated":"2018-10-02 14:03:18.000000000","message":"The scheduler sends an allocation candidate as alloc_request to this call and as placement does not (and cannot) add consumer_generation to the allocation candidates this function needs to figure out the consumer_generation.\n\nYour another comment was exactly at a place where I added consumer_generation to the payload in claim_resources_on_destination() so this code made sure that consumer_generation is not overwritten here. I removed the generation from there as per you comment and moved it to a kwargs so I can simplify this condition now.\n\nDone.","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":1850,"context_line":"                # this is not a consumer generation conflict so it can only be"},{"line_number":1851,"context_line":"                # a resource provider generation conflict. The caller does not"},{"line_number":1852,"context_line":"                # provide resource provider generation so this is just a"},{"line_number":1853,"context_line":"                # placement internal race. We can blindly retry locally."},{"line_number":1854,"context_line":"                reason \u003d (\u0027another process changed the resource providers \u0027"},{"line_number":1855,"context_line":"                          \u0027involved in our attempt to put allocations for \u0027"},{"line_number":1856,"context_line":"                          \u0027consumer %s\u0027 % consumer_uuid)"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_5ac6674b","line":1853,"updated":"2018-10-01 16:21:15.000000000","message":"++","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":350,"context_line":"            \"Candidates are in either \u0027foo\u0027 or \u0027bar\u0027, but definitely in \u0027baz\u0027\""},{"line_number":351,"context_line":""},{"line_number":352,"context_line":"        \"\"\""},{"line_number":353,"context_line":"        # NOTE(gibi): claim_resources will use the this version as well so to"},{"line_number":354,"context_line":"        # support consumer generations we need to do the allocation candidate"},{"line_number":355,"context_line":"        # query with high enough version as well."},{"line_number":356,"context_line":"        version \u003d CONSUMER_GENERATION_VERSION"},{"line_number":357,"context_line":"        qparams \u003d resources.to_querystring()"},{"line_number":358,"context_line":"        url \u003d \"/allocation_candidates?%s\" % qparams"},{"line_number":359,"context_line":"        resp \u003d self.get(url, version\u003dversion,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_c44b4a5c","line":356,"range":{"start_line":353,"start_character":0,"end_line":356,"end_character":45},"updated":"2018-10-03 16:25:03.000000000","message":"So wait.\n\nThere\u0027s no difference in the GET /a_c operation between GRANULAR_AC_VERSION (1.25) and CONSUMER_GENERATION_VERSION (1.28).\n\nAre you *just* using this as a signal funneled up through select_destinations and back down to claim_resources to indicate that the conductor thought the destination was *capable* of CONSUMER_GENERATION_VERSION?\n\nMore below.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":350,"context_line":"            \"Candidates are in either \u0027foo\u0027 or \u0027bar\u0027, but definitely in \u0027baz\u0027\""},{"line_number":351,"context_line":""},{"line_number":352,"context_line":"        \"\"\""},{"line_number":353,"context_line":"        # NOTE(gibi): claim_resources will use the this version as well so to"},{"line_number":354,"context_line":"        # support consumer generations we need to do the allocation candidate"},{"line_number":355,"context_line":"        # query with high enough version as well."},{"line_number":356,"context_line":"        version \u003d CONSUMER_GENERATION_VERSION"},{"line_number":357,"context_line":"        qparams \u003d resources.to_querystring()"},{"line_number":358,"context_line":"        url \u003d \"/allocation_candidates?%s\" % qparams"},{"line_number":359,"context_line":"        resp \u003d self.get(url, version\u003dversion,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_b142fcaa","line":356,"range":{"start_line":353,"start_character":0,"end_line":356,"end_character":45},"in_reply_to":"3f79a3b5_c44b4a5c","updated":"2018-10-04 11:47:56.000000000","message":"As soon as we need GET a_c to support nested we need to set this to 1.29. I wanted to avoid the jump from 1.25 to 1.29 in a single step as that changes too many things. So I jumped first to 1.28, did the fix that was needed to be done. This allows me to jump to 1.29 later in a significantly smaller patch.\n\nSignalling the version from here to the claim_resources is legacy and therefore given. I think we cannot get rid of it as the scheduler uses the allocation candidate as an allocation towards placement so the versions and payload structures of those two operations needs to match. (We might force with a common constant that the same version is used in both)","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":1811,"context_line":"                    # allocation candidates."},{"line_number":1812,"context_line":"                    # Therefore we need to use the consumer generation from"},{"line_number":1813,"context_line":"                    # the above GET."},{"line_number":1814,"context_line":"                    consumer_generation \u003d body[\u0027consumer_generation\u0027]"},{"line_number":1815,"context_line":"                else:"},{"line_number":1816,"context_line":"                    # this is forced evacuation and the caller"},{"line_number":1817,"context_line":"                    # claim_resources_on_destination() provides the consumer"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_64bfd6fb","line":1814,"range":{"start_line":1814,"start_character":19,"end_line":1814,"end_character":69},"updated":"2018-10-03 16:25:03.000000000","message":"I think we want a similar NOTE here as was added in the delete case. That is, if we\u0027re using the consumer generation from the allocations we *just* retrieved, we\u0027re not gaining any significant race protection by using it.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":1811,"context_line":"                    # allocation candidates."},{"line_number":1812,"context_line":"                    # Therefore we need to use the consumer generation from"},{"line_number":1813,"context_line":"                    # the above GET."},{"line_number":1814,"context_line":"                    consumer_generation \u003d body[\u0027consumer_generation\u0027]"},{"line_number":1815,"context_line":"                else:"},{"line_number":1816,"context_line":"                    # this is forced evacuation and the caller"},{"line_number":1817,"context_line":"                    # claim_resources_on_destination() provides the consumer"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_37a57cb4","line":1814,"range":{"start_line":1814,"start_character":19,"end_line":1814,"end_character":69},"in_reply_to":"3f79a3b5_64bfd6fb","updated":"2018-10-04 11:47:56.000000000","message":"Done","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":1815,"context_line":"                else:"},{"line_number":1816,"context_line":"                    # this is forced evacuation and the caller"},{"line_number":1817,"context_line":"                    # claim_resources_on_destination() provides the consumer"},{"line_number":1818,"context_line":"                    # generation it sees in the conductor when generates the"},{"line_number":1819,"context_line":"                    # request."},{"line_number":1820,"context_line":"                    consumer_generation \u003d ar[\u0027consumer_generation\u0027]"},{"line_number":1821,"context_line":"                payload \u003d _move_operation_alloc_request(current_allocs, ar)"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_d9bfb35d","line":1818,"range":{"start_line":1818,"start_character":58,"end_line":1818,"end_character":62},"updated":"2018-10-03 16:25:03.000000000","message":"when it","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":1815,"context_line":"                else:"},{"line_number":1816,"context_line":"                    # this is forced evacuation and the caller"},{"line_number":1817,"context_line":"                    # claim_resources_on_destination() provides the consumer"},{"line_number":1818,"context_line":"                    # generation it sees in the conductor when generates the"},{"line_number":1819,"context_line":"                    # request."},{"line_number":1820,"context_line":"                    consumer_generation \u003d ar[\u0027consumer_generation\u0027]"},{"line_number":1821,"context_line":"                payload \u003d _move_operation_alloc_request(current_allocs, ar)"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_f792a457","line":1818,"range":{"start_line":1818,"start_character":58,"end_line":1818,"end_character":62},"in_reply_to":"3f79a3b5_d9bfb35d","updated":"2018-10-04 11:47:56.000000000","message":"Done","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":1823,"context_line":"        payload[\u0027project_id\u0027] \u003d project_id"},{"line_number":1824,"context_line":"        payload[\u0027user_id\u0027] \u003d user_id"},{"line_number":1825,"context_line":""},{"line_number":1826,"context_line":"        if (versionutils.convert_version_to_tuple("},{"line_number":1827,"context_line":"                allocation_request_version) \u003e\u003d"},{"line_number":1828,"context_line":"                versionutils.convert_version_to_tuple("},{"line_number":1829,"context_line":"                    CONSUMER_GENERATION_VERSION)):"},{"line_number":1830,"context_line":"            payload[\u0027consumer_generation\u0027] \u003d consumer_generation"},{"line_number":1831,"context_line":""},{"line_number":1832,"context_line":"        r \u003d self.put(url, payload, version\u003dallocation_request_version,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_64a836d8","line":1829,"range":{"start_line":1826,"start_character":0,"end_line":1829,"end_character":50},"updated":"2018-10-03 16:25:03.000000000","message":"Yeah, I\u0027m not sure how this helps anything.\n\nThe GET /a_c result never has consumer generations in it.  I think we can and should *always* use CONSUMER_GENERATION_VERSION on L1832. In fact, I suspect we may even be able to get rid of the allocation_request_version hack entirely.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":1823,"context_line":"        payload[\u0027project_id\u0027] \u003d project_id"},{"line_number":1824,"context_line":"        payload[\u0027user_id\u0027] \u003d user_id"},{"line_number":1825,"context_line":""},{"line_number":1826,"context_line":"        if (versionutils.convert_version_to_tuple("},{"line_number":1827,"context_line":"                allocation_request_version) \u003e\u003d"},{"line_number":1828,"context_line":"                versionutils.convert_version_to_tuple("},{"line_number":1829,"context_line":"                    CONSUMER_GENERATION_VERSION)):"},{"line_number":1830,"context_line":"            payload[\u0027consumer_generation\u0027] \u003d consumer_generation"},{"line_number":1831,"context_line":""},{"line_number":1832,"context_line":"        r \u003d self.put(url, payload, version\u003dallocation_request_version,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_5c6dbfc8","line":1829,"range":{"start_line":1826,"start_character":0,"end_line":1829,"end_character":50},"in_reply_to":"3f79a3b5_64a836d8","updated":"2018-10-04 11:47:56.000000000","message":"I don\u0027t know if you saw this discussion with Jay[1] in an earlyer PS. If you still feel after [1] that passing along versions are not needed and instead use a common constant both in get_allocation_candidates and in claim_resources then I\u0027m happy to implement that and drop this code.\n\n[1]https://review.openstack.org/#/c/583667/25/nova/scheduler/client/report.py@a1792","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"4724bbe158cf7628abc7888b97b8ac2d18b2ade2","unresolved":false,"context_lines":[{"line_number":1755,"context_line":"    @retries"},{"line_number":1756,"context_line":"    def claim_resources(self, context, consumer_uuid, alloc_request,"},{"line_number":1757,"context_line":"                        project_id, user_id, allocation_request_version,"},{"line_number":1758,"context_line":"                        consumer_generation\u003dNone):"},{"line_number":1759,"context_line":"        \"\"\"Creates allocation records for the supplied instance UUID against"},{"line_number":1760,"context_line":"        the supplied resource providers."},{"line_number":1761,"context_line":""}],"source_content_type":"text/x-python","patch_set":29,"id":"3f79a3b5_bda16a94","line":1758,"range":{"start_line":1758,"start_character":23,"end_line":1758,"end_character":50},"updated":"2018-10-04 13:21:02.000000000","message":"much cleaner to use the named kwarg in this way, I think. ++","commit_id":"37301f2f278a3702369eec957402e36d53068973"}],"nova/scheduler/utils.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":498,"context_line":"    # Get the current allocations for the source node and the instance."},{"line_number":499,"context_line":"    if not source_node_allocations:"},{"line_number":500,"context_line":"        # NOTE(gibi): This is the forced evacuate case where the caller did not"},{"line_number":501,"context_line":"        # provided any allocation request. So we ask placement here for the"},{"line_number":502,"context_line":"        # current allocation and consumer generation and use that for the new"},{"line_number":503,"context_line":"        # allocation on the dest_node. If the allocation fails due to consumer"},{"line_number":504,"context_line":"        # generation conflict we have to retry this function only."}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_ba11bbb1","line":501,"range":{"start_line":501,"start_character":10,"end_line":501,"end_character":18},"updated":"2018-10-01 16:21:15.000000000","message":"provide","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":498,"context_line":"    # Get the current allocations for the source node and the instance."},{"line_number":499,"context_line":"    if not source_node_allocations:"},{"line_number":500,"context_line":"        # NOTE(gibi): This is the forced evacuate case where the caller did not"},{"line_number":501,"context_line":"        # provided any allocation request. So we ask placement here for the"},{"line_number":502,"context_line":"        # current allocation and consumer generation and use that for the new"},{"line_number":503,"context_line":"        # allocation on the dest_node. If the allocation fails due to consumer"},{"line_number":504,"context_line":"        # generation conflict we have to retry this function only."}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_cf406962","line":501,"range":{"start_line":501,"start_character":10,"end_line":501,"end_character":18},"in_reply_to":"3f79a3b5_ba11bbb1","updated":"2018-10-02 14:03:18.000000000","message":"Done","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":518,"context_line":"        alloc_request \u003d {"},{"line_number":519,"context_line":"            \u0027allocations\u0027: {"},{"line_number":520,"context_line":"                dest_node.uuid: {\u0027resources\u0027: source_node_allocations}"},{"line_number":521,"context_line":"            },"},{"line_number":522,"context_line":"            \u0027consumer_generation\u0027: consumer_generation"},{"line_number":523,"context_line":"        }"},{"line_number":524,"context_line":"        # The claim_resources method will check for existing allocations"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_5a39873c","line":521,"updated":"2018-10-01 16:21:15.000000000","message":"as mentioned in a previous comment, the allocation_request returned by GET /allocation_candidates does not include a consumer generation, so it feels a little odd to put consumer_generation into the allocation request dict here and pass that to the claim_resource() function instead of just adding a new consumer_generation named kwarg to the claim_resources() function and passing this data in that way.","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":518,"context_line":"        alloc_request \u003d {"},{"line_number":519,"context_line":"            \u0027allocations\u0027: {"},{"line_number":520,"context_line":"                dest_node.uuid: {\u0027resources\u0027: source_node_allocations}"},{"line_number":521,"context_line":"            },"},{"line_number":522,"context_line":"            \u0027consumer_generation\u0027: consumer_generation"},{"line_number":523,"context_line":"        }"},{"line_number":524,"context_line":"        # The claim_resources method will check for existing allocations"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_8f3fd1b3","line":521,"in_reply_to":"3f79a3b5_5a39873c","updated":"2018-10-02 14:03:18.000000000","message":"Done.","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f56cce9ffe3c917d55fc837a7b4cc56f614f9726","unresolved":false,"context_lines":[{"line_number":529,"context_line":"        if reportclient.claim_resources("},{"line_number":530,"context_line":"                context, instance.uuid, alloc_request,"},{"line_number":531,"context_line":"                instance.project_id, instance.user_id,"},{"line_number":532,"context_line":"                allocation_request_version\u003d\u00271.28\u0027):"},{"line_number":533,"context_line":"            LOG.debug(\u0027Instance allocations successfully created on \u0027"},{"line_number":534,"context_line":"                      \u0027destination node %(dest)s: %(alloc_request)s\u0027,"},{"line_number":535,"context_line":"                      {\u0027dest\u0027: dest_node.uuid,"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_5a22e702","line":532,"range":{"start_line":532,"start_character":43,"end_line":532,"end_character":49},"updated":"2018-10-01 16:21:15.000000000","message":"might be nice to use a constant here.","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"9eb67dcb21fa37dcf83f4d95848efe15239c6051","unresolved":false,"context_lines":[{"line_number":529,"context_line":"        if reportclient.claim_resources("},{"line_number":530,"context_line":"                context, instance.uuid, alloc_request,"},{"line_number":531,"context_line":"                instance.project_id, instance.user_id,"},{"line_number":532,"context_line":"                allocation_request_version\u003d\u00271.28\u0027):"},{"line_number":533,"context_line":"            LOG.debug(\u0027Instance allocations successfully created on \u0027"},{"line_number":534,"context_line":"                      \u0027destination node %(dest)s: %(alloc_request)s\u0027,"},{"line_number":535,"context_line":"                      {\u0027dest\u0027: dest_node.uuid,"}],"source_content_type":"text/x-python","patch_set":25,"id":"3f79a3b5_12d1a457","line":532,"range":{"start_line":532,"start_character":43,"end_line":532,"end_character":49},"in_reply_to":"3f79a3b5_5a22e702","updated":"2018-10-02 14:03:18.000000000","message":"Done","commit_id":"65bb8e604c597138995edbed6d1688109427a733"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":473,"context_line":"# some sort of skip_filters flag."},{"line_number":474,"context_line":"def claim_resources_on_destination("},{"line_number":475,"context_line":"        context, reportclient, instance, source_node, dest_node,"},{"line_number":476,"context_line":"        source_node_allocations\u003dNone, consumer_generation\u003dNone):"},{"line_number":477,"context_line":"    \"\"\"Copies allocations from source node to dest node in Placement"},{"line_number":478,"context_line":""},{"line_number":479,"context_line":"    Normally the scheduler will allocate resources on a chosen destination"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_e438c69f","line":476,"range":{"start_line":476,"start_character":38,"end_line":476,"end_character":57},"updated":"2018-10-03 16:25:03.000000000","message":"add to docstring","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":473,"context_line":"# some sort of skip_filters flag."},{"line_number":474,"context_line":"def claim_resources_on_destination("},{"line_number":475,"context_line":"        context, reportclient, instance, source_node, dest_node,"},{"line_number":476,"context_line":"        source_node_allocations\u003dNone, consumer_generation\u003dNone):"},{"line_number":477,"context_line":"    \"\"\"Copies allocations from source node to dest node in Placement"},{"line_number":478,"context_line":""},{"line_number":479,"context_line":"    Normally the scheduler will allocate resources on a chosen destination"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_1777203d","line":476,"range":{"start_line":476,"start_character":38,"end_line":476,"end_character":57},"in_reply_to":"3f79a3b5_e438c69f","updated":"2018-10-04 11:47:56.000000000","message":"Done","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":501,"context_line":"        # provide any allocation request. So we ask placement here for the"},{"line_number":502,"context_line":"        # current allocation and consumer generation and use that for the new"},{"line_number":503,"context_line":"        # allocation on the dest_node. If the allocation fails due to consumer"},{"line_number":504,"context_line":"        # generation conflict we have to retry this function only."},{"line_number":505,"context_line":"        allocations \u003d reportclient.get_allocs_for_consumer("},{"line_number":506,"context_line":"            context, instance.uuid)"},{"line_number":507,"context_line":"        source_node_allocations \u003d allocations.get("}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_c4034abd","line":504,"range":{"start_line":504,"start_character":41,"end_line":504,"end_character":46},"updated":"2018-10-03 16:25:03.000000000","message":"where does that happen?","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":501,"context_line":"        # provide any allocation request. So we ask placement here for the"},{"line_number":502,"context_line":"        # current allocation and consumer generation and use that for the new"},{"line_number":503,"context_line":"        # allocation on the dest_node. If the allocation fails due to consumer"},{"line_number":504,"context_line":"        # generation conflict we have to retry this function only."},{"line_number":505,"context_line":"        allocations \u003d reportclient.get_allocs_for_consumer("},{"line_number":506,"context_line":"            context, instance.uuid)"},{"line_number":507,"context_line":"        source_node_allocations \u003d allocations.get("}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_37933c50","line":504,"range":{"start_line":504,"start_character":41,"end_line":504,"end_character":46},"in_reply_to":"3f79a3b5_c4034abd","updated":"2018-10-04 11:47:56.000000000","message":"Old note needs to be updated.\nDone.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":502,"context_line":"        # current allocation and consumer generation and use that for the new"},{"line_number":503,"context_line":"        # allocation on the dest_node. If the allocation fails due to consumer"},{"line_number":504,"context_line":"        # generation conflict we have to retry this function only."},{"line_number":505,"context_line":"        allocations \u003d reportclient.get_allocs_for_consumer("},{"line_number":506,"context_line":"            context, instance.uuid)"},{"line_number":507,"context_line":"        source_node_allocations \u003d allocations.get("},{"line_number":508,"context_line":"            \u0027allocations\u0027, {}).get(source_node.uuid, {}).get(\u0027resources\u0027)"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_2411def8","line":505,"range":{"start_line":505,"start_character":35,"end_line":505,"end_character":58},"updated":"2018-10-03 16:25:03.000000000","message":"This method now\n\n :raises: keystoneauth1.exceptions.base.ClientException on failure to\n          communicate with the placement API\n :raises: ConsumerAllocationRetrievalFailed if the placement API call\n          fails\n\nwhich should be added to the docstring.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":502,"context_line":"        # current allocation and consumer generation and use that for the new"},{"line_number":503,"context_line":"        # allocation on the dest_node. If the allocation fails due to consumer"},{"line_number":504,"context_line":"        # generation conflict we have to retry this function only."},{"line_number":505,"context_line":"        allocations \u003d reportclient.get_allocs_for_consumer("},{"line_number":506,"context_line":"            context, instance.uuid)"},{"line_number":507,"context_line":"        source_node_allocations \u003d allocations.get("},{"line_number":508,"context_line":"            \u0027allocations\u0027, {}).get(source_node.uuid, {}).get(\u0027resources\u0027)"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_f7c94459","line":505,"range":{"start_line":505,"start_character":35,"end_line":505,"end_character":58},"in_reply_to":"3f79a3b5_2411def8","updated":"2018-10-04 11:47:56.000000000","message":"Done","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":520,"context_line":"                dest_node.uuid: {\u0027resources\u0027: source_node_allocations}"},{"line_number":521,"context_line":"            },"},{"line_number":522,"context_line":"        }"},{"line_number":523,"context_line":"        # import locally to avoid cyclic import"},{"line_number":524,"context_line":"        from nova.scheduler.client import report"},{"line_number":525,"context_line":"        # The claim_resources method will check for existing allocations"},{"line_number":526,"context_line":"        # for the instance and effectively \"double up\" the allocations for"},{"line_number":527,"context_line":"        # both the source and destination node. That\u0027s why when requesting"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_24bf9eca","line":524,"range":{"start_line":523,"start_character":8,"end_line":524,"end_character":48},"updated":"2018-10-03 16:25:03.000000000","message":"Yuck. Makes a guy think we should move the version consts into this module.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":520,"context_line":"                dest_node.uuid: {\u0027resources\u0027: source_node_allocations}"},{"line_number":521,"context_line":"            },"},{"line_number":522,"context_line":"        }"},{"line_number":523,"context_line":"        # import locally to avoid cyclic import"},{"line_number":524,"context_line":"        from nova.scheduler.client import report"},{"line_number":525,"context_line":"        # The claim_resources method will check for existing allocations"},{"line_number":526,"context_line":"        # for the instance and effectively \"double up\" the allocations for"},{"line_number":527,"context_line":"        # both the source and destination node. That\u0027s why when requesting"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_37fa5c76","line":524,"range":{"start_line":523,"start_character":8,"end_line":524,"end_character":48},"in_reply_to":"3f79a3b5_24bf9eca","updated":"2018-10-04 11:47:56.000000000","message":"The report module depends a lot more on this constant than the utils module so I don\u0027t like the idea to move it. I agree that this is a mess. (In general having utils module is a bad practice in my eyes). Alternatively I could create a new, module scheduler/constants and move this there.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":993,"context_line":"    user_id \u003d ctx.user_id"},{"line_number":994,"context_line":""},{"line_number":995,"context_line":"    # NOTE(gibi): this could raise ConsumerUpdateConflict which means there is"},{"line_number":996,"context_line":"    # a serious issue with the instance_uuid as a consumer. Every caller of"},{"line_number":997,"context_line":"    # utils.claim_resources() assumes that instance_uuid will be a new consumer"},{"line_number":998,"context_line":"    # and reportclient.claim_resources() also assumes this as the provided"},{"line_number":999,"context_line":"    # alloc_req does not specify any consumer_generation. If the claim fails"},{"line_number":1000,"context_line":"    # due to consumer generation conflict, which in this case means the"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_e49686ef","line":997,"range":{"start_line":996,"start_character":60,"end_line":997,"end_character":79},"updated":"2018-10-03 16:25:03.000000000","message":"I\u0027m confused. If this is true, then consumer_generation should always be None and we don\u0027t need the new kwarg.","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":993,"context_line":"    user_id \u003d ctx.user_id"},{"line_number":994,"context_line":""},{"line_number":995,"context_line":"    # NOTE(gibi): this could raise ConsumerUpdateConflict which means there is"},{"line_number":996,"context_line":"    # a serious issue with the instance_uuid as a consumer. Every caller of"},{"line_number":997,"context_line":"    # utils.claim_resources() assumes that instance_uuid will be a new consumer"},{"line_number":998,"context_line":"    # and reportclient.claim_resources() also assumes this as the provided"},{"line_number":999,"context_line":"    # alloc_req does not specify any consumer_generation. If the claim fails"},{"line_number":1000,"context_line":"    # due to consumer generation conflict, which in this case means the"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_9715709d","line":997,"range":{"start_line":996,"start_character":60,"end_line":997,"end_character":79},"in_reply_to":"3f79a3b5_e49686ef","updated":"2018-10-04 11:47:56.000000000","message":"You are right this function always called with consumer_generation\u003dNone so the kwarg can be dropped from here","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"}],"nova/tests/functional/test_servers.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":4511,"context_line":""},{"line_number":4512,"context_line":"        # I know that HTTP 500 is harsh code but I think this conflict case"},{"line_number":4513,"context_line":"        # signals either a serious db inconsistency or a bug in nova\u0027s"},{"line_number":4514,"context_line":"        # claim code."},{"line_number":4515,"context_line":"        self.assertEqual(500, exception.response.status_code)"},{"line_number":4516,"context_line":""},{"line_number":4517,"context_line":"        # The migration is aborted so the instance is ACTIVE on the source"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_048dc2d2","line":4514,"updated":"2018-10-03 16:25:03.000000000","message":"++","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"4724bbe158cf7628abc7888b97b8ac2d18b2ade2","unresolved":false,"context_lines":[{"line_number":4454,"context_line":"    def test_create_server_fails_as_placement_reports_consumer_conflict(self):"},{"line_number":4455,"context_line":"        server_req \u003d self._build_minimal_create_server_request("},{"line_number":4456,"context_line":"            self.api, \u0027some-server\u0027, flavor_id\u003dself.flavor[\u0027id\u0027],"},{"line_number":4457,"context_line":"            image_uuid\u003d\u0027155d900f-4e14-4e4c-a73d-069cbf4541e6\u0027,"},{"line_number":4458,"context_line":"            networks\u003d\u0027none\u0027)"},{"line_number":4459,"context_line":""},{"line_number":4460,"context_line":"        # We cannot pre-create a consumer with the uuid of the instance created"}],"source_content_type":"text/x-python","patch_set":29,"id":"3f79a3b5_dd25460b","line":4457,"range":{"start_line":4457,"start_character":23,"end_line":4457,"end_character":61},"updated":"2018-10-04 13:21:02.000000000","message":"in future, consider using uuidsentinel to name UUIDs","commit_id":"37301f2f278a3702369eec957402e36d53068973"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"62db2abf17ab28445eb8f05bfbd865f3b6ee5bcb","unresolved":false,"context_lines":[{"line_number":4454,"context_line":"    def test_create_server_fails_as_placement_reports_consumer_conflict(self):"},{"line_number":4455,"context_line":"        server_req \u003d self._build_minimal_create_server_request("},{"line_number":4456,"context_line":"            self.api, \u0027some-server\u0027, flavor_id\u003dself.flavor[\u0027id\u0027],"},{"line_number":4457,"context_line":"            image_uuid\u003d\u0027155d900f-4e14-4e4c-a73d-069cbf4541e6\u0027,"},{"line_number":4458,"context_line":"            networks\u003d\u0027none\u0027)"},{"line_number":4459,"context_line":""},{"line_number":4460,"context_line":"        # We cannot pre-create a consumer with the uuid of the instance created"}],"source_content_type":"text/x-python","patch_set":29,"id":"3f79a3b5_66e490a9","line":4457,"range":{"start_line":4457,"start_character":23,"end_line":4457,"end_character":61},"in_reply_to":"3f79a3b5_dd25460b","updated":"2018-10-05 08:25:34.000000000","message":"This is coming from the fake image service the test env uses :/","commit_id":"37301f2f278a3702369eec957402e36d53068973"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"4724bbe158cf7628abc7888b97b8ac2d18b2ade2","unresolved":false,"context_lines":[{"line_number":4511,"context_line":""},{"line_number":4512,"context_line":"        # I know that HTTP 500 is harsh code but I think this conflict case"},{"line_number":4513,"context_line":"        # signals either a serious db inconsistency or a bug in nova\u0027s"},{"line_number":4514,"context_line":"        # claim code."},{"line_number":4515,"context_line":"        self.assertEqual(500, exception.response.status_code)"},{"line_number":4516,"context_line":""},{"line_number":4517,"context_line":"        # The migration is aborted so the instance is ACTIVE on the source"}],"source_content_type":"text/x-python","patch_set":29,"id":"3f79a3b5_fd584257","line":4514,"updated":"2018-10-04 13:21:02.000000000","message":"Yeah, I agree with you and think 500 is appropriate for this and the above scenario. It\u0027s a serious data corruption bug if this happens.","commit_id":"37301f2f278a3702369eec957402e36d53068973"}],"nova/tests/unit/scheduler/client/test_report.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":419,"context_line":"        \"\"\""},{"line_number":420,"context_line":"        get_resp_mock \u003d mock.Mock(status_code\u003d200)"},{"line_number":421,"context_line":"        get_resp_mock.json.return_value \u003d {"},{"line_number":422,"context_line":"            \u0027allocations\u0027: {},  # build instance, not move"},{"line_number":423,"context_line":"        }"},{"line_number":424,"context_line":"        self.ks_adap_mock.get.return_value \u003d get_resp_mock"},{"line_number":425,"context_line":"        resp_mock \u003d mock.Mock(status_code\u003d204)"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_24a1de3a","line":422,"updated":"2018-10-03 16:25:03.000000000","message":"Oh, is this what happens, not 404?","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":419,"context_line":"        \"\"\""},{"line_number":420,"context_line":"        get_resp_mock \u003d mock.Mock(status_code\u003d200)"},{"line_number":421,"context_line":"        get_resp_mock.json.return_value \u003d {"},{"line_number":422,"context_line":"            \u0027allocations\u0027: {},  # build instance, not move"},{"line_number":423,"context_line":"        }"},{"line_number":424,"context_line":"        self.ks_adap_mock.get.return_value \u003d get_resp_mock"},{"line_number":425,"context_line":"        resp_mock \u003d mock.Mock(status_code\u003d204)"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_891b187e","line":422,"in_reply_to":"3f79a3b5_24a1de3a","updated":"2018-10-04 11:47:56.000000000","message":"If you call GET /allocations/{non-existent-consumer-uuid} then placement will auto create the consumer with empty allocations. \n\nstack@ubuntu:~$ curl -g -i -X GET http://100.109.0.10/placement/allocations/031f40fd-a55d-43f2-8a51-65548770611f -H \"Accept: application/json\" -H \"OpenStack-API-Version: placement 1.28\" -H \"X-Auth-Token: gAAAAABbqW_NadBnGTUbf46WEYksf1ce9D9VN9UFD49PclFcGEqwjAi717PxvAb1DBjS-vH2Ti2IgcYpGmbkxbb0zNyY5Ax5s4pdghrcpjfsU1j_bbIz4zIZgh6VYPprljAucfXnbu8r1ind6kFE0YSAawZXX2F5FQ_QhUt09aPjOLB2-AIW628\"\nHTTP/1.1 200 OK\nDate: Mon, 24 Sep 2018 23:15:30 GMT\nServer: Apache/2.4.18 (Ubuntu)\nContent-Length: 19\nContent-Type: application/json\nLast-Modified: Mon, 24 Sep 2018 23:15:30 GMT\nCache-Control: no-cache\nopenstack-api-version: placement 1.28\nvary: openstack-api-version\nx-openstack-request-id: req-56f74367-8e26-4182-a25f-96e0cee0277d\nConnection: close\n\n{\"allocations\": {}}\nstack@ubuntu:~$","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"58d09b9a12e1813b03525db46695a997f293dd26","unresolved":false,"context_lines":[{"line_number":419,"context_line":"        \"\"\""},{"line_number":420,"context_line":"        get_resp_mock \u003d mock.Mock(status_code\u003d200)"},{"line_number":421,"context_line":"        get_resp_mock.json.return_value \u003d {"},{"line_number":422,"context_line":"            \u0027allocations\u0027: {},  # build instance, not move"},{"line_number":423,"context_line":"        }"},{"line_number":424,"context_line":"        self.ks_adap_mock.get.return_value \u003d get_resp_mock"},{"line_number":425,"context_line":"        resp_mock \u003d mock.Mock(status_code\u003d204)"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_bf62c2a5","line":422,"in_reply_to":"3f79a3b5_891b187e","updated":"2018-10-04 11:57:46.000000000","message":"There\u0027s a bug that related to these issues: https://bugs.launchpad.net/nova/+bug/1778591","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":514,"context_line":"                },"},{"line_number":515,"context_line":"            },"},{"line_number":516,"context_line":"            # report client assumes a new consumer in this case"},{"line_number":517,"context_line":"            \u0027consumer_generation\u0027: None,"},{"line_number":518,"context_line":"            \u0027project_id\u0027: project_id,"},{"line_number":519,"context_line":"            \u0027user_id\u0027: user_id}"},{"line_number":520,"context_line":"        self.ks_adap_mock.put.assert_called_once_with("}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_c44a6a81","line":517,"updated":"2018-10-03 16:25:03.000000000","message":"✔","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":532,"context_line":"        exists against the same host RP and the shared RP but with the"},{"line_number":533,"context_line":"        migration_uuid."},{"line_number":534,"context_line":"        \"\"\""},{"line_number":535,"context_line":"        get_current_allocations_resp_mock \u003d mock.Mock(status_code\u003d200)"},{"line_number":536,"context_line":"        # source host allocation held by the migration_uuid so it is not"},{"line_number":537,"context_line":"        # not returned to the claim code as that asks for the instance_uuid"},{"line_number":538,"context_line":"        # consumer"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_dfea330c","line":535,"updated":"2018-10-03 16:25:03.000000000","message":"consider FakeResponse","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":532,"context_line":"        exists against the same host RP and the shared RP but with the"},{"line_number":533,"context_line":"        migration_uuid."},{"line_number":534,"context_line":"        \"\"\""},{"line_number":535,"context_line":"        get_current_allocations_resp_mock \u003d mock.Mock(status_code\u003d200)"},{"line_number":536,"context_line":"        # source host allocation held by the migration_uuid so it is not"},{"line_number":537,"context_line":"        # not returned to the claim code as that asks for the instance_uuid"},{"line_number":538,"context_line":"        # consumer"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_0907081f","line":535,"in_reply_to":"3f79a3b5_dfea330c","updated":"2018-10-04 11:47:56.000000000","message":"In this case that would be a bit unrelated change. We should do a separate change (or changes) where every resp mock is replaced with FakeResponse","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":610,"context_line":"    def test_claim_resources_success_evacuate_no_shared(self):"},{"line_number":611,"context_line":"        \"\"\"Tests non-forced evacuate. In this case both the source and the"},{"line_number":612,"context_line":"        dest allocation are held by the instance_uuid in placement. So the"},{"line_number":613,"context_line":"        claim code need to merge allocations. The second claim come from the"},{"line_number":614,"context_line":"        scheduler and therefore it does not have consumer_generation in it."},{"line_number":615,"context_line":"        \"\"\""},{"line_number":616,"context_line":"        get_current_allocations_resp_mock \u003d mock.Mock(status_code\u003d200)"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_bfd09754","line":613,"range":{"start_line":613,"start_character":63,"end_line":613,"end_character":67},"updated":"2018-10-03 16:25:03.000000000","message":"comes","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":610,"context_line":"    def test_claim_resources_success_evacuate_no_shared(self):"},{"line_number":611,"context_line":"        \"\"\"Tests non-forced evacuate. In this case both the source and the"},{"line_number":612,"context_line":"        dest allocation are held by the instance_uuid in placement. So the"},{"line_number":613,"context_line":"        claim code need to merge allocations. The second claim come from the"},{"line_number":614,"context_line":"        scheduler and therefore it does not have consumer_generation in it."},{"line_number":615,"context_line":"        \"\"\""},{"line_number":616,"context_line":"        get_current_allocations_resp_mock \u003d mock.Mock(status_code\u003d200)"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_1fdc2b6f","line":613,"range":{"start_line":613,"start_character":19,"end_line":613,"end_character":23},"updated":"2018-10-03 16:25:03.000000000","message":"needs","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":610,"context_line":"    def test_claim_resources_success_evacuate_no_shared(self):"},{"line_number":611,"context_line":"        \"\"\"Tests non-forced evacuate. In this case both the source and the"},{"line_number":612,"context_line":"        dest allocation are held by the instance_uuid in placement. So the"},{"line_number":613,"context_line":"        claim code need to merge allocations. The second claim come from the"},{"line_number":614,"context_line":"        scheduler and therefore it does not have consumer_generation in it."},{"line_number":615,"context_line":"        \"\"\""},{"line_number":616,"context_line":"        get_current_allocations_resp_mock \u003d mock.Mock(status_code\u003d200)"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_8c000602","line":613,"range":{"start_line":613,"start_character":19,"end_line":613,"end_character":23},"in_reply_to":"3f79a3b5_1fdc2b6f","updated":"2018-10-04 11:47:56.000000000","message":"Done","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":610,"context_line":"    def test_claim_resources_success_evacuate_no_shared(self):"},{"line_number":611,"context_line":"        \"\"\"Tests non-forced evacuate. In this case both the source and the"},{"line_number":612,"context_line":"        dest allocation are held by the instance_uuid in placement. So the"},{"line_number":613,"context_line":"        claim code need to merge allocations. The second claim come from the"},{"line_number":614,"context_line":"        scheduler and therefore it does not have consumer_generation in it."},{"line_number":615,"context_line":"        \"\"\""},{"line_number":616,"context_line":"        get_current_allocations_resp_mock \u003d mock.Mock(status_code\u003d200)"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_2c03f20d","line":613,"range":{"start_line":613,"start_character":63,"end_line":613,"end_character":67},"in_reply_to":"3f79a3b5_bfd09754","updated":"2018-10-04 11:47:56.000000000","message":"Done","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":613,"context_line":"        claim code need to merge allocations. The second claim come from the"},{"line_number":614,"context_line":"        scheduler and therefore it does not have consumer_generation in it."},{"line_number":615,"context_line":"        \"\"\""},{"line_number":616,"context_line":"        get_current_allocations_resp_mock \u003d mock.Mock(status_code\u003d200)"},{"line_number":617,"context_line":"        # the source allocation is also held by the instance_uuid so report"},{"line_number":618,"context_line":"        # client will see it."},{"line_number":619,"context_line":"        get_current_allocations_resp_mock.json.return_value \u003d {"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_df38f39f","line":616,"updated":"2018-10-03 16:25:03.000000000","message":"FakeResponse","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":613,"context_line":"        claim code need to merge allocations. The second claim come from the"},{"line_number":614,"context_line":"        scheduler and therefore it does not have consumer_generation in it."},{"line_number":615,"context_line":"        \"\"\""},{"line_number":616,"context_line":"        get_current_allocations_resp_mock \u003d mock.Mock(status_code\u003d200)"},{"line_number":617,"context_line":"        # the source allocation is also held by the instance_uuid so report"},{"line_number":618,"context_line":"        # client will see it."},{"line_number":619,"context_line":"        get_current_allocations_resp_mock.json.return_value \u003d {"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_cc583e26","line":616,"in_reply_to":"3f79a3b5_df38f39f","updated":"2018-10-04 11:47:56.000000000","message":"Done","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":633,"context_line":"        }"},{"line_number":634,"context_line":""},{"line_number":635,"context_line":"        self.ks_adap_mock.get.return_value \u003d get_current_allocations_resp_mock"},{"line_number":636,"context_line":"        put_allocations_resp_mock \u003d mock.Mock(status_code\u003d204)"},{"line_number":637,"context_line":"        self.ks_adap_mock.put.return_value \u003d put_allocations_resp_mock"},{"line_number":638,"context_line":"        consumer_uuid \u003d uuids.consumer_uuid"},{"line_number":639,"context_line":"        # this is an evacuate so we have the same resources request towards the"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_ff4e0f37","line":636,"range":{"start_line":636,"start_character":0,"end_line":636,"end_character":62},"updated":"2018-10-03 16:25:03.000000000","message":"\"\n\n...throughout","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":633,"context_line":"        }"},{"line_number":634,"context_line":""},{"line_number":635,"context_line":"        self.ks_adap_mock.get.return_value \u003d get_current_allocations_resp_mock"},{"line_number":636,"context_line":"        put_allocations_resp_mock \u003d mock.Mock(status_code\u003d204)"},{"line_number":637,"context_line":"        self.ks_adap_mock.put.return_value \u003d put_allocations_resp_mock"},{"line_number":638,"context_line":"        consumer_uuid \u003d uuids.consumer_uuid"},{"line_number":639,"context_line":"        # this is an evacuate so we have the same resources request towards the"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_8c9c86bf","line":636,"range":{"start_line":636,"start_character":0,"end_line":636,"end_character":62},"in_reply_to":"3f79a3b5_ff4e0f37","updated":"2018-10-04 11:47:56.000000000","message":"Done","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8849ba477f5b781c000e6f071b76b0ff7111ea43","unresolved":false,"context_lines":[{"line_number":679,"context_line":"                    }"},{"line_number":680,"context_line":"                },"},{"line_number":681,"context_line":"            },"},{"line_number":682,"context_line":"            # report client uses the consumer_generation that got from"},{"line_number":683,"context_line":"            # placement when asked for the existing allocations"},{"line_number":684,"context_line":"            \u0027consumer_generation\u0027: 1,"},{"line_number":685,"context_line":"            \u0027project_id\u0027: project_id,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_df61d3a9","line":682,"range":{"start_line":682,"start_character":62,"end_line":682,"end_character":65},"updated":"2018-10-03 16:25:03.000000000","message":"it got","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"fdb4ea02706bcd88c2cdebf60e8ab59780fdf6f7","unresolved":false,"context_lines":[{"line_number":679,"context_line":"                    }"},{"line_number":680,"context_line":"                },"},{"line_number":681,"context_line":"            },"},{"line_number":682,"context_line":"            # report client uses the consumer_generation that got from"},{"line_number":683,"context_line":"            # placement when asked for the existing allocations"},{"line_number":684,"context_line":"            \u0027consumer_generation\u0027: 1,"},{"line_number":685,"context_line":"            \u0027project_id\u0027: project_id,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3f79a3b5_ecac1aef","line":682,"range":{"start_line":682,"start_character":62,"end_line":682,"end_character":65},"in_reply_to":"3f79a3b5_df61d3a9","updated":"2018-10-04 11:47:56.000000000","message":"Done","commit_id":"7c9daf729d7c300d16da24d85329f536ae7e0616"}]}
