)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"2e628f71cc96f0edbc44fe7becbcb77b91df7a99","unresolved":true,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"The depends on is to get nova functional tests passing them. Some of"},{"line_number":24,"context_line":"them create allocations with \u0027placement latest\u0027."},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"Co-Authored-By: Surya Seetharaman \u003csuryaseetharaman.9@gmail.com\u003e"},{"line_number":27,"context_line":"Co-Authored-By: melanie witt \u003cmelwittt@gmail.com\u003e"},{"line_number":28,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":16,"id":"3ad124e9_0f3028f1","line":25,"updated":"2021-04-27 15:52:31.000000000","message":"So if I understand there is no way to make the consumer_type mandatory in the future as the older microversions still allow not providing it. What we can do is that make a nova change where we make sure that all the nova allocations has a proper consumer_type and make some reshape that adds consumer_type to existing nova allocations. Then from nova perspective the consumer_type becomes filled all the time and therefore it can be used for counting quota.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"3512da936be4510b22b795ddd2466195628ea5e0","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"The depends on is to get nova functional tests passing them. Some of"},{"line_number":24,"context_line":"them create allocations with \u0027placement latest\u0027."},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"Co-Authored-By: Surya Seetharaman \u003csuryaseetharaman.9@gmail.com\u003e"},{"line_number":27,"context_line":"Co-Authored-By: melanie witt \u003cmelwittt@gmail.com\u003e"},{"line_number":28,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":16,"id":"964356f9_3d363627","line":25,"in_reply_to":"1f331f1f_f248a37e","updated":"2021-05-03 10:43:00.000000000","message":"Ack","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"02540ab141a781586538df7368c3ca392edca9fb","unresolved":true,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"The depends on is to get nova functional tests passing them. Some of"},{"line_number":24,"context_line":"them create allocations with \u0027placement latest\u0027."},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"Co-Authored-By: Surya Seetharaman \u003csuryaseetharaman.9@gmail.com\u003e"},{"line_number":27,"context_line":"Co-Authored-By: melanie witt \u003cmelwittt@gmail.com\u003e"},{"line_number":28,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":16,"id":"1f331f1f_f248a37e","line":25,"in_reply_to":"3ad124e9_0f3028f1","updated":"2021-04-27 22:29:57.000000000","message":"Yes that is basically the plan for consumption by nova. Nova has to do an initial \"apply consumer_type to existing allocations\" online data migration in version N meanwhile using the new placement microversion so all new allocations get PUT with a consumer_type.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"}],"api-ref/source/allocations.inc":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"82a60fdbcca86314318367e3187f938c089d7548","unresolved":false,"context_lines":[{"line_number":44,"context_line":""},{"line_number":45,"context_line":"  - consumer_uuid: consumer_uuid_body"},{"line_number":46,"context_line":"  - consumer_generation: consumer_generation_min"},{"line_number":47,"context_line":"  - consumer_type: consumer_type"},{"line_number":48,"context_line":"  - project_id: project_id_body"},{"line_number":49,"context_line":"  - user_id: user_id_body"},{"line_number":50,"context_line":"  - allocations: allocations_dict_empty"}],"source_content_type":"text/x-c++src","patch_set":3,"id":"7faddb67_27fe2205","line":47,"updated":"2019-08-30 16:16:05.000000000","message":"I\u0027ve not done the corresponding new JSON files for these things as sometimes that just feels like overkill. But if people would like them I can add them.","commit_id":"f74e10ffda683fe8b07b04630d18a1c4b7976775"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"d8dec865854efe12377632588d1a17153be7d6c8","unresolved":false,"context_lines":[{"line_number":102,"context_line":"  - consumer_type: consumer_type"},{"line_number":103,"context_line":"  - project_id: project_id_body_1_12"},{"line_number":104,"context_line":"  - user_id: user_id_body_1_12"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"Response Example (1.28 - )"},{"line_number":107,"context_line":"--------------------------"},{"line_number":108,"context_line":""}],"source_content_type":"text/x-c++src","patch_set":10,"id":"3fa7e38b_9f9e56b5","line":105,"updated":"2020-02-07 02:55:39.000000000","message":"Oops I need to add Response Example 1.37","commit_id":"a929380b9893e66310e9bb96c56f37694590a261"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"d8dec865854efe12377632588d1a17153be7d6c8","unresolved":false,"context_lines":[{"line_number":148,"context_line":"  - allocations: allocations_dict"},{"line_number":149,"context_line":"  - resources: resources"},{"line_number":150,"context_line":"  - consumer_generation: consumer_generation_min"},{"line_number":151,"context_line":"  - consumer_type: consumer_type"},{"line_number":152,"context_line":"  - project_id: project_id_body"},{"line_number":153,"context_line":"  - user_id: user_id_body"},{"line_number":154,"context_line":"  - generation: resource_provider_generation_optional"}],"source_content_type":"text/x-c++src","patch_set":10,"id":"3fa7e38b_bfa1d2f8","line":151,"updated":"2020-02-07 02:55:39.000000000","message":"Hm, is this in the right section? Seems not.\n\nAlso need Request example for 1.37","commit_id":"a929380b9893e66310e9bb96c56f37694590a261"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"66758eddeb505bafcc8d909d0d557d8d816e788c","unresolved":false,"context_lines":[{"line_number":59,"context_line":"   :language: javascript"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"Request example (microversions 1.28 - 1.36)"},{"line_number":62,"context_line":"---------------------------------------"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":".. literalinclude:: ./samples/allocations/manage-allocations-request-1.28.json"},{"line_number":65,"context_line":"   :language: javascript"}],"source_content_type":"text/x-c++src","patch_set":12,"id":"1fa4df85_87c5eb90","line":62,"updated":"2020-02-26 20:36:28.000000000","message":"Warning, treated as error:\napi-ref/source/allocations.inc:62:Title underline too short.","commit_id":"9a06cb00ce043d43fdbca238bc93eda8da133648"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"66758eddeb505bafcc8d909d0d557d8d816e788c","unresolved":false,"context_lines":[{"line_number":116,"context_line":"   :language: javascript"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"Response Example (1.28 - 1.36)"},{"line_number":119,"context_line":"--------------------------"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":".. literalinclude:: ./samples/allocations/get-allocations-1.28.json"},{"line_number":122,"context_line":"   :language: javascript"}],"source_content_type":"text/x-c++src","patch_set":12,"id":"1fa4df85_a7c26784","line":119,"updated":"2020-02-26 20:36:28.000000000","message":"Same","commit_id":"9a06cb00ce043d43fdbca238bc93eda8da133648"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"66758eddeb505bafcc8d909d0d557d8d816e788c","unresolved":false,"context_lines":[{"line_number":173,"context_line":"   :language: javascript"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"Request example (microversions 1.28 - 1.36)"},{"line_number":176,"context_line":"---------------------------------------"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":".. literalinclude:: ./samples/allocations/update-allocations-request-1.28.json"},{"line_number":179,"context_line":"   :language: javascript"}],"source_content_type":"text/x-c++src","patch_set":12,"id":"1fa4df85_67bc6f05","line":176,"updated":"2020-02-26 20:36:28.000000000","message":"Same","commit_id":"9a06cb00ce043d43fdbca238bc93eda8da133648"}],"api-ref/source/parameters.yaml":[{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"ada61f0e41c98d17863cd59e26c7bcaadb922b74","unresolved":false,"context_lines":[{"line_number":207,"context_line":"    required: false"},{"line_number":208,"context_line":"    min_version: 1.37"},{"line_number":209,"context_line":"    description: |"},{"line_number":210,"context_line":"      A string, ``[A-Z]+``, describing the consumer type by which to filter"},{"line_number":211,"context_line":"      usage results. For example to retrieve only usage information for"},{"line_number":212,"context_line":"      \u0027INSTANCE\u0027 type consumers a parameter of ``consumer_type\u003dINSTANCE``"},{"line_number":213,"context_line":"      should be provided"}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_d3871b11","line":210,"range":{"start_line":210,"start_character":6,"end_line":210,"end_character":26},"updated":"2020-01-16 12:42:32.000000000","message":"A string that consist of numbers, ``A-Z`` and ``_``","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f65bc62b27ac8720b5e7e17edefd274978b6f1ac","unresolved":false,"context_lines":[{"line_number":207,"context_line":"    required: false"},{"line_number":208,"context_line":"    min_version: 1.37"},{"line_number":209,"context_line":"    description: |"},{"line_number":210,"context_line":"      A string, ``[A-Z]+``, describing the consumer type by which to filter"},{"line_number":211,"context_line":"      usage results. For example to retrieve only usage information for"},{"line_number":212,"context_line":"      \u0027INSTANCE\u0027 type consumers a parameter of ``consumer_type\u003dINSTANCE``"},{"line_number":213,"context_line":"      should be provided"}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_8cee36b4","line":210,"range":{"start_line":210,"start_character":6,"end_line":210,"end_character":26},"in_reply_to":"3fa7e38b_d3871b11","updated":"2020-02-07 02:40:12.000000000","message":"Done","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"ada61f0e41c98d17863cd59e26c7bcaadb922b74","unresolved":false,"context_lines":[{"line_number":210,"context_line":"      A string, ``[A-Z]+``, describing the consumer type by which to filter"},{"line_number":211,"context_line":"      usage results. For example to retrieve only usage information for"},{"line_number":212,"context_line":"      \u0027INSTANCE\u0027 type consumers a parameter of ``consumer_type\u003dINSTANCE``"},{"line_number":213,"context_line":"      should be provided"},{"line_number":214,"context_line":"project_id: \u0026project_id"},{"line_number":215,"context_line":"  type: string"},{"line_number":216,"context_line":"  in: query"}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_b395bf96","line":213,"updated":"2020-01-16 12:42:32.000000000","message":"Please mention \"all\" parameter here.","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f65bc62b27ac8720b5e7e17edefd274978b6f1ac","unresolved":false,"context_lines":[{"line_number":210,"context_line":"      A string, ``[A-Z]+``, describing the consumer type by which to filter"},{"line_number":211,"context_line":"      usage results. For example to retrieve only usage information for"},{"line_number":212,"context_line":"      \u0027INSTANCE\u0027 type consumers a parameter of ``consumer_type\u003dINSTANCE``"},{"line_number":213,"context_line":"      should be provided"},{"line_number":214,"context_line":"project_id: \u0026project_id"},{"line_number":215,"context_line":"  type: string"},{"line_number":216,"context_line":"  in: query"}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_2cedc2b7","line":213,"in_reply_to":"3fa7e38b_b395bf96","updated":"2020-02-07 02:40:12.000000000","message":"Done","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"ada61f0e41c98d17863cd59e26c7bcaadb922b74","unresolved":false,"context_lines":[{"line_number":512,"context_line":"  required: true"},{"line_number":513,"context_line":"  min_version: 1.37"},{"line_number":514,"context_line":"  description: \u003e"},{"line_number":515,"context_line":"    A string, ``[A-Z]+``, describing what kind of consumer is creating,"},{"line_number":516,"context_line":"    or has created, allocations using a quantity of inventory. The string"},{"line_number":517,"context_line":"    is determined by the client when writing allocations and it is up to"},{"line_number":518,"context_line":"    the client to ensure correct choices amongst collaborating services."}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_3378ef2a","line":515,"range":{"start_line":515,"start_character":4,"end_line":515,"end_character":24},"updated":"2020-01-16 12:42:32.000000000","message":"ditto","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f65bc62b27ac8720b5e7e17edefd274978b6f1ac","unresolved":false,"context_lines":[{"line_number":512,"context_line":"  required: true"},{"line_number":513,"context_line":"  min_version: 1.37"},{"line_number":514,"context_line":"  description: \u003e"},{"line_number":515,"context_line":"    A string, ``[A-Z]+``, describing what kind of consumer is creating,"},{"line_number":516,"context_line":"    or has created, allocations using a quantity of inventory. The string"},{"line_number":517,"context_line":"    is determined by the client when writing allocations and it is up to"},{"line_number":518,"context_line":"    the client to ensure correct choices amongst collaborating services."}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_4ce83ea6","line":515,"range":{"start_line":515,"start_character":4,"end_line":515,"end_character":24},"in_reply_to":"3fa7e38b_3378ef2a","updated":"2020-02-07 02:40:12.000000000","message":"Done","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"ddd4ab7fa22d4ffd056682aa7f560d4d14074a62","unresolved":true,"context_lines":[{"line_number":207,"context_line":"    required: false"},{"line_number":208,"context_line":"    min_version: 1.38"},{"line_number":209,"context_line":"    description: |"},{"line_number":210,"context_line":"      A string that consists of numbers, ``A-Z``, and ``_`` describing the"},{"line_number":211,"context_line":"      consumer type by which to filter usage results. For example, to retrieve"},{"line_number":212,"context_line":"      only usage information for \u0027INSTANCE\u0027 type consumers a parameter of"},{"line_number":213,"context_line":"      ``consumer_type\u003dINSTANCE`` should be provided."}],"source_content_type":"text/x-yaml","patch_set":25,"id":"00bef8fd_045b174c","line":210,"range":{"start_line":210,"start_character":41,"end_line":210,"end_character":59},"updated":"2021-08-19 19:02:01.000000000","message":"actully the regex used to enforece this is [A-Z0-9_]+\n\nso you can also have 0-9","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"3af6abf224683df3ed944d8f3b18ba6c0154d7cb","unresolved":true,"context_lines":[{"line_number":207,"context_line":"    required: false"},{"line_number":208,"context_line":"    min_version: 1.38"},{"line_number":209,"context_line":"    description: |"},{"line_number":210,"context_line":"      A string that consists of numbers, ``A-Z``, and ``_`` describing the"},{"line_number":211,"context_line":"      consumer type by which to filter usage results. For example, to retrieve"},{"line_number":212,"context_line":"      only usage information for \u0027INSTANCE\u0027 type consumers a parameter of"},{"line_number":213,"context_line":"      ``consumer_type\u003dINSTANCE`` should be provided."}],"source_content_type":"text/x-yaml","patch_set":25,"id":"cc944d69_55ee11ff","line":210,"range":{"start_line":210,"start_character":41,"end_line":210,"end_character":59},"in_reply_to":"00bef8fd_045b174c","updated":"2021-08-19 20:14:12.000000000","message":"It says \"numbers, ``A-Z``, and ``_``\" :)","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":10135,"name":"Lee Yarwood","display_name":"Lee Yarwood","email":"lyarwood@redhat.com","username":"lyarwood"},"change_message_id":"a35ff9c0aee9d760058a919fc9c3b0c1d33dd4ee","unresolved":false,"context_lines":[{"line_number":207,"context_line":"    required: false"},{"line_number":208,"context_line":"    min_version: 1.38"},{"line_number":209,"context_line":"    description: |"},{"line_number":210,"context_line":"      A string that consists of numbers, ``A-Z``, and ``_`` describing the"},{"line_number":211,"context_line":"      consumer type by which to filter usage results. For example, to retrieve"},{"line_number":212,"context_line":"      only usage information for \u0027INSTANCE\u0027 type consumers a parameter of"},{"line_number":213,"context_line":"      ``consumer_type\u003dINSTANCE`` should be provided."}],"source_content_type":"text/x-yaml","patch_set":25,"id":"0c6e2413_ca531716","line":210,"range":{"start_line":210,"start_character":41,"end_line":210,"end_character":59},"in_reply_to":"cc944d69_55ee11ff","updated":"2021-08-24 10:26:19.000000000","message":"Done","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"3a8d369f251136390fcb8e75efc1283def1520df","unresolved":true,"context_lines":[{"line_number":207,"context_line":"    required: false"},{"line_number":208,"context_line":"    min_version: 1.38"},{"line_number":209,"context_line":"    description: |"},{"line_number":210,"context_line":"      A string that consists of numbers, ``A-Z``, and ``_`` describing the"},{"line_number":211,"context_line":"      consumer type by which to filter usage results. For example, to retrieve"},{"line_number":212,"context_line":"      only usage information for \u0027INSTANCE\u0027 type consumers a parameter of"},{"line_number":213,"context_line":"      ``consumer_type\u003dINSTANCE`` should be provided."}],"source_content_type":"text/x-yaml","patch_set":25,"id":"f23552b1_f0e841af","line":210,"range":{"start_line":210,"start_character":41,"end_line":210,"end_character":59},"in_reply_to":"cc944d69_55ee11ff","updated":"2021-08-24 10:43:33.000000000","message":"oh your right. i ignored that because it was not in `` ``","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"}],"api-ref/source/reshaper.inc":[{"author":{"_account_id":10135,"name":"Lee Yarwood","display_name":"Lee Yarwood","email":"lyarwood@redhat.com","username":"lyarwood"},"change_message_id":"a35ff9c0aee9d760058a919fc9c3b0c1d33dd4ee","unresolved":true,"context_lines":[{"line_number":45,"context_line":"Request Example"},{"line_number":46,"context_line":"---------------"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":".. literalinclude:: ./samples/reshaper/post-reshaper-1.30.json"},{"line_number":49,"context_line":"   :language: javascript"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"No body content is returned on a successful POST."}],"source_content_type":"text/x-c++src","patch_set":25,"id":"109d4b57_bf7f647a","line":48,"range":{"start_line":48,"start_character":53,"end_line":48,"end_character":57},"updated":"2021-08-24 10:26:19.000000000","message":"nit - 1.38? I appreciate it\u0027s the allocation that has changed above but as you\u0027ve generated the sample for 1.38 shouldn\u0027t we use it here?","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"}],"api-ref/source/samples/usages/get-usages-1.37.json":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"4085989e01be11ed311036bd519c4566ad6bd9af","unresolved":false,"context_lines":[{"line_number":17,"context_line":"         \"DISK_GB\" : 5,"},{"line_number":18,"context_line":"         \"consumer_count\" : 1,"},{"line_number":19,"context_line":"         \"MEMORY_MB\" : 512"},{"line_number":20,"context_line":"      }"},{"line_number":21,"context_line":"   }"},{"line_number":22,"context_line":"}"}],"source_content_type":"application/json","patch_set":7,"id":"5faad753_83234d56","line":20,"updated":"2019-09-13 00:32:29.000000000","message":"OK, so all records will default to UNKNOWN consumer type, so initially if we query for usages [with 1.37], we will get all of the usage under consumer type UNKNOWN (since we have not yet updated our PUT in nova to specify consumer type).","commit_id":"e1611e67a01247939152dd8e179a9baad2c1db53"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"dc8c63e84410f5627a5a75c46c2bda7929edf6f2","unresolved":false,"context_lines":[{"line_number":17,"context_line":"         \"DISK_GB\" : 5,"},{"line_number":18,"context_line":"         \"consumer_count\" : 1,"},{"line_number":19,"context_line":"         \"MEMORY_MB\" : 512"},{"line_number":20,"context_line":"      }"},{"line_number":21,"context_line":"   }"},{"line_number":22,"context_line":"}"}],"source_content_type":"application/json","patch_set":7,"id":"5faad753_c505bf47","line":20,"in_reply_to":"5faad753_83234d56","updated":"2019-09-13 09:37:13.000000000","message":"yes","commit_id":"e1611e67a01247939152dd8e179a9baad2c1db53"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"ada61f0e41c98d17863cd59e26c7bcaadb922b74","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"3fa7e38b_414b58b1","updated":"2020-01-16 12:42:32.000000000","message":"Are there any reasons why we do not have samples for:\n\n* POST /allocations (request)\n* PUT /allocations/{consumer_uuid} (request)\n* GET /allocations/{consumer_uuid} (response)\n* POST /reshaper (request)\n\nas well??","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f65bc62b27ac8720b5e7e17edefd274978b6f1ac","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"3fa7e38b_4c16fea3","in_reply_to":"3fa7e38b_414b58b1","updated":"2020-02-07 02:40:12.000000000","message":"Looks like just an oversight. Will add.","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"}],"placement/handlers/allocation.py":[{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"f6df3836983b4218a3f71df706f34fea9b98237c","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            # AttributeCache or the data returned from the persistence layer"},{"line_number":115,"context_line":"            # should already have a name. We want to avoid accessing the"},{"line_number":116,"context_line":"            # database from the handler layer repeated times."},{"line_number":117,"context_line":"            con_type \u003d consumer_type.ConsumerType.get_by_id("},{"line_number":118,"context_line":"                context, consumer.consumer_type_id)"},{"line_number":119,"context_line":"            result[\u0027consumer_type\u0027] \u003d con_type.name"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"    return result"},{"line_number":122,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1fa4df85_b7d07955","line":119,"range":{"start_line":117,"start_character":12,"end_line":119,"end_character":51},"updated":"2020-03-12 12:21:33.000000000","message":"if consumer.consumer_type_id:\n      con_type \u003d consumer_type.ConsumerType.get_by_id(\n          context, consumer.consumer_type_id).name\n  else:\n      con_type \u003d consumer_type.DEFAULT_CONSUMER_TYPE\n  result[\u0027consumer_type\u0027] \u003d con_type\n\nWhich could be cleaned up in the next patch to let the cache have an id-to-string item of {None: \"unknown\"}.","commit_id":"8c9629ad70ff0955ac0aa048fa496468ed22708e"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"ddd4ab7fa22d4ffd056682aa7f560d4d14074a62","unresolved":true,"context_lines":[{"line_number":111,"context_line":"            result[\u0027consumer_generation\u0027] \u003d consumer.generation"},{"line_number":112,"context_line":"        show_consumer_type \u003d want_version.matches((1, 38))"},{"line_number":113,"context_line":"        if show_consumer_type:"},{"line_number":114,"context_line":"            # TODO(cdent): This should either access a subclass of"},{"line_number":115,"context_line":"            # AttributeCache or the data returned from the persistence layer"},{"line_number":116,"context_line":"            # should already have a name. We want to avoid accessing the"},{"line_number":117,"context_line":"            # database from the handler layer repeated times."},{"line_number":118,"context_line":"            if consumer.consumer_type_id:"},{"line_number":119,"context_line":"                con_type \u003d consumer_type.ConsumerType.get_by_id("},{"line_number":120,"context_line":"                    context, consumer.consumer_type_id).name"}],"source_content_type":"text/x-python","patch_set":25,"id":"4fb7170f_b2f5b125","line":117,"range":{"start_line":114,"start_character":12,"end_line":117,"end_character":61},"updated":"2021-08-19 19:02:01.000000000","message":"so this is one of the things adress in the final patch.","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"}],"placement/handlers/usage.py":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"ddd4ab7fa22d4ffd056682aa7f560d4d14074a62","unresolved":true,"context_lines":[{"line_number":101,"context_line":"    want_version \u003d req.environ[microversion.MICROVERSION_ENVIRON]"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    want_schema \u003d schema.GET_USAGES_SCHEMA_1_9"},{"line_number":104,"context_line":"    show_consumer_type \u003d want_version.matches((1, 38))"},{"line_number":105,"context_line":"    if show_consumer_type:"},{"line_number":106,"context_line":"        want_schema \u003d schema.GET_USAGES_SCHEMA_V1_38"},{"line_number":107,"context_line":"    util.validate_query_params(req, want_schema)"}],"source_content_type":"text/x-python","patch_set":25,"id":"1c8f588b_9a579489","line":104,"range":{"start_line":104,"start_character":46,"end_line":104,"end_character":53},"updated":"2021-08-19 19:02:01.000000000","message":"other then line lenght is there a reason not to use schema.GET_USAGES_SCHEMA_V1_38 here.\nthis is fine too but you are usign the constance 2 lines down so just wondering if they are in different formats or something.","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"3a8d369f251136390fcb8e75efc1283def1520df","unresolved":true,"context_lines":[{"line_number":101,"context_line":"    want_version \u003d req.environ[microversion.MICROVERSION_ENVIRON]"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    want_schema \u003d schema.GET_USAGES_SCHEMA_1_9"},{"line_number":104,"context_line":"    show_consumer_type \u003d want_version.matches((1, 38))"},{"line_number":105,"context_line":"    if show_consumer_type:"},{"line_number":106,"context_line":"        want_schema \u003d schema.GET_USAGES_SCHEMA_V1_38"},{"line_number":107,"context_line":"    util.validate_query_params(req, want_schema)"}],"source_content_type":"text/x-python","patch_set":25,"id":"685f59b1_36a13009","line":104,"range":{"start_line":104,"start_character":46,"end_line":104,"end_character":53},"in_reply_to":"18edf210_602d3fc7","updated":"2021-08-24 10:43:33.000000000","message":"oh that constant is actully the schma object that makes sense thanks. i assume it was something like that but was not sure.","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"3af6abf224683df3ed944d8f3b18ba6c0154d7cb","unresolved":true,"context_lines":[{"line_number":101,"context_line":"    want_version \u003d req.environ[microversion.MICROVERSION_ENVIRON]"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    want_schema \u003d schema.GET_USAGES_SCHEMA_1_9"},{"line_number":104,"context_line":"    show_consumer_type \u003d want_version.matches((1, 38))"},{"line_number":105,"context_line":"    if show_consumer_type:"},{"line_number":106,"context_line":"        want_schema \u003d schema.GET_USAGES_SCHEMA_V1_38"},{"line_number":107,"context_line":"    util.validate_query_params(req, want_schema)"}],"source_content_type":"text/x-python","patch_set":25,"id":"18edf210_602d3fc7","line":104,"range":{"start_line":104,"start_character":46,"end_line":104,"end_character":53},"in_reply_to":"1c8f588b_9a579489","updated":"2021-08-19 20:14:12.000000000","message":"schema.GET_USAGES_SCHEMA_V1_38 is a schema (dict) [1], it can\u0027t be used to check whether the requested API microversion is \u003e\u003d 1.38. We have to check the version before we decide to use the schema for 1.38.\n\nOn L106, that\u0027s updating the schema so we\u0027ll validate against to the 1.38 one.\n\n[1] https://review.opendev.org/c/openstack/placement/+/679441/25/placement/schemas/usage.py#14","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"}],"placement/handlers/util.py":[{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"ada61f0e41c98d17863cd59e26c7bcaadb922b74","unresolved":false,"context_lines":[{"line_number":106,"context_line":"                          \"different than existing record. Updating \""},{"line_number":107,"context_line":"                          \"consumer record.\", consumer_uuid)"},{"line_number":108,"context_line":"                consumer.consumer_type_id \u003d cons_type_id"},{"line_number":109,"context_line":"                consumer.update()"},{"line_number":110,"context_line":"        if requires_consumer_generation:"},{"line_number":111,"context_line":"            if consumer.generation !\u003d consumer_generation:"},{"line_number":112,"context_line":"                raise webob.exc.HTTPConflict("}],"source_content_type":"text/x-python","patch_set":9,"id":"3fa7e38b_53d00bc7","line":109,"updated":"2020-01-16 12:42:32.000000000","message":"This is currently *NOT* rolled back when some exception happens in a subsequent processing later. For example, we now roll back creating new consumers by deleting them in [1] and [2],[3] for PUT and POST /allocations respectively when exception happens later,\n\n[1] https://github.com/openstack/placement/blob/4ffa0cd83d2f556c116faca896ffd1f75e17e3f0/placement/handlers/allocation.py#L439\n\n[2] \nhttps://github.com/openstack/placement/blob/4ffa0cd83d2f556c116faca896ffd1f75e17e3f0/placement/handlers/allocation.py#L237\n\n[3] https://github.com/openstack/placement/blob/4ffa0cd83d2f556c116faca896ffd1f75e17e3f0/placement/handlers/allocation.py#L527\n\nso it is good to have a test case for this or leave ToDo comment here that we need a roll back mechanism for this operation.","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f65bc62b27ac8720b5e7e17edefd274978b6f1ac","unresolved":false,"context_lines":[{"line_number":106,"context_line":"                          \"different than existing record. Updating \""},{"line_number":107,"context_line":"                          \"consumer record.\", consumer_uuid)"},{"line_number":108,"context_line":"                consumer.consumer_type_id \u003d cons_type_id"},{"line_number":109,"context_line":"                consumer.update()"},{"line_number":110,"context_line":"        if requires_consumer_generation:"},{"line_number":111,"context_line":"            if consumer.generation !\u003d consumer_generation:"},{"line_number":112,"context_line":"                raise webob.exc.HTTPConflict("}],"source_content_type":"text/x-python","patch_set":9,"id":"3fa7e38b_6c597a5a","line":109,"in_reply_to":"3fa7e38b_53d00bc7","updated":"2020-02-07 02:40:12.000000000","message":"I\u0027m putting in a temporary TODO for this to handle in another patchset. I don\u0027t want this update to get too big.","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"d8dec865854efe12377632588d1a17153be7d6c8","unresolved":false,"context_lines":[{"line_number":108,"context_line":"                consumer.consumer_type_id \u003d cons_type_id"},{"line_number":109,"context_line":"                consumer.update()"},{"line_number":110,"context_line":"                # TODO(melwitt): Add exception handling IN THE NEXT PS to"},{"line_number":111,"context_line":"                # rollback this update if an exception is raised after this."},{"line_number":112,"context_line":"        if requires_consumer_generation:"},{"line_number":113,"context_line":"            if consumer.generation !\u003d consumer_generation:"},{"line_number":114,"context_line":"                raise webob.exc.HTTPConflict("}],"source_content_type":"text/x-python","patch_set":10,"id":"3fa7e38b_5fa8ded8","line":111,"updated":"2020-02-07 02:55:39.000000000","message":"Handle rollback here","commit_id":"a929380b9893e66310e9bb96c56f37694590a261"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"f6df3836983b4218a3f71df706f34fea9b98237c","unresolved":false,"context_lines":[{"line_number":171,"context_line":"                    \u0027consumer generation conflict - \u0027"},{"line_number":172,"context_line":"                    \u0027expected null but got %s\u0027 % consumer_generation,"},{"line_number":173,"context_line":"                    comment\u003derrors.CONCURRENT_UPDATE)"},{"line_number":174,"context_line":"        if requires_consumer_type:"},{"line_number":175,"context_line":"            cons_type_id \u003d fetch_consumer_type_id(ctx, consumer_type)"},{"line_number":176,"context_line":"        else:"},{"line_number":177,"context_line":"            # Set the consumer type to the default if called with an older"},{"line_number":178,"context_line":"            # microversion."},{"line_number":179,"context_line":"            cons_type_id \u003d consumer_type_obj.DEFAULT_CONSUMER_TYPE_ID"},{"line_number":180,"context_line":"        # No such consumer. This is common for new allocations. Create the"},{"line_number":181,"context_line":"        # consumer record"},{"line_number":182,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":14,"id":"1fa4df85_17b4ed34","line":179,"range":{"start_line":174,"start_character":7,"end_line":179,"end_character":69},"updated":"2020-03-12 12:21:33.000000000","message":"cons_type_id \u003d (fetch_consumer_type_id(ctx, consumer_type)\n                if requires_consumer_type else None)\n\n\nif we don\u0027t want to have the DEFAULT ID, again.","commit_id":"8c9629ad70ff0955ac0aa048fa496468ed22708e"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"6336e991712b24cb49ef36c956cad55629769e64","unresolved":true,"context_lines":[{"line_number":190,"context_line":"                # updating it to a non-default value."},{"line_number":191,"context_line":"                if original_consumer_type_id:"},{"line_number":192,"context_line":"                    consumer.consumer_type_id \u003d original_consumer_type_id"},{"line_number":193,"context_line":"                    consumer.update()"},{"line_number":194,"context_line":"                raise webob.exc.HTTPConflict("},{"line_number":195,"context_line":"                    \u0027consumer generation conflict - \u0027"},{"line_number":196,"context_line":"                    \u0027expected null but got %s\u0027 % consumer_generation,"}],"source_content_type":"text/x-python","patch_set":15,"id":"67158e97_cd770233","line":193,"updated":"2021-04-21 21:05:36.000000000","message":"I realized I think this code block doesn\u0027t make sense because the way we get here (NotFound) is if the consumer was not found. If the consumer was not found, then we couldn\u0027t have updated it. I\u0027ll remove this code block in the next PS.","commit_id":"5f8ea0b4c41897f1e5d6a2bdaa9d338c273547f9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"8d007616591f592b1752fe56ebe5d207fb40092a","unresolved":true,"context_lines":[{"line_number":190,"context_line":"                # updating it to a non-default value."},{"line_number":191,"context_line":"                if original_consumer_type_id:"},{"line_number":192,"context_line":"                    consumer.consumer_type_id \u003d original_consumer_type_id"},{"line_number":193,"context_line":"                    consumer.update()"},{"line_number":194,"context_line":"                raise webob.exc.HTTPConflict("},{"line_number":195,"context_line":"                    \u0027consumer generation conflict - \u0027"},{"line_number":196,"context_line":"                    \u0027expected null but got %s\u0027 % consumer_generation,"}],"source_content_type":"text/x-python","patch_set":15,"id":"c42b9225_c4ee8771","line":193,"in_reply_to":"67158e97_cd770233","updated":"2021-04-21 21:15:15.000000000","message":"Also, this isn\u0027t needed because if we got here and raised HTTPConflict we\u0027d still run the restore code below at L204 so this is redundant too.","commit_id":"5f8ea0b4c41897f1e5d6a2bdaa9d338c273547f9"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"2e628f71cc96f0edbc44fe7becbcb77b91df7a99","unresolved":true,"context_lines":[{"line_number":84,"context_line":"        created_new_consumer \u003d True"},{"line_number":85,"context_line":"    except exception.ConsumerExists:"},{"line_number":86,"context_line":"        # No worries, another thread created this user already"},{"line_number":87,"context_line":"        consumer \u003d consumer_obj.Consumer.get_by_uuid(ctx, consumer_uuid)"},{"line_number":88,"context_line":"    return consumer, created_new_consumer"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"4126880f_a453667e","line":87,"updated":"2021-04-27 15:52:31.000000000","message":"How can be sure that the other thread created the consumer with the consumer_type_id this call requested? Or is it OK from placement perspective? \n\nNow the faster client will win the race and the slower client does not get an error. The slower client requested consumer_type\u003dA but in the 200 OK response this client gets back a consumer_type\u003dB consumer due to the lost race. Is it OK?\n\nIn case of project and user we don\u0027t have the same issue as they don\u0027t have any extra parameter to differ between competing requests.\n\nOne way to solve it is to check the returned consumer to see if it has all the fields matching with the current request and if not return 409 conflict instead.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":false,"context_lines":[{"line_number":84,"context_line":"        created_new_consumer \u003d True"},{"line_number":85,"context_line":"    except exception.ConsumerExists:"},{"line_number":86,"context_line":"        # No worries, another thread created this user already"},{"line_number":87,"context_line":"        consumer \u003d consumer_obj.Consumer.get_by_uuid(ctx, consumer_uuid)"},{"line_number":88,"context_line":"    return consumer, created_new_consumer"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"72f5750a_3294c763","line":87,"in_reply_to":"27f9475f_6daf013a","updated":"2021-05-17 15:00:37.000000000","message":"Ack","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"02540ab141a781586538df7368c3ca392edca9fb","unresolved":true,"context_lines":[{"line_number":84,"context_line":"        created_new_consumer \u003d True"},{"line_number":85,"context_line":"    except exception.ConsumerExists:"},{"line_number":86,"context_line":"        # No worries, another thread created this user already"},{"line_number":87,"context_line":"        consumer \u003d consumer_obj.Consumer.get_by_uuid(ctx, consumer_uuid)"},{"line_number":88,"context_line":"    return consumer, created_new_consumer"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"27f9475f_6daf013a","line":87,"in_reply_to":"4126880f_a453667e","updated":"2021-04-27 22:29:57.000000000","message":"Excellent point ... I think we did not consider this possibility. I think your suggested solution sounds like a good one.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"b222e5425ed46b6d0c0fc3f3b97b21996e35148a","unresolved":true,"context_lines":[{"line_number":92,"context_line":"                      \"different than existing record. Updating \""},{"line_number":93,"context_line":"                      \"consumer record.\", consumer_uuid)"},{"line_number":94,"context_line":"            consumer.consumer_type_id \u003d consumer_type_id"},{"line_number":95,"context_line":"            consumer.update()"},{"line_number":96,"context_line":"    return consumer, created_new_consumer"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"4d3fe162_c735ad7c","line":95,"updated":"2021-05-14 03:29:34.000000000","message":"My thinking for doing this instead of raising a 409 conflict is because in all of the other cases where the supplied consumer_type_id doesn\u0027t match the existing one, the consumer_type_id is updated to the new type.\n\nThough this is a race, I was thinking the losing request is still a request coming in after a previous request. That is, if someone updates allocations using ID 1 and then 10 minutes later someone else updates allocations for that same consumer to ID 2, that is valid.\n\nI\u0027m not sure if there\u0027s helpfulness in returning a 409 conflict ... it would make the losing request have to try again and the end result would be the same, consumer would get updated to ID 2. Let me know if there\u0027s a use case for this that I\u0027m missing.","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"7b6b15ccb8fb757ecd1c93068910e30fe1e7e11f","unresolved":true,"context_lines":[{"line_number":92,"context_line":"                      \"different than existing record. Updating \""},{"line_number":93,"context_line":"                      \"consumer record.\", consumer_uuid)"},{"line_number":94,"context_line":"            consumer.consumer_type_id \u003d consumer_type_id"},{"line_number":95,"context_line":"            consumer.update()"},{"line_number":96,"context_line":"    return consumer, created_new_consumer"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"93770759_31b624e8","line":95,"in_reply_to":"0c225c08_da0a47a2","updated":"2021-06-05 00:07:58.000000000","message":"Apologies for the delayed reply, I didn\u0027t have the brain power to process this info at the time you this comment and I\u0027m getting back to it now.\n\nI think I follow what you\u0027ve explained here but AFAICT the consumer create, update and increment_generation don\u0027t happen in a single DB transaction, so the increment raising an exception won\u0027t rollback the other changes to the consumer. This is what I\u0027m thinking:\n\n* req-1 and req-2 both begin to create a consumer with uuid\u003d123 and consumer_generation\u003d0 (default)\n* req-1 wins and creates the consumer with type ONE and consumer_generation\u003d0\n* req-2 tries with type TWO and gets ConsumerExists\n* req-2 reads the consumer record back and updates its type to TWO without incrementing generation, consumer_generation\u003d0 still\n* req-1 calls increment_generation where generation\u003d0 and it succeeds and returns 1 row and consumer_generation\u003d1 now\n* req-2 calls increment_generation where generation\u003d0 and it returns no row so fails and raises ConcurrentUpdateDetected in replace_all so returns 409\n* req-1 doesn\u0027t know the consumer for their allocation has type TWO now\n\nI might be thinking wrong here ^, let me know if I\u0027m mistaken.\n\nIf what I\u0027m thinking is correct, then the manual rolling back of the consumer type update that\u0027s currently included in this patch won\u0027t be triggered because by the time ConcurrentUpdateDetected is raised in replace_all, we\u0027re out of these methods in this file.","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":true,"context_lines":[{"line_number":92,"context_line":"                      \"different than existing record. Updating \""},{"line_number":93,"context_line":"                      \"consumer record.\", consumer_uuid)"},{"line_number":94,"context_line":"            consumer.consumer_type_id \u003d consumer_type_id"},{"line_number":95,"context_line":"            consumer.update()"},{"line_number":96,"context_line":"    return consumer, created_new_consumer"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"0c225c08_da0a47a2","line":95,"in_reply_to":"4d3fe162_c735ad7c","updated":"2021-05-17 15:00:37.000000000","message":"Many things are in play. I discovered couple of things since my last review.\n\nA PUT /allocations/{uuid} call has two major parts. A) updating the consumer (user,project, consumer_type) and B) updating the allocation of the consumer. \n\nThe allocations key is mandatory in the allocation update request. So allocation update is always happening. During that allocation update (Allocation.replace_all()) placement does an atomic consumer generation check in the DB. \nhttps://github.com/openstack/placement/blob/6f00ba5f685183539d0ebf62a4741f2f6930e051/placement/objects/allocation.py#L392\nhttps://github.com/openstack/placement/blob/6f00ba5f685183539d0ebf62a4741f2f6930e051/placement/objects/consumer.py#L229\n\nAlso both A) and B) happens in the same DB transaction which means that if the allocation update fails on consumer_generation conflict then changes made to the consumer during A) is rolled back automatically.\n\nSo we are basically safe in case of the following race:\nWe have a consumer with consumer_generation\u003d0 consumer_type\u003dINSTANCE\n1) request-1 with consumer_generation\u003d0 consumer_type\u003dONE reaches placement and validates consumer_generation in ensure_consumer() and updates the consumer_type in the DB in transaction\n2) request-2 with consumer_generation\u003d0 consumer_type\u003dTWO reached placement and validates the consumer_generation successfully and updates the consumer_type in the the DB in another transaction.\n3) request-1 does the allocation update successfully and bumps the consumer generation. Then commits the transaction\n4) request-2 does the allocation update but fails to bump the consumer generation as #3) created a conflict. This DB transaction is rolled back and request-2 rejected with 409\n\n\nSo specifically to this consumer create case, if we get ConsumerExists then it means that we are req-2 and req-1 already committed the consumer creation (or we have bad transaction isolation as we see an uncommitted create). If we had the same consumer_generation as req-1 then later in the allocation update part of this request we will fail with conflict and the request gets rejected with 409.\nIf req-2 already knows the consumer_generation bump from req-1 and having the new generation in the request that means at L138 req-2 should also see the consumer req-1 created so we never end up in _create_consumer() in the first place.\n\nBottom line, assuming full db transaction separation, I think when we see ConsumerExists here then we know that the request will fail on consumer_generation conflict later in the allocation update. So it does not matter what we set as consumer_type here.\n\nBut I\u0027m not 100% sure about DB isolation. Can one transaction see the uncommitted create of another transaction? If yes then we have a more complicated situation.","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"4d4f3b890a0faaa6d7fe69eebe43e13f31286c42","unresolved":true,"context_lines":[{"line_number":92,"context_line":"                      \"different than existing record. Updating \""},{"line_number":93,"context_line":"                      \"consumer record.\", consumer_uuid)"},{"line_number":94,"context_line":"            consumer.consumer_type_id \u003d consumer_type_id"},{"line_number":95,"context_line":"            consumer.update()"},{"line_number":96,"context_line":"    return consumer, created_new_consumer"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"c646058c_97460190","line":95,"in_reply_to":"93770759_31b624e8","updated":"2021-06-09 15:34:30.000000000","message":"I\u0027ve added some tests top of this patch. It shows that if there are two consecutive requests use that same consumer generation (e.g. two racing consumer creation from the client perspective) then during the second request the consumer type updated at L147 then the check at L150 rejects the second create, and L213 rollbacks the consumer_type to its original value. So we need the logic at L213 (or we need to move the update at L147 under L150). But this is not the racy case from the server perspective as the first request finishes before the second request arrives. I have hard time simulating the racy case as gabbit is inherently sequential. So what I do instead is that I temporary removed the check at L150 and rerun the same test. In this case the Allocation.replace_all() consumer_generation check rejects the second request. However in this case the consumer_type update is not rolled back as you correctly predicted. So I guess we need some logic higher in the call stack that handles ConcurrentUpdateDetected and rollbacks consumer_type update :/","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"b222e5425ed46b6d0c0fc3f3b97b21996e35148a","unresolved":true,"context_lines":[{"line_number":144,"context_line":"                          \"consumer record.\", consumer_uuid)"},{"line_number":145,"context_line":"                original_consumer_type_id \u003d consumer.consumer_type_id"},{"line_number":146,"context_line":"                consumer.consumer_type_id \u003d cons_type_id"},{"line_number":147,"context_line":"                consumer.update()"},{"line_number":148,"context_line":"        if requires_consumer_generation:"},{"line_number":149,"context_line":"            if consumer.generation !\u003d consumer_generation:"},{"line_number":150,"context_line":"                raise webob.exc.HTTPConflict("}],"source_content_type":"text/x-python","patch_set":17,"id":"b4fc4429_6e185789","line":147,"updated":"2021-05-14 03:29:34.000000000","message":"Here is where we update the consumer type if it is different.","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":false,"context_lines":[{"line_number":144,"context_line":"                          \"consumer record.\", consumer_uuid)"},{"line_number":145,"context_line":"                original_consumer_type_id \u003d consumer.consumer_type_id"},{"line_number":146,"context_line":"                consumer.consumer_type_id \u003d cons_type_id"},{"line_number":147,"context_line":"                consumer.update()"},{"line_number":148,"context_line":"        if requires_consumer_generation:"},{"line_number":149,"context_line":"            if consumer.generation !\u003d consumer_generation:"},{"line_number":150,"context_line":"                raise webob.exc.HTTPConflict("}],"source_content_type":"text/x-python","patch_set":17,"id":"0556f20c_af36745b","line":147,"in_reply_to":"b4fc4429_6e185789","updated":"2021-05-17 15:00:37.000000000","message":"Ack","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":true,"context_lines":[{"line_number":86,"context_line":"        # Another thread created this consumer already, verify whether"},{"line_number":87,"context_line":"        # the consumer type matches"},{"line_number":88,"context_line":"        consumer \u003d consumer_obj.Consumer.get_by_uuid(ctx, consumer_uuid)"},{"line_number":89,"context_line":"        # If the types don\u0027t match, update the consumer record"},{"line_number":90,"context_line":"        if consumer_type_id !\u003d consumer.consumer_type_id:"},{"line_number":91,"context_line":"            LOG.debug(\"Supplied consumer type for consumer %s was \""},{"line_number":92,"context_line":"                      \"different than existing record. Updating \""}],"source_content_type":"text/x-python","patch_set":18,"id":"73b1b28d_2939525b","line":89,"updated":"2021-05-17 15:00:37.000000000","message":"technically we don\u0027t even have to check if it is different we can go ahead an update it blindly. But I\u0027m OK to have the check here for logging.","commit_id":"e88d6334b71767eca16dce61a63ed62b17b95516"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":true,"context_lines":[{"line_number":144,"context_line":"                          \"consumer record.\", consumer_uuid)"},{"line_number":145,"context_line":"                original_consumer_type_id \u003d consumer.consumer_type_id"},{"line_number":146,"context_line":"                consumer.consumer_type_id \u003d cons_type_id"},{"line_number":147,"context_line":"                consumer.update()"},{"line_number":148,"context_line":"        if requires_consumer_generation:"},{"line_number":149,"context_line":"            if consumer.generation !\u003d consumer_generation:"},{"line_number":150,"context_line":"                raise webob.exc.HTTPConflict("}],"source_content_type":"text/x-python","patch_set":18,"id":"fc1b106a_36b3a072","line":147,"updated":"2021-05-17 15:00:37.000000000","message":"This needs to be protected by the consumer_generation check at L149. Similarly how the current code protects against consumer_generation conflict during the update of the project or user of the consumer.\n\n// later\n\nI\u0027ve realized that all the consumer_generation checks here are only good to have but real must have consumer_generation check happens during the allocation update and happens in the db atomically https://github.com/openstack/placement/blob/6f00ba5f685183539d0ebf62a4741f2f6930e051/placement/objects/consumer.py#L229\n\nStill for the sake of following the patter I suggest to move this consumer update after the guard condition in L149-L157. This makes the logic symmetric so not just the user and the project update are guarded with this good to have consumer_generation check but also the consumer_type update.","commit_id":"e88d6334b71767eca16dce61a63ed62b17b95516"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":true,"context_lines":[{"line_number":177,"context_line":"        # manager\u0027s transaction to rollback automatically. I believe that the"},{"line_number":178,"context_line":"        # same transaction context is used for both util.ensure_consumer() and"},{"line_number":179,"context_line":"        # AllocationList.replace_all() within the same HTTP request, but need"},{"line_number":180,"context_line":"        # to test this to be 100% certain..."},{"line_number":181,"context_line":"        if (project_id !\u003d consumer.project.external_id or"},{"line_number":182,"context_line":"                user_id !\u003d consumer.user.external_id):"},{"line_number":183,"context_line":"            LOG.debug(\"Supplied project or user ID for consumer %s was \""}],"source_content_type":"text/x-python","patch_set":18,"id":"6ce31194_c74c6b55","line":180,"updated":"2021-05-17 15:00:37.000000000","message":"Basically I went into the rabbit hole Jay described here. And I think Jay is right. The whole request is one big DB transaction so the later failure will roll back the changes we are making here.","commit_id":"e88d6334b71767eca16dce61a63ed62b17b95516"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"dc59e092d4ee0e52a8e79432a6242a4b7d373c8d","unresolved":true,"context_lines":[{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    try:"},{"line_number":138,"context_line":"        consumer \u003d consumer_obj.Consumer.get_by_uuid(ctx, consumer_uuid)"},{"line_number":139,"context_line":"        if requires_consumer_type:"},{"line_number":140,"context_line":"            cons_type_id \u003d fetch_consumer_type_id(ctx, consumer_type)"},{"line_number":141,"context_line":"            if cons_type_id !\u003d consumer.consumer_type_id:"},{"line_number":142,"context_line":"                LOG.debug(\"Supplied consumer type for consumer %s was \""},{"line_number":143,"context_line":"                          \"different than existing record. Updating \""},{"line_number":144,"context_line":"                          \"consumer record.\", consumer_uuid)"},{"line_number":145,"context_line":"                original_consumer_type_id \u003d consumer.consumer_type_id"},{"line_number":146,"context_line":"                consumer.consumer_type_id \u003d cons_type_id"},{"line_number":147,"context_line":"                consumer.update()"},{"line_number":148,"context_line":"        if requires_consumer_generation:"},{"line_number":149,"context_line":"            if consumer.generation !\u003d consumer_generation:"},{"line_number":150,"context_line":"                raise webob.exc.HTTPConflict("}],"source_content_type":"text/x-python","patch_set":20,"id":"186d1491_827c2a88","line":147,"range":{"start_line":139,"start_character":0,"end_line":147,"end_character":33},"updated":"2021-07-22 15:54:34.000000000","message":"The guard at L149 is an early check about consumer generation, the real check happens in the DB in Allocation.replace_all. Still this early check now protects the project_id and user_id update but not the consumer_type update. So I would put the consumer_type update logical at L188. For me that seems to be the logical place.","commit_id":"4eebb2d1187c0dbbd5dba6c36cc937a9063efc9b"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"09e82d99426be20d11170647bd2e522cd6b3df09","unresolved":true,"context_lines":[{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    try:"},{"line_number":138,"context_line":"        consumer \u003d consumer_obj.Consumer.get_by_uuid(ctx, consumer_uuid)"},{"line_number":139,"context_line":"        if requires_consumer_type:"},{"line_number":140,"context_line":"            cons_type_id \u003d fetch_consumer_type_id(ctx, consumer_type)"},{"line_number":141,"context_line":"            if cons_type_id !\u003d consumer.consumer_type_id:"},{"line_number":142,"context_line":"                LOG.debug(\"Supplied consumer type for consumer %s was \""},{"line_number":143,"context_line":"                          \"different than existing record. Updating \""},{"line_number":144,"context_line":"                          \"consumer record.\", consumer_uuid)"},{"line_number":145,"context_line":"                original_consumer_type_id \u003d consumer.consumer_type_id"},{"line_number":146,"context_line":"                consumer.consumer_type_id \u003d cons_type_id"},{"line_number":147,"context_line":"                consumer.update()"},{"line_number":148,"context_line":"        if requires_consumer_generation:"},{"line_number":149,"context_line":"            if consumer.generation !\u003d consumer_generation:"},{"line_number":150,"context_line":"                raise webob.exc.HTTPConflict("}],"source_content_type":"text/x-python","patch_set":20,"id":"107b534d_139e8916","line":147,"range":{"start_line":139,"start_character":0,"end_line":147,"end_character":33},"in_reply_to":"186d1491_827c2a88","updated":"2021-07-22 17:11:42.000000000","message":"OK, can do.","commit_id":"4eebb2d1187c0dbbd5dba6c36cc937a9063efc9b"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"dc59e092d4ee0e52a8e79432a6242a4b7d373c8d","unresolved":true,"context_lines":[{"line_number":171,"context_line":"        # AllocationList.replace_all() fails for whatever reason (say, a"},{"line_number":172,"context_line":"        # resource provider generation conflict or out of resources failure),"},{"line_number":173,"context_line":"        # we will end up deleting the auto-created consumer but we MAY not undo"},{"line_number":174,"context_line":"        # the changes to the second consumer\u0027s project and user ID. I say MAY"},{"line_number":175,"context_line":"        # and not WILL NOT because I\u0027m not sure that the exception that gets"},{"line_number":176,"context_line":"        # raised from AllocationList.replace_all() will cause the context"},{"line_number":177,"context_line":"        # manager\u0027s transaction to rollback automatically. I believe that the"},{"line_number":178,"context_line":"        # same transaction context is used for both util.ensure_consumer() and"},{"line_number":179,"context_line":"        # AllocationList.replace_all() within the same HTTP request, but need"},{"line_number":180,"context_line":"        # to test this to be 100% certain..."},{"line_number":181,"context_line":"        if (project_id !\u003d consumer.project.external_id or"},{"line_number":182,"context_line":"                user_id !\u003d consumer.user.external_id):"},{"line_number":183,"context_line":"            LOG.debug(\"Supplied project or user ID for consumer %s was \""}],"source_content_type":"text/x-python","patch_set":20,"id":"bfa958af_ad6fdedd","line":180,"range":{"start_line":174,"start_character":67,"end_line":180,"end_character":44},"updated":"2021-07-22 15:54:34.000000000","message":"Basically you have solved this issue. Now we are sure that whatever happens during the update that will roll back all pieces of that update. So I suggest to change this comment from wondering about the behavior to stating that we have a good behavior now.","commit_id":"4eebb2d1187c0dbbd5dba6c36cc937a9063efc9b"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"09e82d99426be20d11170647bd2e522cd6b3df09","unresolved":true,"context_lines":[{"line_number":171,"context_line":"        # AllocationList.replace_all() fails for whatever reason (say, a"},{"line_number":172,"context_line":"        # resource provider generation conflict or out of resources failure),"},{"line_number":173,"context_line":"        # we will end up deleting the auto-created consumer but we MAY not undo"},{"line_number":174,"context_line":"        # the changes to the second consumer\u0027s project and user ID. I say MAY"},{"line_number":175,"context_line":"        # and not WILL NOT because I\u0027m not sure that the exception that gets"},{"line_number":176,"context_line":"        # raised from AllocationList.replace_all() will cause the context"},{"line_number":177,"context_line":"        # manager\u0027s transaction to rollback automatically. I believe that the"},{"line_number":178,"context_line":"        # same transaction context is used for both util.ensure_consumer() and"},{"line_number":179,"context_line":"        # AllocationList.replace_all() within the same HTTP request, but need"},{"line_number":180,"context_line":"        # to test this to be 100% certain..."},{"line_number":181,"context_line":"        if (project_id !\u003d consumer.project.external_id or"},{"line_number":182,"context_line":"                user_id !\u003d consumer.user.external_id):"},{"line_number":183,"context_line":"            LOG.debug(\"Supplied project or user ID for consumer %s was \""}],"source_content_type":"text/x-python","patch_set":20,"id":"3d6ac808_5e90ac50","line":180,"range":{"start_line":174,"start_character":67,"end_line":180,"end_character":44},"in_reply_to":"bfa958af_ad6fdedd","updated":"2021-07-22 17:11:42.000000000","message":"Good point. This is the code comment that got me thinking about why the update wasn\u0027t being automatically rolled back in the DB in the event of a collision.","commit_id":"4eebb2d1187c0dbbd5dba6c36cc937a9063efc9b"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"896abdf434c026802efddb0f3c0c0b49e6b7c3cb","unresolved":true,"context_lines":[{"line_number":205,"context_line":"        # consumer record"},{"line_number":206,"context_line":"        consumer, created_new_consumer \u003d _create_consumer("},{"line_number":207,"context_line":"            ctx, consumer_uuid, proj, user, cons_type_id)"},{"line_number":208,"context_line":"    except Exception:"},{"line_number":209,"context_line":"        with excutils.save_and_reraise_exception():"},{"line_number":210,"context_line":"            # Restore the original consumer type id if we failed after"},{"line_number":211,"context_line":"            # updating it to a non-default value."},{"line_number":212,"context_line":"            if original_consumer_type_id:"},{"line_number":213,"context_line":"                consumer.consumer_type_id \u003d original_consumer_type_id"},{"line_number":214,"context_line":"                consumer.update()"},{"line_number":215,"context_line":""},{"line_number":216,"context_line":"    return consumer, created_new_consumer"}],"source_content_type":"text/x-python","patch_set":21,"id":"16abf949_0f7c34a2","line":214,"range":{"start_line":208,"start_character":4,"end_line":214,"end_character":33},"updated":"2021-07-22 17:46:50.000000000","message":"Looks like we no longer need this logic since the consumer type update was moved to happen later.","commit_id":"d834f95b267826d6315d53af2462d6f380baeb6d"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"ddd4ab7fa22d4ffd056682aa7f560d4d14074a62","unresolved":true,"context_lines":[{"line_number":25,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"def fetch_consumer_type_id(ctx, name):"},{"line_number":29,"context_line":"    \"\"\"Tries to fetch the provided consumer_type and creates a new one if it"},{"line_number":30,"context_line":"    does not exist."},{"line_number":31,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"e90dc18a_8a4685fc","line":28,"range":{"start_line":28,"start_character":4,"end_line":28,"end_character":26},"updated":"2021-08-19 19:02:01.000000000","message":"its slight od that this is a get_or_create api based on this nameing\ni woudl expect it to fail if the consumer did not already exist.\n\nperhaps we could rename this in a follow up\n\ni.e. get_or_create_consumer_type(ctx, name) in line with _get_or_create_project","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"3a8d369f251136390fcb8e75efc1283def1520df","unresolved":false,"context_lines":[{"line_number":25,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"def fetch_consumer_type_id(ctx, name):"},{"line_number":29,"context_line":"    \"\"\"Tries to fetch the provided consumer_type and creates a new one if it"},{"line_number":30,"context_line":"    does not exist."},{"line_number":31,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"940052b3_81988836","line":28,"range":{"start_line":28,"start_character":4,"end_line":28,"end_character":26},"in_reply_to":"aba49cbd_379a0c18","updated":"2021-08-24 10:43:33.000000000","message":"Ack","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"3af6abf224683df3ed944d8f3b18ba6c0154d7cb","unresolved":true,"context_lines":[{"line_number":25,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"def fetch_consumer_type_id(ctx, name):"},{"line_number":29,"context_line":"    \"\"\"Tries to fetch the provided consumer_type and creates a new one if it"},{"line_number":30,"context_line":"    does not exist."},{"line_number":31,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"aba49cbd_379a0c18","line":28,"range":{"start_line":28,"start_character":4,"end_line":28,"end_character":26},"in_reply_to":"e90dc18a_8a4685fc","updated":"2021-08-19 20:14:12.000000000","message":"Yeah... the point of this method is to get the consumer type ID but it will create if it doesn\u0027t exist, which I recognize could be unexpected. I\u0027ll rename it if I need to respin for other stuff too.","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"ddd4ab7fa22d4ffd056682aa7f560d4d14074a62","unresolved":true,"context_lines":[{"line_number":39,"context_line":"        cons_type \u003d consumer_type_obj.ConsumerType(ctx, name\u003dname)"},{"line_number":40,"context_line":"        try:"},{"line_number":41,"context_line":"            cons_type.create()"},{"line_number":42,"context_line":"        except exception.ConsumerTypeExists:"},{"line_number":43,"context_line":"            # another thread created concurrently, so try again"},{"line_number":44,"context_line":"            return fetch_consumer_type_id(ctx, name)"},{"line_number":45,"context_line":"    return cons_type.id"}],"source_content_type":"text/x-python","patch_set":25,"id":"6c2ed9a5_714cb14b","line":42,"range":{"start_line":42,"start_character":25,"end_line":42,"end_character":43},"updated":"2021-08-19 19:02:01.000000000","message":"ok so this is to handel concurrent creates","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"}],"placement/objects/usage.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":true,"context_lines":[{"line_number":89,"context_line":"    query \u003d query.group_by(models.Allocation.resource_class_id)"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    # Handle \u0027all\u0027 or \u0027unknown\u0027 consumer type"},{"line_number":92,"context_line":"    if consumer_type is not False:"},{"line_number":93,"context_line":"        # NOTE(melwitt): We have to count the number of consumers in a separate"},{"line_number":94,"context_line":"        # query in order to get a count of unique consumers. If we count in the"},{"line_number":95,"context_line":"        # same query after grouping by resource class, we will count duplicate"}],"source_content_type":"text/x-python","patch_set":17,"id":"a40894eb_ace9d699","line":92,"range":{"start_line":92,"start_character":21,"end_line":92,"end_character":33},"updated":"2021-05-17 15:00:37.000000000","message":"auch, this smells. I almost suggested that you don\u0027t have to do identity check on False as that is a singleton. But you do need this logic. As far as I see consume_type \u003d\u003d False if the parameter is not provided. True if \u0027all\u0027 is requested and None if \u0027unknown\u0027 is requested. And you want to express that it is either True or None. \n\nI suggest to help the future reader and rewrite this to:\n  if consumer_type is None or consumer_type:\n\nOr note that logic in the comment:\n\n  # Handle \u0027all\u0027 or \u0027unknown\u0027  consumer type. The consumer_type is True if \u0027all\u0027 is requested, and None if \u0027unknown\u0027 is requested.","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"dc59e092d4ee0e52a8e79432a6242a4b7d373c8d","unresolved":true,"context_lines":[{"line_number":89,"context_line":"    query \u003d query.group_by(models.Allocation.resource_class_id)"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    # Handle \u0027all\u0027 or \u0027unknown\u0027 consumer type"},{"line_number":92,"context_line":"    if consumer_type is not False:"},{"line_number":93,"context_line":"        # NOTE(melwitt): We have to count the number of consumers in a separate"},{"line_number":94,"context_line":"        # query in order to get a count of unique consumers. If we count in the"},{"line_number":95,"context_line":"        # same query after grouping by resource class, we will count duplicate"}],"source_content_type":"text/x-python","patch_set":20,"id":"1b81a356_e68d0ca4","line":92,"updated":"2021-07-22 15:54:34.000000000","message":"I almost suggested that you don\u0027t have to do identity check on False as that is a singleton. But you do need this logic. As far as I see consume_type \u003d\u003d False if the parameter is not provided. True if \u0027all\u0027 is requested and None if \u0027unknown\u0027 is requested. And you want to express that it is either True or None. \n \nI suggest to help the future reader and rewrite this to:\n\n  if consumer_type is None or consumer_type:\n\nOr note that logic in the comment:\n\n  # Handle \u0027all\u0027 or \u0027unknown\u0027  consumer type. The consumer_type is True if \u0027all\u0027 is requested, and None if \u0027unknown\u0027 is requested.","commit_id":"4eebb2d1187c0dbbd5dba6c36cc937a9063efc9b"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"09e82d99426be20d11170647bd2e522cd6b3df09","unresolved":true,"context_lines":[{"line_number":89,"context_line":"    query \u003d query.group_by(models.Allocation.resource_class_id)"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    # Handle \u0027all\u0027 or \u0027unknown\u0027 consumer type"},{"line_number":92,"context_line":"    if consumer_type is not False:"},{"line_number":93,"context_line":"        # NOTE(melwitt): We have to count the number of consumers in a separate"},{"line_number":94,"context_line":"        # query in order to get a count of unique consumers. If we count in the"},{"line_number":95,"context_line":"        # same query after grouping by resource class, we will count duplicate"}],"source_content_type":"text/x-python","patch_set":20,"id":"732e91f8_6525abe2","line":92,"in_reply_to":"1b81a356_e68d0ca4","updated":"2021-07-22 17:11:42.000000000","message":"This comment sounded familiar from an earlier PS and I think I attempted to address it with the code comment on L91 but I agree it\u0027s likely not clear enough for readers. I will update to the logic you suggest.","commit_id":"4eebb2d1187c0dbbd5dba6c36cc937a9063efc9b"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"ddd4ab7fa22d4ffd056682aa7f560d4d14074a62","unresolved":true,"context_lines":[{"line_number":74,"context_line":""},{"line_number":75,"context_line":"@db_api.placement_context_manager.reader"},{"line_number":76,"context_line":"def _get_all_by_project_user(context, project_id, user_id\u003dNone,"},{"line_number":77,"context_line":"                             consumer_type\u003dFalse):"},{"line_number":78,"context_line":"    query \u003d (context.session.query(models.Allocation.resource_class_id,"},{"line_number":79,"context_line":"             func.coalesce(func.sum(models.Allocation.used), 0))"},{"line_number":80,"context_line":"             .join(models.Consumer,"}],"source_content_type":"text/x-python","patch_set":25,"id":"1a963d84_1340576c","line":77,"range":{"start_line":77,"start_character":43,"end_line":77,"end_character":48},"updated":"2021-08-19 19:02:01.000000000","message":"None","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"ddd4ab7fa22d4ffd056682aa7f560d4d14074a62","unresolved":true,"context_lines":[{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    # Handle \u0027all\u0027 or \u0027unknown\u0027 consumer type. The consumer_type is True if"},{"line_number":92,"context_line":"    # \u0027all\u0027 is requested, and None if \u0027unknown\u0027 is requested."},{"line_number":93,"context_line":"    if consumer_type is None or consumer_type:"},{"line_number":94,"context_line":"        # NOTE(melwitt): We have to count the number of consumers in a separate"},{"line_number":95,"context_line":"        # query in order to get a count of unique consumers. If we count in the"},{"line_number":96,"context_line":"        # same query after grouping by resource class, we will count duplicate"}],"source_content_type":"text/x-python","patch_set":25,"id":"af4b61d3_5c1e0fa2","line":93,"range":{"start_line":93,"start_character":7,"end_line":93,"end_character":45},"updated":"2021-08-19 19:02:01.000000000","message":"so this is true if bool(consumer_type) \u003d\u003d False.\n\npersonally i would prefer if you implemented __bool__ in the consumer type class to do this more cleanly but that could be a followup.\n\nalthough is this a string? ut would be nice if we had the type as mypy type hints or as doc comments.\n\nthe api signiture of this function in general seams rather odd to me.\ndefaulting  consumer_type to False imples it should be a boolean or trinary (TRUE|FALSE|NONE)\n\nso passing a sting \u0027all\u0027 or \u0027unknown\u0027 seams incorrectl\n\nif the type is really a string then None would be a better default then None","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"3af6abf224683df3ed944d8f3b18ba6c0154d7cb","unresolved":true,"context_lines":[{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    # Handle \u0027all\u0027 or \u0027unknown\u0027 consumer type. The consumer_type is True if"},{"line_number":92,"context_line":"    # \u0027all\u0027 is requested, and None if \u0027unknown\u0027 is requested."},{"line_number":93,"context_line":"    if consumer_type is None or consumer_type:"},{"line_number":94,"context_line":"        # NOTE(melwitt): We have to count the number of consumers in a separate"},{"line_number":95,"context_line":"        # query in order to get a count of unique consumers. If we count in the"},{"line_number":96,"context_line":"        # same query after grouping by resource class, we will count duplicate"}],"source_content_type":"text/x-python","patch_set":25,"id":"e37b967b_26e326ae","line":93,"range":{"start_line":93,"start_character":7,"end_line":93,"end_character":45},"in_reply_to":"af4b61d3_5c1e0fa2","updated":"2021-08-19 20:14:12.000000000","message":"It is trinary True/False/None. Ironically the sentence \"The consumer_type is True if \u0027all\u0027 is requested, and None if \u0027unknown\u0027 is requested.\" was added during review to add clarity 😆\n\nAgree a docstring would have solved the problem better.","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"ddd4ab7fa22d4ffd056682aa7f560d4d14074a62","unresolved":true,"context_lines":[{"line_number":134,"context_line":"@db_api.placement_context_manager.reader"},{"line_number":135,"context_line":"def _get_by_consumer_type(context, project_id, user_id\u003dNone,"},{"line_number":136,"context_line":"                          consumer_type\u003dNone):"},{"line_number":137,"context_line":"    if consumer_type in (\u0027all\u0027, \u0027unknown\u0027):"},{"line_number":138,"context_line":"        cons_type \u003d True if consumer_type \u003d\u003d \u0027all\u0027 else None"},{"line_number":139,"context_line":"        return _get_all_by_project_user(context, project_id, user_id,"},{"line_number":140,"context_line":"                                        consumer_type\u003dcons_type)"}],"source_content_type":"text/x-python","patch_set":25,"id":"d8b6d1b3_7d8fe7f1","line":137,"range":{"start_line":137,"start_character":2,"end_line":137,"end_character":43},"updated":"2021-08-19 19:02:01.000000000","message":"this seams to answer my prvios question so i think we shoudl be defaulting \n\nconsumer_type\u003dNone for _get_all_by_project_user too","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"3a8d369f251136390fcb8e75efc1283def1520df","unresolved":true,"context_lines":[{"line_number":134,"context_line":"@db_api.placement_context_manager.reader"},{"line_number":135,"context_line":"def _get_by_consumer_type(context, project_id, user_id\u003dNone,"},{"line_number":136,"context_line":"                          consumer_type\u003dNone):"},{"line_number":137,"context_line":"    if consumer_type in (\u0027all\u0027, \u0027unknown\u0027):"},{"line_number":138,"context_line":"        cons_type \u003d True if consumer_type \u003d\u003d \u0027all\u0027 else None"},{"line_number":139,"context_line":"        return _get_all_by_project_user(context, project_id, user_id,"},{"line_number":140,"context_line":"                                        consumer_type\u003dcons_type)"}],"source_content_type":"text/x-python","patch_set":25,"id":"44aea078_264943ec","line":137,"range":{"start_line":137,"start_character":2,"end_line":137,"end_character":43},"in_reply_to":"bfa76922_f8817db5","updated":"2021-08-24 10:43:33.000000000","message":"i see im not really a fan of this design but\n\ni woudl personaly prefer keep usign the string or convert them to an enuma rathert then intorduce the trinaary but i don tthink we should hold up the review for this. it could be address later if we decide too.","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"3af6abf224683df3ed944d8f3b18ba6c0154d7cb","unresolved":true,"context_lines":[{"line_number":134,"context_line":"@db_api.placement_context_manager.reader"},{"line_number":135,"context_line":"def _get_by_consumer_type(context, project_id, user_id\u003dNone,"},{"line_number":136,"context_line":"                          consumer_type\u003dNone):"},{"line_number":137,"context_line":"    if consumer_type in (\u0027all\u0027, \u0027unknown\u0027):"},{"line_number":138,"context_line":"        cons_type \u003d True if consumer_type \u003d\u003d \u0027all\u0027 else None"},{"line_number":139,"context_line":"        return _get_all_by_project_user(context, project_id, user_id,"},{"line_number":140,"context_line":"                                        consumer_type\u003dcons_type)"}],"source_content_type":"text/x-python","patch_set":25,"id":"bfa76922_f8817db5","line":137,"range":{"start_line":137,"start_character":2,"end_line":137,"end_character":43},"in_reply_to":"d8b6d1b3_7d8fe7f1","updated":"2021-08-19 20:14:12.000000000","message":"Unfortunately no it doesn\u0027t answer the question because L138 cons_type is what gets passed to _get_all_by_project_user :/ So it was intended to default to False.","commit_id":"37721325798dda64d96d174f9e316620639fc9c9"}],"placement/rest_api_version_history.rst":[{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"ada61f0e41c98d17863cd59e26c7bcaadb922b74","unresolved":false,"context_lines":[{"line_number":680,"context_line":"key, ``all``. Older allocations which were not created with a consumer type get"},{"line_number":681,"context_line":"a default type of ``UNKNOWN``."},{"line_number":682,"context_line":""},{"line_number":683,"context_line":"The corresponding changes to ``/reshaper`` are included."}],"source_content_type":"text/x-rst","patch_set":9,"id":"3fa7e38b_5608f923","line":683,"range":{"start_line":683,"start_character":31,"end_line":683,"end_character":40},"updated":"2020-01-16 12:42:32.000000000","message":"nit : POST /reshaper","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f65bc62b27ac8720b5e7e17edefd274978b6f1ac","unresolved":false,"context_lines":[{"line_number":680,"context_line":"key, ``all``. Older allocations which were not created with a consumer type get"},{"line_number":681,"context_line":"a default type of ``UNKNOWN``."},{"line_number":682,"context_line":""},{"line_number":683,"context_line":"The corresponding changes to ``/reshaper`` are included."}],"source_content_type":"text/x-rst","patch_set":9,"id":"3fa7e38b_ec132a67","line":683,"range":{"start_line":683,"start_character":31,"end_line":683,"end_character":40},"in_reply_to":"3fa7e38b_5608f923","updated":"2020-02-07 02:40:12.000000000","message":"Done","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"}],"placement/schemas/allocation.py":[{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"ada61f0e41c98d17863cd59e26c7bcaadb922b74","unresolved":false,"context_lines":[{"line_number":196,"context_line":"ALLOCATION_SCHEMA_V1_37 \u003d copy.deepcopy(ALLOCATION_SCHEMA_V1_34)"},{"line_number":197,"context_line":"ALLOCATION_SCHEMA_V1_37[\u0027properties\u0027][\u0027consumer_type\u0027] \u003d {"},{"line_number":198,"context_line":"    \"type\": \"string\","},{"line_number":199,"context_line":"    \"pattern\": common.RC_PATTERN,"},{"line_number":200,"context_line":"    \"minLength\": 1,"},{"line_number":201,"context_line":"    \"maxLength\": 255,"},{"line_number":202,"context_line":"}"}],"source_content_type":"text/x-python","patch_set":9,"id":"3fa7e38b_f3fc97b7","line":199,"range":{"start_line":199,"start_character":22,"end_line":199,"end_character":32},"updated":"2020-01-16 12:42:32.000000000","message":"nit: I would use another explanatory variables","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"425205459921951acbacd0a3df1f8f075b49cfd4","unresolved":false,"context_lines":[{"line_number":196,"context_line":"ALLOCATION_SCHEMA_V1_37 \u003d copy.deepcopy(ALLOCATION_SCHEMA_V1_34)"},{"line_number":197,"context_line":"ALLOCATION_SCHEMA_V1_37[\u0027properties\u0027][\u0027consumer_type\u0027] \u003d {"},{"line_number":198,"context_line":"    \"type\": \"string\","},{"line_number":199,"context_line":"    \"pattern\": common.RC_PATTERN,"},{"line_number":200,"context_line":"    \"minLength\": 1,"},{"line_number":201,"context_line":"    \"maxLength\": 255,"},{"line_number":202,"context_line":"}"}],"source_content_type":"text/x-python","patch_set":9,"id":"3fa7e38b_fd2af22b","line":199,"range":{"start_line":199,"start_character":22,"end_line":199,"end_character":32},"in_reply_to":"3fa7e38b_ac0d3241","updated":"2020-02-07 08:46:07.000000000","message":"Sorry for confusing you, I thought I would use for example\n\n    common.CONSUMER_TYPE_PATTERN\n\nhere letting\n\n    CONSUMER_TYPE_PATTERN \u003d _RC_TRAIT_PATTERN\n    CNSMR_TYPE_GET_PATTERN \u003d \"%s|^all$\" % CONSUMER_TYPE_PATTERN\n\nsince using resource class pattern for consumer type looks a bit weird.\n\nJust a naming issue so this is a nit.","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f65bc62b27ac8720b5e7e17edefd274978b6f1ac","unresolved":false,"context_lines":[{"line_number":196,"context_line":"ALLOCATION_SCHEMA_V1_37 \u003d copy.deepcopy(ALLOCATION_SCHEMA_V1_34)"},{"line_number":197,"context_line":"ALLOCATION_SCHEMA_V1_37[\u0027properties\u0027][\u0027consumer_type\u0027] \u003d {"},{"line_number":198,"context_line":"    \"type\": \"string\","},{"line_number":199,"context_line":"    \"pattern\": common.RC_PATTERN,"},{"line_number":200,"context_line":"    \"minLength\": 1,"},{"line_number":201,"context_line":"    \"maxLength\": 255,"},{"line_number":202,"context_line":"}"}],"source_content_type":"text/x-python","patch_set":9,"id":"3fa7e38b_ac0d3241","line":199,"range":{"start_line":199,"start_character":22,"end_line":199,"end_character":32},"in_reply_to":"3fa7e38b_f3fc97b7","updated":"2020-02-07 02:40:12.000000000","message":"Sorry, I don\u0027t understand what you mean here. Is there another variable I should use or are you saying I should make a new variable/alias?","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"931f9ea0185645eb7158761e3d8b2b9f336fee02","unresolved":false,"context_lines":[{"line_number":196,"context_line":"ALLOCATION_SCHEMA_V1_37 \u003d copy.deepcopy(ALLOCATION_SCHEMA_V1_34)"},{"line_number":197,"context_line":"ALLOCATION_SCHEMA_V1_37[\u0027properties\u0027][\u0027consumer_type\u0027] \u003d {"},{"line_number":198,"context_line":"    \"type\": \"string\","},{"line_number":199,"context_line":"    \"pattern\": common.RC_PATTERN,"},{"line_number":200,"context_line":"    \"minLength\": 1,"},{"line_number":201,"context_line":"    \"maxLength\": 255,"},{"line_number":202,"context_line":"}"}],"source_content_type":"text/x-python","patch_set":9,"id":"3fa7e38b_b1525769","line":199,"range":{"start_line":199,"start_character":22,"end_line":199,"end_character":32},"in_reply_to":"3fa7e38b_fd2af22b","updated":"2020-02-07 23:22:41.000000000","message":"Got it, thanks.","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"d8dec865854efe12377632588d1a17153be7d6c8","unresolved":false,"context_lines":[{"line_number":196,"context_line":"ALLOCATION_SCHEMA_V1_37 \u003d copy.deepcopy(ALLOCATION_SCHEMA_V1_34)"},{"line_number":197,"context_line":"ALLOCATION_SCHEMA_V1_37[\u0027properties\u0027][\u0027consumer_type\u0027] \u003d {"},{"line_number":198,"context_line":"    \"type\": \"string\","},{"line_number":199,"context_line":"    \"pattern\": common.RC_PATTERN,"},{"line_number":200,"context_line":"    \"minLength\": 1,"},{"line_number":201,"context_line":"    \"maxLength\": 255,"},{"line_number":202,"context_line":"}"}],"source_content_type":"text/x-python","patch_set":10,"id":"3fa7e38b_1fb2664b","line":199,"range":{"start_line":199,"start_character":22,"end_line":199,"end_character":32},"updated":"2020-02-07 02:55:39.000000000","message":"Ask tetsuro about what to do here","commit_id":"a929380b9893e66310e9bb96c56f37694590a261"}],"placement/schemas/common.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"2e628f71cc96f0edbc44fe7becbcb77b91df7a99","unresolved":true,"context_lines":[{"line_number":21,"context_line":"CUSTOM_RC_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":22,"context_line":"CUSTOM_TRAIT_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":23,"context_line":"CONSUMER_TYPE_PATTERN \u003d _RC_TRAIT_PATTERN"},{"line_number":24,"context_line":"CONSUMER_TYPE_GET_PATTERN \u003d \"%s|^all$\" % CONSUMER_TYPE_PATTERN"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"# The suffix used with request groups. Prior to 1.33, the group were numbered."},{"line_number":27,"context_line":"# With 1.33 they become alphanumeric, \u0027_\u0027, and \u0027-\u0027 with a length limit of 64."}],"source_content_type":"text/x-python","patch_set":16,"id":"755e5de9_1a242321","line":24,"range":{"start_line":24,"start_character":28,"end_line":24,"end_character":36},"updated":"2021-04-27 15:52:31.000000000","message":"I guess it is intentional that all the consumer_types will be upper case except the placeholder value \"all\". It is OK to me as it allows the user to still use all the upper case names including ALL as well. (I guess we use a case sensitive database)","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":false,"context_lines":[{"line_number":21,"context_line":"CUSTOM_RC_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":22,"context_line":"CUSTOM_TRAIT_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":23,"context_line":"CONSUMER_TYPE_PATTERN \u003d _RC_TRAIT_PATTERN"},{"line_number":24,"context_line":"CONSUMER_TYPE_GET_PATTERN \u003d \"%s|^all$\" % CONSUMER_TYPE_PATTERN"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"# The suffix used with request groups. Prior to 1.33, the group were numbered."},{"line_number":27,"context_line":"# With 1.33 they become alphanumeric, \u0027_\u0027, and \u0027-\u0027 with a length limit of 64."}],"source_content_type":"text/x-python","patch_set":16,"id":"96d34da1_74bfe0b5","line":24,"range":{"start_line":24,"start_character":28,"end_line":24,"end_character":36},"in_reply_to":"3bed81e5_a44e53cc","updated":"2021-05-17 15:00:37.000000000","message":"I think mysql still stores the data in case sensitive way, but the collation is case insensitive by default. So we are good here with casing. So user can create an ALL type and use it while the \u0027all\u0027 query means the same: all, regardless of the value of the consumer_type.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"02540ab141a781586538df7368c3ca392edca9fb","unresolved":true,"context_lines":[{"line_number":21,"context_line":"CUSTOM_RC_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":22,"context_line":"CUSTOM_TRAIT_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":23,"context_line":"CONSUMER_TYPE_PATTERN \u003d _RC_TRAIT_PATTERN"},{"line_number":24,"context_line":"CONSUMER_TYPE_GET_PATTERN \u003d \"%s|^all$\" % CONSUMER_TYPE_PATTERN"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"# The suffix used with request groups. Prior to 1.33, the group were numbered."},{"line_number":27,"context_line":"# With 1.33 they become alphanumeric, \u0027_\u0027, and \u0027-\u0027 with a length limit of 64."}],"source_content_type":"text/x-python","patch_set":16,"id":"9c54f10c_5b0d9c6f","line":24,"range":{"start_line":24,"start_character":28,"end_line":24,"end_character":36},"in_reply_to":"755e5de9_1a242321","updated":"2021-04-27 22:29:57.000000000","message":"Hmmm ... so by default MySQL is actually case insensitive. Our column is declared like:\n\n sa.Column(\u0027name\u0027, sa.Unicode(length\u003d255), nullable\u003dFalse),\n\nand IIRC we would need to set mysql_charset\u003d\u0027latin1\u0027 [1] to make things behave with case sensitivity. However I don\u0027t see _anything_ like that in the placement repo now, so I\u0027m not sure if things became case insensitive for MySQL or if it\u0027s been address some other way?\n\nEither way, a good point because AFAIK \"all\" would be treated the same as \"ALL\" from a database query perspective. I will need to research this more.\n\n[1] example: https://github.com/openstack/nova/blob/eba9d596daa91d8f702b719afb88cb89f2d5bb32/nova/db/sqlalchemy/api_migrations/migrate_repo/versions/067_train.py#L280","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"3512da936be4510b22b795ddd2466195628ea5e0","unresolved":true,"context_lines":[{"line_number":21,"context_line":"CUSTOM_RC_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":22,"context_line":"CUSTOM_TRAIT_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":23,"context_line":"CONSUMER_TYPE_PATTERN \u003d _RC_TRAIT_PATTERN"},{"line_number":24,"context_line":"CONSUMER_TYPE_GET_PATTERN \u003d \"%s|^all$\" % CONSUMER_TYPE_PATTERN"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"# The suffix used with request groups. Prior to 1.33, the group were numbered."},{"line_number":27,"context_line":"# With 1.33 they become alphanumeric, \u0027_\u0027, and \u0027-\u0027 with a length limit of 64."}],"source_content_type":"text/x-python","patch_set":16,"id":"3bed81e5_a44e53cc","line":24,"range":{"start_line":24,"start_character":28,"end_line":24,"end_character":36},"in_reply_to":"9c54f10c_5b0d9c6f","updated":"2021-05-03 10:43:00.000000000","message":"Interesting. The old nova db migrations shows that originally the placement DB tables was created with latin1 charset https://github.com/openstack/nova/blob/294b30b281dde4a7c438cc1b9fa4842927394a17/nova/db/sqlalchemy/api_migrations/migrate_repo/versions/067_train.py#L243-L250\n\nBut I also don\u0027t see the related model settings in placement.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"b222e5425ed46b6d0c0fc3f3b97b21996e35148a","unresolved":true,"context_lines":[{"line_number":20,"context_line":"_CUSTOM_RC_TRAIT_PATTERN \u003d \"^CUSTOM_%s+$\" % _RC_TRAIT_CHAR"},{"line_number":21,"context_line":"CUSTOM_RC_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":22,"context_line":"CUSTOM_TRAIT_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":23,"context_line":"CONSUMER_TYPE_PATTERN \u003d _RC_TRAIT_PATTERN"},{"line_number":24,"context_line":"CONSUMER_TYPE_GET_PATTERN \u003d \"%s|^all|^unknown$\" % CONSUMER_TYPE_PATTERN"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"# The suffix used with request groups. Prior to 1.33, the group were numbered."}],"source_content_type":"text/x-python","patch_set":17,"id":"158352da_d3627661","line":23,"updated":"2021-05-14 03:29:34.000000000","message":"I note that this prevents users from nulling out a consumer type or adding a new consumer without a type unless they use microversion 1.36. I\u0027m not sure whether this is a problem. We require a consumer type in the request schema \u003e\u003d 1.37 so I tend to think the intent is to have a type and not be able to create an \"unknown\" type consumer. \n\nPrevious iterations of this patch allowed specification of consumer_type\u003dUNKNOWN when PUT\u0027ing allocations ... but that would result in adding new consumers exactly like the old ones that existed before the consumer_type requirement and would be the same as using microversion 1.36.\n\nLet me know if I\u0027m missing a use case here.","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"78d6c5eaae925aa344095d3f413fe2e46d1451f4","unresolved":true,"context_lines":[{"line_number":20,"context_line":"_CUSTOM_RC_TRAIT_PATTERN \u003d \"^CUSTOM_%s+$\" % _RC_TRAIT_CHAR"},{"line_number":21,"context_line":"CUSTOM_RC_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":22,"context_line":"CUSTOM_TRAIT_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":23,"context_line":"CONSUMER_TYPE_PATTERN \u003d _RC_TRAIT_PATTERN"},{"line_number":24,"context_line":"CONSUMER_TYPE_GET_PATTERN \u003d \"%s|^all|^unknown$\" % CONSUMER_TYPE_PATTERN"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"# The suffix used with request groups. Prior to 1.33, the group were numbered."}],"source_content_type":"text/x-python","patch_set":17,"id":"3b5716f4_59476763","line":23,"in_reply_to":"158352da_d3627661","updated":"2021-05-14 03:33:22.000000000","message":"I also note that the consumer types tests in PS8 (before I began working on this series) did not use a PUT with consumer_type\u003dUNKNOWN. Instead it did a PUT with microversion 1.36 and then verified doing that resulted in consumer type UNKNOWN:\n\nhttps://review.opendev.org/c/openstack/placement/+/679441/8/placement/tests/functional/gabbits/consumer-types-1.37.yaml@70","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":false,"context_lines":[{"line_number":20,"context_line":"_CUSTOM_RC_TRAIT_PATTERN \u003d \"^CUSTOM_%s+$\" % _RC_TRAIT_CHAR"},{"line_number":21,"context_line":"CUSTOM_RC_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":22,"context_line":"CUSTOM_TRAIT_PATTERN \u003d _CUSTOM_RC_TRAIT_PATTERN"},{"line_number":23,"context_line":"CONSUMER_TYPE_PATTERN \u003d _RC_TRAIT_PATTERN"},{"line_number":24,"context_line":"CONSUMER_TYPE_GET_PATTERN \u003d \"%s|^all|^unknown$\" % CONSUMER_TYPE_PATTERN"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"# The suffix used with request groups. Prior to 1.33, the group were numbered."}],"source_content_type":"text/x-python","patch_set":17,"id":"35d14192_78df4488","line":23,"in_reply_to":"3b5716f4_59476763","updated":"2021-05-17 15:00:37.000000000","message":"I agree that we should not allow empty consumer_types with request \u003e 1.37","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"}],"placement/tests/functional/gabbits/allocations-legacy-rbac.yaml":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"2e628f71cc96f0edbc44fe7becbcb77b91df7a99","unresolved":true,"context_lines":[{"line_number":12,"context_line":"    accept: application/json"},{"line_number":13,"context_line":"    content-type: application/json"},{"line_number":14,"context_line":"    # We need 1.36 here because 1.37 required consumer_type which these"},{"line_number":15,"context_line":"    # allocations do not have."},{"line_number":16,"context_line":"    openstack-api-version: placement 1.36"},{"line_number":17,"context_line":"    openstack-system-scope: all"},{"line_number":18,"context_line":"  - \u0026system_reader_headers"}],"source_content_type":"text/x-yaml","patch_set":16,"id":"009c6944_c0523455","line":15,"updated":"2021-04-27 15:52:31.000000000","message":"Hm, I don\u0027t know which is better, having these RBAC tests pinned to 1.36 and therefore never changes or keeping the on latest, but then we need to update them with the new consumer_type field. I guess RBAC expected to be independent from microversions so it is OK to pin it to 1.36","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"02540ab141a781586538df7368c3ca392edca9fb","unresolved":true,"context_lines":[{"line_number":12,"context_line":"    accept: application/json"},{"line_number":13,"context_line":"    content-type: application/json"},{"line_number":14,"context_line":"    # We need 1.36 here because 1.37 required consumer_type which these"},{"line_number":15,"context_line":"    # allocations do not have."},{"line_number":16,"context_line":"    openstack-api-version: placement 1.36"},{"line_number":17,"context_line":"    openstack-system-scope: all"},{"line_number":18,"context_line":"  - \u0026system_reader_headers"}],"source_content_type":"text/x-yaml","patch_set":16,"id":"45a834a5_4019aed3","line":15,"in_reply_to":"009c6944_c0523455","updated":"2021-04-27 22:29:57.000000000","message":"Yeah I\u0027m not opinionated about it, I took the easy way out for the first pass 😛\n\nAnd yeah, that\u0027s the rationale I was thinking, that the intention of these tests is focused on testing RBAC and it doesn\u0027t care about consumer types.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"3512da936be4510b22b795ddd2466195628ea5e0","unresolved":false,"context_lines":[{"line_number":12,"context_line":"    accept: application/json"},{"line_number":13,"context_line":"    content-type: application/json"},{"line_number":14,"context_line":"    # We need 1.36 here because 1.37 required consumer_type which these"},{"line_number":15,"context_line":"    # allocations do not have."},{"line_number":16,"context_line":"    openstack-api-version: placement 1.36"},{"line_number":17,"context_line":"    openstack-system-scope: all"},{"line_number":18,"context_line":"  - \u0026system_reader_headers"}],"source_content_type":"text/x-yaml","patch_set":16,"id":"6b5ca46a_d1600e7b","line":15,"in_reply_to":"45a834a5_4019aed3","updated":"2021-05-03 10:43:00.000000000","message":"Ack","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"}],"placement/tests/functional/gabbits/consumer-types-1.37.yaml":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"4085989e01be11ed311036bd519c4566ad6bd9af","unresolved":false,"context_lines":[{"line_number":82,"context_line":"  status: 204"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"- name: confirm type set"},{"line_number":85,"context_line":"  GET: $URL"},{"line_number":86,"context_line":"  response_json_paths:"},{"line_number":87,"context_line":"      $.consumer_type: UNKNOWN"},{"line_number":88,"context_line":""}],"source_content_type":"text/x-yaml","patch_set":7,"id":"5faad753_8c71390f","line":85,"updated":"2019-09-13 00:32:29.000000000","message":"What\u0027s this do? Use last test\u0027s url?","commit_id":"e1611e67a01247939152dd8e179a9baad2c1db53"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"dc8c63e84410f5627a5a75c46c2bda7929edf6f2","unresolved":false,"context_lines":[{"line_number":82,"context_line":"  status: 204"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"- name: confirm type set"},{"line_number":85,"context_line":"  GET: $URL"},{"line_number":86,"context_line":"  response_json_paths:"},{"line_number":87,"context_line":"      $.consumer_type: UNKNOWN"},{"line_number":88,"context_line":""}],"source_content_type":"text/x-yaml","patch_set":7,"id":"5faad753_85e2679f","line":85,"in_reply_to":"5faad753_8c71390f","updated":"2019-09-13 09:37:13.000000000","message":"Yes: https://gabbi.readthedocs.io/en/latest/format.html#immediately-prior-test","commit_id":"e1611e67a01247939152dd8e179a9baad2c1db53"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"7d721c50a7e54a0f8718e4c68adf4e0f35dd74f2","unresolved":false,"context_lines":[{"line_number":141,"context_line":"          consumer_count: 1"},{"line_number":142,"context_line":"          DISK_GB: 10"},{"line_number":143,"context_line":"      $.usages.UNKNOWN:"},{"line_number":144,"context_line":"          consumer_count: 2"},{"line_number":145,"context_line":"          DISK_GB: 1020"},{"line_number":146,"context_line":"          VCPU: 7"},{"line_number":147,"context_line":""}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_f4188fce","line":144,"range":{"start_line":144,"start_character":26,"end_line":144,"end_character":27},"updated":"2020-01-24 07:33:00.000000000","message":"This should be 3. Please check the fixture.","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"0bbbe17039e75a33077f320b0600c6daa7056926","unresolved":false,"context_lines":[{"line_number":141,"context_line":"          consumer_count: 1"},{"line_number":142,"context_line":"          DISK_GB: 10"},{"line_number":143,"context_line":"      $.usages.UNKNOWN:"},{"line_number":144,"context_line":"          consumer_count: 2"},{"line_number":145,"context_line":"          DISK_GB: 1020"},{"line_number":146,"context_line":"          VCPU: 7"},{"line_number":147,"context_line":""}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_2a98a965","line":144,"range":{"start_line":144,"start_character":26,"end_line":144,"end_character":27},"in_reply_to":"3fa7e38b_f4188fce","updated":"2020-01-31 01:08:07.000000000","message":"Hm, I see what you mean, I agree this should be 3:\n\nhttps://github.com/openstack/placement/blob/971c7aa76e1a3455acf8cf2210b3b7af29846696/placement/tests/functional/fixtures/gabbits.py#L169-L185\n\nNice catch btw. Let me figure out what\u0027s going on here.","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"7d721c50a7e54a0f8718e4c68adf4e0f35dd74f2","unresolved":false,"context_lines":[{"line_number":163,"context_line":"  response_json_paths:"},{"line_number":164,"context_line":"      $.usages.`len`: 1"},{"line_number":165,"context_line":"      $.usages.all:"},{"line_number":166,"context_line":"          consumer_count: 4"},{"line_number":167,"context_line":"          DISK_GB: 1040"},{"line_number":168,"context_line":"          VCPU: 7"},{"line_number":169,"context_line":""}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_d479d3fa","line":166,"range":{"start_line":166,"start_character":26,"end_line":166,"end_character":27},"updated":"2020-01-24 07:33:00.000000000","message":"5, I think.","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"d9ce150a0e75f94bad68140e97ba49239b7c0cf0","unresolved":false,"context_lines":[{"line_number":141,"context_line":"          consumer_count: 1"},{"line_number":142,"context_line":"          DISK_GB: 10"},{"line_number":143,"context_line":"      $.usages.UNKNOWN:"},{"line_number":144,"context_line":"          consumer_count: 2"},{"line_number":145,"context_line":"          DISK_GB: 1020"},{"line_number":146,"context_line":"          VCPU: 7"},{"line_number":147,"context_line":""}],"source_content_type":"text/x-yaml","patch_set":10,"id":"3fa7e38b_9f3ad694","line":144,"range":{"start_line":144,"start_character":26,"end_line":144,"end_character":27},"updated":"2020-02-07 03:09:55.000000000","message":"Argh, this is still wrong too. I completely missed that I would need to change it if I had fixed the bug correctly.","commit_id":"a929380b9893e66310e9bb96c56f37694590a261"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"d9ce150a0e75f94bad68140e97ba49239b7c0cf0","unresolved":false,"context_lines":[{"line_number":163,"context_line":"  response_json_paths:"},{"line_number":164,"context_line":"      $.usages.`len`: 1"},{"line_number":165,"context_line":"      $.usages.all:"},{"line_number":166,"context_line":"          consumer_count: 4"},{"line_number":167,"context_line":"          DISK_GB: 1040"},{"line_number":168,"context_line":"          VCPU: 7"},{"line_number":169,"context_line":""}],"source_content_type":"text/x-yaml","patch_set":10,"id":"3fa7e38b_bf3d528e","line":166,"range":{"start_line":166,"start_character":26,"end_line":166,"end_character":27},"updated":"2020-02-07 03:09:55.000000000","message":"Same here.","commit_id":"a929380b9893e66310e9bb96c56f37694590a261"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"2e628f71cc96f0edbc44fe7becbcb77b91df7a99","unresolved":true,"context_lines":[{"line_number":44,"context_line":"  POST: /allocations"},{"line_number":45,"context_line":"  data:"},{"line_number":46,"context_line":"      f5a91a0a-e111-4a9c-8a33-7b320ae1e52a:"},{"line_number":47,"context_line":"          consumer_type: INSTANCE"},{"line_number":48,"context_line":"          consumer_generation: null"},{"line_number":49,"context_line":"          project_id: $ENVIRON[\u0027PROJECT_ID\u0027]"},{"line_number":50,"context_line":"          user_id: $ENVIRON[\u0027USER_ID\u0027]"}],"source_content_type":"text/x-yaml","patch_set":16,"id":"1b0ae8c3_98836d9a","line":47,"updated":"2021-04-27 15:52:31.000000000","message":"So consumer types are auto created, if a new name appears here the first time placement will assign a new id to it. Clever.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":false,"context_lines":[{"line_number":44,"context_line":"  POST: /allocations"},{"line_number":45,"context_line":"  data:"},{"line_number":46,"context_line":"      f5a91a0a-e111-4a9c-8a33-7b320ae1e52a:"},{"line_number":47,"context_line":"          consumer_type: INSTANCE"},{"line_number":48,"context_line":"          consumer_generation: null"},{"line_number":49,"context_line":"          project_id: $ENVIRON[\u0027PROJECT_ID\u0027]"},{"line_number":50,"context_line":"          user_id: $ENVIRON[\u0027USER_ID\u0027]"}],"source_content_type":"text/x-yaml","patch_set":16,"id":"b2f40be9_5e61dacd","line":47,"in_reply_to":"1b0ae8c3_98836d9a","updated":"2021-05-17 15:00:37.000000000","message":"Ack","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"2e628f71cc96f0edbc44fe7becbcb77b91df7a99","unresolved":true,"context_lines":[{"line_number":135,"context_line":"      $.usages.INSTANCE:"},{"line_number":136,"context_line":"          consumer_count: 1"},{"line_number":137,"context_line":"          DISK_GB: 10"},{"line_number":138,"context_line":"      $.usages.unknown:"},{"line_number":139,"context_line":"          consumer_count: 3"},{"line_number":140,"context_line":"          DISK_GB: 1020"},{"line_number":141,"context_line":"          VCPU: 7"}],"source_content_type":"text/x-yaml","patch_set":16,"id":"74c79920_6f437bd9","line":138,"range":{"start_line":138,"start_character":15,"end_line":138,"end_character":22},"updated":"2021-04-27 15:52:31.000000000","message":"should this be UNKNOWN with capital letters? It does signifies a set of consumers having the same type (None) so it is different from the placeholder \"all\".","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"02540ab141a781586538df7368c3ca392edca9fb","unresolved":true,"context_lines":[{"line_number":135,"context_line":"      $.usages.INSTANCE:"},{"line_number":136,"context_line":"          consumer_count: 1"},{"line_number":137,"context_line":"          DISK_GB: 10"},{"line_number":138,"context_line":"      $.usages.unknown:"},{"line_number":139,"context_line":"          consumer_count: 3"},{"line_number":140,"context_line":"          DISK_GB: 1020"},{"line_number":141,"context_line":"          VCPU: 7"}],"source_content_type":"text/x-yaml","patch_set":16,"id":"c1fae6c1_f4f75452","line":138,"range":{"start_line":138,"start_character":15,"end_line":138,"end_character":22},"in_reply_to":"74c79920_6f437bd9","updated":"2021-04-27 22:29:57.000000000","message":"I wasn\u0027t sure about it. In previous review comments tetsuro had suggested lowercase \"unknown\" to distinguish it from the user-created uppercase names. Kind of like a reserved word. I would guess that was the thinking behind \"all\" instead of \"ALL\" as well.\n\nI\u0027m not too opinionated about it, if you think UNKNOWN would be more appropriate, I don\u0027t mind changing it to what most people find more intuitive.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"3512da936be4510b22b795ddd2466195628ea5e0","unresolved":true,"context_lines":[{"line_number":135,"context_line":"      $.usages.INSTANCE:"},{"line_number":136,"context_line":"          consumer_count: 1"},{"line_number":137,"context_line":"          DISK_GB: 10"},{"line_number":138,"context_line":"      $.usages.unknown:"},{"line_number":139,"context_line":"          consumer_count: 3"},{"line_number":140,"context_line":"          DISK_GB: 1020"},{"line_number":141,"context_line":"          VCPU: 7"}],"source_content_type":"text/x-yaml","patch_set":16,"id":"efdd20d9_0daf00a9","line":138,"range":{"start_line":138,"start_character":15,"end_line":138,"end_character":22},"in_reply_to":"c1fae6c1_f4f75452","updated":"2021-05-03 10:43:00.000000000","message":"I buy the reserved word argument. Let\u0027s keep it a lower case unknown.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":false,"context_lines":[{"line_number":135,"context_line":"      $.usages.INSTANCE:"},{"line_number":136,"context_line":"          consumer_count: 1"},{"line_number":137,"context_line":"          DISK_GB: 10"},{"line_number":138,"context_line":"      $.usages.unknown:"},{"line_number":139,"context_line":"          consumer_count: 3"},{"line_number":140,"context_line":"          DISK_GB: 1020"},{"line_number":141,"context_line":"          VCPU: 7"}],"source_content_type":"text/x-yaml","patch_set":16,"id":"6aac870d_42b75b98","line":138,"range":{"start_line":138,"start_character":15,"end_line":138,"end_character":22},"in_reply_to":"efdd20d9_0daf00a9","updated":"2021-05-17 15:00:37.000000000","message":"Ack","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"2e628f71cc96f0edbc44fe7becbcb77b91df7a99","unresolved":true,"context_lines":[{"line_number":163,"context_line":"          VCPU: 7"},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"- name: ALL is not all"},{"line_number":166,"context_line":"  GET: /usages?project_id\u003d$ENVIRON[\u0027PROJECT_ID\u0027]\u0026consumer_type\u003dALL"},{"line_number":167,"context_line":"  response_json_paths:"},{"line_number":168,"context_line":"      $.usages.`len`: 0"},{"line_number":169,"context_line":""}],"source_content_type":"text/x-yaml","patch_set":16,"id":"2e1cf02d_d64f8c6b","line":166,"range":{"start_line":166,"start_character":63,"end_line":166,"end_character":66},"updated":"2021-04-27 15:52:31.000000000","message":"can we ask for UNKONWN or unknown as well to list every consumer without a specific type?\n\nHm, can the client set the consumer type to UNKNOWN as well? Will it become a new type or will it be mapped to the None in the backend?","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"02540ab141a781586538df7368c3ca392edca9fb","unresolved":true,"context_lines":[{"line_number":163,"context_line":"          VCPU: 7"},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"- name: ALL is not all"},{"line_number":166,"context_line":"  GET: /usages?project_id\u003d$ENVIRON[\u0027PROJECT_ID\u0027]\u0026consumer_type\u003dALL"},{"line_number":167,"context_line":"  response_json_paths:"},{"line_number":168,"context_line":"      $.usages.`len`: 0"},{"line_number":169,"context_line":""}],"source_content_type":"text/x-yaml","patch_set":16,"id":"7c4c1ffe_0f542f71","line":166,"range":{"start_line":166,"start_character":63,"end_line":166,"end_character":66},"in_reply_to":"2e1cf02d_d64f8c6b","updated":"2021-04-27 22:29:57.000000000","message":"Good questions ... I am not sure TBH. I will test it and add test coverages.\n\nFrom a user perspective I think it should provide the ability to list usage by unknown consumer types. In the original proposed patches it Just Worked because UNKNOWN was a real type rather than the absence of a type.\n\nBTW if you think it should be a real type, I\u0027m open to that too. My concerns were around the data migration. Setting a \"default\u003d\" at the database column addition time will make the database backend backfill all existing records as it applies the new schema and the concern was that this could potentially time out in a large cloud. (This happened in nova when the \"hidden\" column was added to the instances table).","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"3512da936be4510b22b795ddd2466195628ea5e0","unresolved":true,"context_lines":[{"line_number":163,"context_line":"          VCPU: 7"},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"- name: ALL is not all"},{"line_number":166,"context_line":"  GET: /usages?project_id\u003d$ENVIRON[\u0027PROJECT_ID\u0027]\u0026consumer_type\u003dALL"},{"line_number":167,"context_line":"  response_json_paths:"},{"line_number":168,"context_line":"      $.usages.`len`: 0"},{"line_number":169,"context_line":""}],"source_content_type":"text/x-yaml","patch_set":16,"id":"8b09752a_8f1c1297","line":166,"range":{"start_line":166,"start_character":63,"end_line":166,"end_character":66},"in_reply_to":"7c4c1ffe_0f542f71","updated":"2021-05-03 10:43:00.000000000","message":"+1 for allow listing consumers with unknown type.\n\n+1 to keep unknown special to avoid db migration.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"b222e5425ed46b6d0c0fc3f3b97b21996e35148a","unresolved":true,"context_lines":[{"line_number":165,"context_line":"- name: ALL is not all"},{"line_number":166,"context_line":"  GET: /usages?project_id\u003d$ENVIRON[\u0027PROJECT_ID\u0027]\u0026consumer_type\u003dALL"},{"line_number":167,"context_line":"  response_json_paths:"},{"line_number":168,"context_line":"      $.usages.`len`: 0"},{"line_number":169,"context_line":""},{"line_number":170,"context_line":"- name: limit usages by unknown"},{"line_number":171,"context_line":"  GET: /usages?project_id\u003d$ENVIRON[\u0027PROJECT_ID\u0027]\u0026consumer_type\u003dunknown"}],"source_content_type":"text/x-yaml","patch_set":17,"id":"6a4ceacc_ef06d1cc","line":168,"updated":"2021-05-14 03:29:34.000000000","message":"Here shows that \"ALL\" is indeed treated as different than \"all\".","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":false,"context_lines":[{"line_number":165,"context_line":"- name: ALL is not all"},{"line_number":166,"context_line":"  GET: /usages?project_id\u003d$ENVIRON[\u0027PROJECT_ID\u0027]\u0026consumer_type\u003dALL"},{"line_number":167,"context_line":"  response_json_paths:"},{"line_number":168,"context_line":"      $.usages.`len`: 0"},{"line_number":169,"context_line":""},{"line_number":170,"context_line":"- name: limit usages by unknown"},{"line_number":171,"context_line":"  GET: /usages?project_id\u003d$ENVIRON[\u0027PROJECT_ID\u0027]\u0026consumer_type\u003dunknown"}],"source_content_type":"text/x-yaml","patch_set":17,"id":"2e306659_bf930cab","line":168,"in_reply_to":"6a4ceacc_ef06d1cc","updated":"2021-05-17 15:00:37.000000000","message":"Ack","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"b222e5425ed46b6d0c0fc3f3b97b21996e35148a","unresolved":true,"context_lines":[{"line_number":180,"context_line":"  GET: /usages?project_id\u003d$ENVIRON[\u0027PROJECT_ID\u0027]\u0026consumer_type\u003dUNKNOWN"},{"line_number":181,"context_line":"  response_json_paths:"},{"line_number":182,"context_line":"      $.usages.`len`: 0"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"- name: reshaper accepts consumer type"},{"line_number":185,"context_line":"  POST: /reshaper"},{"line_number":186,"context_line":"  data:"}],"source_content_type":"text/x-yaml","patch_set":17,"id":"6685eed9_3deccc75","line":183,"updated":"2021-05-14 03:29:34.000000000","message":"Same here.","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":false,"context_lines":[{"line_number":180,"context_line":"  GET: /usages?project_id\u003d$ENVIRON[\u0027PROJECT_ID\u0027]\u0026consumer_type\u003dUNKNOWN"},{"line_number":181,"context_line":"  response_json_paths:"},{"line_number":182,"context_line":"      $.usages.`len`: 0"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"- name: reshaper accepts consumer type"},{"line_number":185,"context_line":"  POST: /reshaper"},{"line_number":186,"context_line":"  data:"}],"source_content_type":"text/x-yaml","patch_set":17,"id":"2ed167aa_757851bc","line":183,"in_reply_to":"6685eed9_3deccc75","updated":"2021-05-17 15:00:37.000000000","message":"Ack","commit_id":"5e9330bf95f1525f154c30ce74038eebad8559c0"}],"placement/tests/unit/handlers/test_util.py":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"6af29cb69fbab27e16e525e0656f9515043867a0","unresolved":true,"context_lines":[{"line_number":317,"context_line":"            consumer_gen, \u0027TYPE\u0027, self.cons_type_req_version)"},{"line_number":318,"context_line":"        # Expect 2 calls to update(), first to update it to the supplied"},{"line_number":319,"context_line":"        # consumer type ID and the second to roll it back"},{"line_number":320,"context_line":"        self.assertEqual(2, self.mock_consumer_update.call_count)"},{"line_number":321,"context_line":"        # Consumer should have its original consumer type ID \u003d 1"},{"line_number":322,"context_line":"        self.assertEqual(1, consumer.consumer_type_id)"}],"source_content_type":"text/x-python","patch_set":21,"id":"ca5c8de7_36ac5314","line":320,"updated":"2021-07-22 17:40:50.000000000","message":"Oops, this is not true since moving the consumer type update logic.","commit_id":"d834f95b267826d6315d53af2462d6f380baeb6d"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"896abdf434c026802efddb0f3c0c0b49e6b7c3cb","unresolved":true,"context_lines":[{"line_number":317,"context_line":"            consumer_gen, \u0027TYPE\u0027, self.cons_type_req_version)"},{"line_number":318,"context_line":"        # Expect 2 calls to update(), first to update it to the supplied"},{"line_number":319,"context_line":"        # consumer type ID and the second to roll it back"},{"line_number":320,"context_line":"        self.assertEqual(2, self.mock_consumer_update.call_count)"},{"line_number":321,"context_line":"        # Consumer should have its original consumer type ID \u003d 1"},{"line_number":322,"context_line":"        self.assertEqual(1, consumer.consumer_type_id)"}],"source_content_type":"text/x-python","patch_set":21,"id":"724b4101_597233e4","line":320,"in_reply_to":"ca5c8de7_36ac5314","updated":"2021-07-22 17:46:50.000000000","message":"Update: it looks like we no longer need the rollback logic or this test anymore since the consumer type update was moved to happen later.","commit_id":"d834f95b267826d6315d53af2462d6f380baeb6d"}],"releasenotes/notes/consumer_type-857b812aef10381e.yaml":[{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"ada61f0e41c98d17863cd59e26c7bcaadb922b74","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"features:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    Microversion 1.37 Adds support for a ``consumer_type`` (required) key in"},{"line_number":5,"context_line":"    the request body of ``POST /allocations``, ``PUT"},{"line_number":6,"context_line":"    /allocations/{consumer_uuid}`` and in the response of ``GET"},{"line_number":7,"context_line":"    /allocations/{consumer_uuid}``. ``GET /usages`` requests gain a"}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_e1f7e459","line":4,"range":{"start_line":4,"start_character":22,"end_line":4,"end_character":26},"updated":"2020-01-16 12:42:32.000000000","message":"adds","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f65bc62b27ac8720b5e7e17edefd274978b6f1ac","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"features:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    Microversion 1.37 Adds support for a ``consumer_type`` (required) key in"},{"line_number":5,"context_line":"    the request body of ``POST /allocations``, ``PUT"},{"line_number":6,"context_line":"    /allocations/{consumer_uuid}`` and in the response of ``GET"},{"line_number":7,"context_line":"    /allocations/{consumer_uuid}``. ``GET /usages`` requests gain a"}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_cc10ae5b","line":4,"range":{"start_line":4,"start_character":22,"end_line":4,"end_character":26},"in_reply_to":"3fa7e38b_e1f7e459","updated":"2020-02-07 02:40:12.000000000","message":"Done","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"ada61f0e41c98d17863cd59e26c7bcaadb922b74","unresolved":false,"context_lines":[{"line_number":13,"context_line":"    under one key, ``all``. Older allocations which were not created with a"},{"line_number":14,"context_line":"    consumer type get a default type of ``UNKNOWN``."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"    The corresponding changes to ``/reshaper`` are included."}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_01f3206f","line":16,"range":{"start_line":16,"start_character":35,"end_line":16,"end_character":44},"updated":"2020-01-16 12:42:32.000000000","message":"nit: POST /reshaper","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f65bc62b27ac8720b5e7e17edefd274978b6f1ac","unresolved":false,"context_lines":[{"line_number":13,"context_line":"    under one key, ``all``. Older allocations which were not created with a"},{"line_number":14,"context_line":"    consumer type get a default type of ``UNKNOWN``."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"    The corresponding changes to ``/reshaper`` are included."}],"source_content_type":"text/x-yaml","patch_set":9,"id":"3fa7e38b_6c073a20","line":16,"range":{"start_line":16,"start_character":35,"end_line":16,"end_character":44},"in_reply_to":"3fa7e38b_01f3206f","updated":"2020-02-07 02:40:12.000000000","message":"Done","commit_id":"3f7493bb5f383ca7ceb948f9439486e89efedbc9"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"2e628f71cc96f0edbc44fe7becbcb77b91df7a99","unresolved":true,"context_lines":[{"line_number":11,"context_line":"    irrespective of whether the ``consumer_type`` was specified in the request."},{"line_number":12,"context_line":"    If an ``all`` ``consumer_type`` key is provided, all results are grouped"},{"line_number":13,"context_line":"    under one key, ``all``. Older allocations which were not created with a"},{"line_number":14,"context_line":"    consumer type get a default type of ``UNKNOWN``."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"    The corresponding changes to ``POST /reshaper`` are included."}],"source_content_type":"text/x-yaml","patch_set":16,"id":"a54476cc_1a5d6342","line":14,"range":{"start_line":14,"start_character":40,"end_line":14,"end_character":51},"updated":"2021-04-27 15:52:31.000000000","message":"Is it capital then? (see my comments in the gabbit tests)","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"02540ab141a781586538df7368c3ca392edca9fb","unresolved":true,"context_lines":[{"line_number":11,"context_line":"    irrespective of whether the ``consumer_type`` was specified in the request."},{"line_number":12,"context_line":"    If an ``all`` ``consumer_type`` key is provided, all results are grouped"},{"line_number":13,"context_line":"    under one key, ``all``. Older allocations which were not created with a"},{"line_number":14,"context_line":"    consumer type get a default type of ``UNKNOWN``."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"    The corresponding changes to ``POST /reshaper`` are included."}],"source_content_type":"text/x-yaml","patch_set":16,"id":"ef32945d_73e16c07","line":14,"range":{"start_line":14,"start_character":40,"end_line":14,"end_character":51},"in_reply_to":"a54476cc_1a5d6342","updated":"2021-04-27 22:29:57.000000000","message":"This is old stuff from the original proposal that I missed.","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d26c245d0312e2f14c5c3eafcc6632cc88f6739c","unresolved":false,"context_lines":[{"line_number":11,"context_line":"    irrespective of whether the ``consumer_type`` was specified in the request."},{"line_number":12,"context_line":"    If an ``all`` ``consumer_type`` key is provided, all results are grouped"},{"line_number":13,"context_line":"    under one key, ``all``. Older allocations which were not created with a"},{"line_number":14,"context_line":"    consumer type get a default type of ``UNKNOWN``."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"    The corresponding changes to ``POST /reshaper`` are included."}],"source_content_type":"text/x-yaml","patch_set":16,"id":"c6f630ac_247661d8","line":14,"range":{"start_line":14,"start_character":40,"end_line":14,"end_character":51},"in_reply_to":"ef32945d_73e16c07","updated":"2021-05-17 15:00:37.000000000","message":"Ack","commit_id":"192b8e767137abac792a0a20f3f6535359e4be7f"}]}
