)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"a2f304612bd01f551a132305a1f69a0119d62d20","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Consider nested RPs in get_all_with_shared"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When there are both nested resource providers and shared resource"},{"line_number":10,"context_line":"providers, we shoud check both providers for each resource class."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"This patch starts to check nested resource providers in addition to"},{"line_number":13,"context_line":"shared resource providers if there are ones available."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"bf659307_ebb804c9","line":10,"range":{"start_line":10,"start_character":14,"end_line":10,"end_character":19},"updated":"2018-03-28 15:28:37.000000000","message":"should","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db820c583ddf80c487c3e7baff3cde705c04ecf6","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Consider nested RPs in get_all_with_shared"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When there are both nested resource providers and shared resource"},{"line_number":10,"context_line":"providers, we shoud check both providers for each resource class."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"This patch starts to check nested resource providers in addition to"},{"line_number":13,"context_line":"shared resource providers if there are ones available."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"9f6a8fd7_959d8a0b","line":10,"range":{"start_line":10,"start_character":14,"end_line":10,"end_character":19},"updated":"2018-05-01 22:07:08.000000000","message":"should","commit_id":"a74e9b361457f0598a417779d3ca586174ecfc8d"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"6f8a1ed2bdd8612c83df3fd7b9b7e49d5280b69f","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"This patch changes get_all_with_shared() function proceeding to"},{"line_number":16,"context_line":"_alloc_candidates_with_shared(), which will also be changed to"},{"line_number":17,"context_line":"consider nested prociders in the following patch."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Change-Id: Ia4f471451ba0b8f6360ca5c58696e5a454535e2a"},{"line_number":20,"context_line":"Blueprint: nested-resource-providers-allocation-candidates"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"9f6a8fd7_18f8f346","line":17,"range":{"start_line":17,"start_character":16,"end_line":17,"end_character":25},"updated":"2018-04-23 12:52:40.000000000","message":"providers","commit_id":"a74e9b361457f0598a417779d3ca586174ecfc8d"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"d3c8996f3f7d91c1e038592738b24810833170fe","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"This patch changes get_all_with_shared() function proceeding to"},{"line_number":16,"context_line":"_alloc_candidates_with_shared(), which will also be changed to"},{"line_number":17,"context_line":"consider nested prociders in the following patch."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Change-Id: Ia4f471451ba0b8f6360ca5c58696e5a454535e2a"},{"line_number":20,"context_line":"Blueprint: nested-resource-providers-allocation-candidates"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"9f6a8fd7_11ca726d","line":17,"range":{"start_line":17,"start_character":16,"end_line":17,"end_character":25},"in_reply_to":"9f6a8fd7_18f8f346","updated":"2018-05-01 12:22:55.000000000","message":"Done","commit_id":"a74e9b361457f0598a417779d3ca586174ecfc8d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"34062342f0affeaa489749161060b5e5ce34e3a3","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Consider nested RPs in get_all_with_shared"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When there are both nested resource providers and shared resource"},{"line_number":10,"context_line":"providers, we shoud check both providers for each resource class."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"This patch starts to check nested resource providers in addition to"},{"line_number":13,"context_line":"shared resource providers if there are ones available."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":15,"id":"5f7c97a3_4965bab4","line":10,"range":{"start_line":10,"start_character":14,"end_line":10,"end_character":19},"updated":"2018-05-07 14:42:01.000000000","message":"should","commit_id":"3913475476be7554c189b1ae3924659e7c8ce5fe"}],"nova/api/openstack/placement/objects/resource_provider.py":[{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"cdc9caf6b574b987446ff62e51a3b8b3d8b45c99","unresolved":false,"context_lines":[{"line_number":1085,"context_line":"    #   ) AS usage"},{"line_number":1086,"context_line":"    #     ON rp.id \u003d usage.resource_provider_id"},{"line_number":1087,"context_line":"    # WHERE COALESCE(usage.used, 0) + $amount \u003c\u003d ("},{"line_number":1088,"context_line":"    #   inv.total + inv.reserved) * inv.allocation_ratio"},{"line_number":1089,"context_line":"    # ) AND"},{"line_number":1090,"context_line":"    #   inv.min_unit \u003c\u003d $amount AND"},{"line_number":1091,"context_line":"    #   inv.max_unit \u003e\u003d $amount AND"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_fd0706c9","line":1088,"range":{"start_line":1088,"start_character":18,"end_line":1088,"end_character":19},"updated":"2018-04-03 10:52:16.000000000","message":"-","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"1d42864403aefe4aa311e74daf58e010bae5cf31","unresolved":false,"context_lines":[{"line_number":1085,"context_line":"    #   ) AS usage"},{"line_number":1086,"context_line":"    #     ON rp.id \u003d usage.resource_provider_id"},{"line_number":1087,"context_line":"    # WHERE COALESCE(usage.used, 0) + $amount \u003c\u003d ("},{"line_number":1088,"context_line":"    #   inv.total + inv.reserved) * inv.allocation_ratio"},{"line_number":1089,"context_line":"    # ) AND"},{"line_number":1090,"context_line":"    #   inv.min_unit \u003c\u003d $amount AND"},{"line_number":1091,"context_line":"    #   inv.max_unit \u003e\u003d $amount AND"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_4997263c","line":1088,"range":{"start_line":1088,"start_character":18,"end_line":1088,"end_character":19},"in_reply_to":"bf659307_fd0706c9","updated":"2018-04-05 04:39:02.000000000","message":"Done","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"88da31f09b392e1d0d650856f7ec55c6662c6d1a","unresolved":false,"context_lines":[{"line_number":1265,"context_line":"    #   ("},{"line_number":1266,"context_line":"    #     ("},{"line_number":1267,"context_line":"    #     COALESCE(usage_{RC_NAME}.used, 0) + $AMOUNT_{RC_NAME} \u003c\u003d"},{"line_number":1268,"context_line":"    #       (inv_{RC_NAME}.total + inv_{RC_NAME}.reserved)"},{"line_number":1269,"context_line":"    #       * inv_{RC_NAME}.allocation_ratio"},{"line_number":1270,"context_line":"    #     ) AND"},{"line_number":1271,"context_line":"    #     inv_{RC_NAME}.min_unit \u003c\u003d $AMOUNT_{RC_NAME}"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_9fcda286","line":1268,"range":{"start_line":1268,"start_character":33,"end_line":1268,"end_character":34},"updated":"2018-04-03 09:39:07.000000000","message":"\u0027-\u0027, oops","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"1d42864403aefe4aa311e74daf58e010bae5cf31","unresolved":false,"context_lines":[{"line_number":1265,"context_line":"    #   ("},{"line_number":1266,"context_line":"    #     ("},{"line_number":1267,"context_line":"    #     COALESCE(usage_{RC_NAME}.used, 0) + $AMOUNT_{RC_NAME} \u003c\u003d"},{"line_number":1268,"context_line":"    #       (inv_{RC_NAME}.total + inv_{RC_NAME}.reserved)"},{"line_number":1269,"context_line":"    #       * inv_{RC_NAME}.allocation_ratio"},{"line_number":1270,"context_line":"    #     ) AND"},{"line_number":1271,"context_line":"    #     inv_{RC_NAME}.min_unit \u003c\u003d $AMOUNT_{RC_NAME}"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_e9a71aa7","line":1268,"range":{"start_line":1268,"start_character":33,"end_line":1268,"end_character":34},"in_reply_to":"bf659307_9fcda286","updated":"2018-04-05 04:39:02.000000000","message":"Done. oops.","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"88da31f09b392e1d0d650856f7ec55c6662c6d1a","unresolved":false,"context_lines":[{"line_number":1271,"context_line":"    #     inv_{RC_NAME}.min_unit \u003c\u003d $AMOUNT_{RC_NAME}"},{"line_number":1272,"context_line":"    #     inv_{RC_NAME}.max_unit \u003e\u003d $AMOUNT_{RC_NAME}"},{"line_number":1273,"context_line":"    #     $AMOUNT_{RC_NAME} % inv_{RC_NAME}.step_size \u003d\u003d 0"},{"line_number":1274,"context_line":"    #   ) OR"},{"line_number":1275,"context_line":"    #   nested_{RC_NAME}.resource_provider_id IS NOT NULL"},{"line_number":1276,"context_line":"    # )"},{"line_number":1277,"context_line":"    #"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_1fe3d2da","line":1274,"range":{"start_line":1274,"start_character":0,"end_line":1274,"end_character":4},"updated":"2018-04-03 09:39:07.000000000","message":"And other condition on @1470?","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"1d42864403aefe4aa311e74daf58e010bae5cf31","unresolved":false,"context_lines":[{"line_number":1271,"context_line":"    #     inv_{RC_NAME}.min_unit \u003c\u003d $AMOUNT_{RC_NAME}"},{"line_number":1272,"context_line":"    #     inv_{RC_NAME}.max_unit \u003e\u003d $AMOUNT_{RC_NAME}"},{"line_number":1273,"context_line":"    #     $AMOUNT_{RC_NAME} % inv_{RC_NAME}.step_size \u003d\u003d 0"},{"line_number":1274,"context_line":"    #   ) OR"},{"line_number":1275,"context_line":"    #   nested_{RC_NAME}.resource_provider_id IS NOT NULL"},{"line_number":1276,"context_line":"    # )"},{"line_number":1277,"context_line":"    #"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_a9e042ce","line":1274,"range":{"start_line":1274,"start_character":0,"end_line":1274,"end_character":4},"in_reply_to":"bf659307_1fe3d2da","updated":"2018-04-05 04:39:02.000000000","message":"This is where the condition on @1470 is written;\n\ni.e. the translation of \n\n    cond \u003d sa.or_(\n       sa.and_(\n           it.c.resource_provider_id !\u003d sa.null(),\n           usage_cond,\n        ),\n        nested.c.id !\u003d sa.null())","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"88da31f09b392e1d0d650856f7ec55c6662c6d1a","unresolved":false,"context_lines":[{"line_number":1405,"context_line":"    sharing_tables \u003d {"},{"line_number":1406,"context_line":"        rc_id: sa.alias(_RP_AGG_TBL, name\u003d\u0027sharing_%s\u0027 % name_map[rc_id])"},{"line_number":1407,"context_line":"        for rc_id in resources"},{"line_number":1408,"context_line":"        if len(sharing_and_nested_providers[rc_id][0]) \u003e 0"},{"line_number":1409,"context_line":"    }"},{"line_number":1410,"context_line":""},{"line_number":1411,"context_line":"    # Dict, keyed by resource class ID, of an aliased table of"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_1f31925a","line":1408,"range":{"start_line":1408,"start_character":51,"end_line":1408,"end_character":52},"updated":"2018-04-03 09:39:07.000000000","message":"Just a suggestion, maybe we can use something like\nSHARING, NESTED instead of 0 or 1 for readable.","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"1d42864403aefe4aa311e74daf58e010bae5cf31","unresolved":false,"context_lines":[{"line_number":1405,"context_line":"    sharing_tables \u003d {"},{"line_number":1406,"context_line":"        rc_id: sa.alias(_RP_AGG_TBL, name\u003d\u0027sharing_%s\u0027 % name_map[rc_id])"},{"line_number":1407,"context_line":"        for rc_id in resources"},{"line_number":1408,"context_line":"        if len(sharing_and_nested_providers[rc_id][0]) \u003e 0"},{"line_number":1409,"context_line":"    }"},{"line_number":1410,"context_line":""},{"line_number":1411,"context_line":"    # Dict, keyed by resource class ID, of an aliased table of"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_09cfee57","line":1408,"range":{"start_line":1408,"start_character":51,"end_line":1408,"end_character":52},"in_reply_to":"bf659307_1f31925a","updated":"2018-04-05 04:39:02.000000000","message":"That\u0027s just a suggestion, but a great suggestion. Agreed with this is terrible. I refactored it.","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"6f8a1ed2bdd8612c83df3fd7b9b7e49d5280b69f","unresolved":false,"context_lines":[{"line_number":1142,"context_line":"@db_api.api_context_manager.reader"},{"line_number":1143,"context_line":"def _get_all_with_shared(ctx, resources, member_of\u003dNone):"},{"line_number":1144,"context_line":"    \"\"\"Uses some more advanced SQL to find providers that either have the"},{"line_number":1145,"context_line":"    requested resources \"locally\" or \"for his child resource provider\" or"},{"line_number":1146,"context_line":"    are associated with a provider that shares those requested resources."},{"line_number":1147,"context_line":""},{"line_number":1148,"context_line":"    :param resources: Dict keyed by resource class integer ID of requested"}],"source_content_type":"text/x-python","patch_set":11,"id":"9f6a8fd7_5823cbbd","line":1145,"range":{"start_line":1145,"start_character":34,"end_line":1145,"end_character":51},"updated":"2018-04-23 12:52:40.000000000","message":"\"or in a child\" might make more sense","commit_id":"a74e9b361457f0598a417779d3ca586174ecfc8d"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"d3c8996f3f7d91c1e038592738b24810833170fe","unresolved":false,"context_lines":[{"line_number":1142,"context_line":"@db_api.api_context_manager.reader"},{"line_number":1143,"context_line":"def _get_all_with_shared(ctx, resources, member_of\u003dNone):"},{"line_number":1144,"context_line":"    \"\"\"Uses some more advanced SQL to find providers that either have the"},{"line_number":1145,"context_line":"    requested resources \"locally\" or \"for his child resource provider\" or"},{"line_number":1146,"context_line":"    are associated with a provider that shares those requested resources."},{"line_number":1147,"context_line":""},{"line_number":1148,"context_line":"    :param resources: Dict keyed by resource class integer ID of requested"}],"source_content_type":"text/x-python","patch_set":11,"id":"9f6a8fd7_51ad4a99","line":1145,"range":{"start_line":1145,"start_character":34,"end_line":1145,"end_character":51},"in_reply_to":"9f6a8fd7_5823cbbd","updated":"2018-05-01 12:22:55.000000000","message":"Done","commit_id":"a74e9b361457f0598a417779d3ca586174ecfc8d"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db820c583ddf80c487c3e7baff3cde705c04ecf6","unresolved":false,"context_lines":[{"line_number":1066,"context_line":""},{"line_number":1067,"context_line":""},{"line_number":1068,"context_line":"@db_api.api_context_manager.reader"},{"line_number":1069,"context_line":"def _get_providers_with_nested_capacity(ctx, rc_id, amount, root_ids\u003dNone):"},{"line_number":1070,"context_line":"    \"\"\"Returns a list of nested resource provider internal IDs, which"},{"line_number":1071,"context_line":"    has capacity for a requested amount. If root_ids are provided,"},{"line_number":1072,"context_line":"    return values are filtered to be only descendents of the providers with"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_0988fec3","line":1069,"range":{"start_line":1069,"start_character":4,"end_line":1069,"end_character":39},"updated":"2018-05-01 22:07:08.000000000","message":"This might be better named\n\n _get_nested_providers_with_capacity","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"4b7fc840d63a84dfb35f36a24c553c783ef6f381","unresolved":false,"context_lines":[{"line_number":1066,"context_line":""},{"line_number":1067,"context_line":""},{"line_number":1068,"context_line":"@db_api.api_context_manager.reader"},{"line_number":1069,"context_line":"def _get_providers_with_nested_capacity(ctx, rc_id, amount, root_ids\u003dNone):"},{"line_number":1070,"context_line":"    \"\"\"Returns a list of nested resource provider internal IDs, which"},{"line_number":1071,"context_line":"    has capacity for a requested amount. If root_ids are provided,"},{"line_number":1072,"context_line":"    return values are filtered to be only descendents of the providers with"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_3b8f4324","line":1069,"range":{"start_line":1069,"start_character":4,"end_line":1069,"end_character":39},"in_reply_to":"9f6a8fd7_0988fec3","updated":"2018-05-02 05:25:17.000000000","message":"I wanted it to be in the same terminology with the existing function, \n\n   _get_providers_with_shared_capacity\n\n...so, this existing function can be also renamed, but I\u0027m sure that that should be done in a separate patch.","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"04f05e4b622f1377901d0b7179940825037efe18","unresolved":false,"context_lines":[{"line_number":1066,"context_line":""},{"line_number":1067,"context_line":""},{"line_number":1068,"context_line":"@db_api.api_context_manager.reader"},{"line_number":1069,"context_line":"def _get_providers_with_nested_capacity(ctx, rc_id, amount, root_ids\u003dNone):"},{"line_number":1070,"context_line":"    \"\"\"Returns a list of nested resource provider internal IDs, which"},{"line_number":1071,"context_line":"    has capacity for a requested amount. If root_ids are provided,"},{"line_number":1072,"context_line":"    return values are filtered to be only descendents of the providers with"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_3dd64e29","line":1069,"range":{"start_line":1069,"start_character":4,"end_line":1069,"end_character":39},"in_reply_to":"9f6a8fd7_3b8f4324","updated":"2018-05-02 13:38:23.000000000","message":"Well, \"get providers with shared capacity\" is accurate because the *capacity* is shared.  Likewise \"get nested providers with capacity\" is accurate because it\u0027s the *providers* that are nested.  I suppose the former could be called _get_sharing_providers_with_capacity.\n\nAnyway, I\u0027m not hung up on this.","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"5356dec20f1024487457b9676822a9fe0bf920d1","unresolved":false,"context_lines":[{"line_number":1066,"context_line":""},{"line_number":1067,"context_line":""},{"line_number":1068,"context_line":"@db_api.api_context_manager.reader"},{"line_number":1069,"context_line":"def _get_providers_with_nested_capacity(ctx, rc_id, amount, root_ids\u003dNone):"},{"line_number":1070,"context_line":"    \"\"\"Returns a list of nested resource provider internal IDs, which"},{"line_number":1071,"context_line":"    has capacity for a requested amount. If root_ids are provided,"},{"line_number":1072,"context_line":"    return values are filtered to be only descendents of the providers with"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_2fd0b5c9","line":1069,"range":{"start_line":1069,"start_character":4,"end_line":1069,"end_character":39},"in_reply_to":"9f6a8fd7_3dd64e29","updated":"2018-05-03 08:12:15.000000000","message":"Ah, I got it. I\u0027ve renamed the new function.","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db820c583ddf80c487c3e7baff3cde705c04ecf6","unresolved":false,"context_lines":[{"line_number":1067,"context_line":""},{"line_number":1068,"context_line":"@db_api.api_context_manager.reader"},{"line_number":1069,"context_line":"def _get_providers_with_nested_capacity(ctx, rc_id, amount, root_ids\u003dNone):"},{"line_number":1070,"context_line":"    \"\"\"Returns a list of nested resource provider internal IDs, which"},{"line_number":1071,"context_line":"    has capacity for a requested amount. If root_ids are provided,"},{"line_number":1072,"context_line":"    return values are filtered to be only descendents of the providers with"},{"line_number":1073,"context_line":"    the root_ids. Note that the list excludes root providers."}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_c991a6f3","line":1070,"range":{"start_line":1070,"start_character":64,"end_line":1070,"end_character":69},"updated":"2018-05-01 22:07:08.000000000","message":"each of which","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"4b7fc840d63a84dfb35f36a24c553c783ef6f381","unresolved":false,"context_lines":[{"line_number":1067,"context_line":""},{"line_number":1068,"context_line":"@db_api.api_context_manager.reader"},{"line_number":1069,"context_line":"def _get_providers_with_nested_capacity(ctx, rc_id, amount, root_ids\u003dNone):"},{"line_number":1070,"context_line":"    \"\"\"Returns a list of nested resource provider internal IDs, which"},{"line_number":1071,"context_line":"    has capacity for a requested amount. If root_ids are provided,"},{"line_number":1072,"context_line":"    return values are filtered to be only descendents of the providers with"},{"line_number":1073,"context_line":"    the root_ids. Note that the list excludes root providers."}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_db9de757","line":1070,"range":{"start_line":1070,"start_character":64,"end_line":1070,"end_character":69},"in_reply_to":"9f6a8fd7_c991a6f3","updated":"2018-05-02 05:25:17.000000000","message":"Done","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db820c583ddf80c487c3e7baff3cde705c04ecf6","unresolved":false,"context_lines":[{"line_number":1070,"context_line":"    \"\"\"Returns a list of nested resource provider internal IDs, which"},{"line_number":1071,"context_line":"    has capacity for a requested amount. If root_ids are provided,"},{"line_number":1072,"context_line":"    return values are filtered to be only descendents of the providers with"},{"line_number":1073,"context_line":"    the root_ids. Note that the list excludes root providers."},{"line_number":1074,"context_line":"    \"\"\""},{"line_number":1075,"context_line":"    # The SQL we need to generate here looks like this:"},{"line_number":1076,"context_line":"    #"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_a9c0f2e1","line":1073,"range":{"start_line":1073,"start_character":18,"end_line":1073,"end_character":61},"updated":"2018-05-01 22:07:08.000000000","message":"This feels pretty weird, not having gotten through the rest of the patch yet.  I\u0027m assuming we\u0027re doing this because there\u0027s a different method that gets only the root providers with capacity, and somebody\u0027s going to call both of those (and the one that looks for sharing providers with capacity) and combine the results.","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"4b7fc840d63a84dfb35f36a24c553c783ef6f381","unresolved":false,"context_lines":[{"line_number":1070,"context_line":"    \"\"\"Returns a list of nested resource provider internal IDs, which"},{"line_number":1071,"context_line":"    has capacity for a requested amount. If root_ids are provided,"},{"line_number":1072,"context_line":"    return values are filtered to be only descendents of the providers with"},{"line_number":1073,"context_line":"    the root_ids. Note that the list excludes root providers."},{"line_number":1074,"context_line":"    \"\"\""},{"line_number":1075,"context_line":"    # The SQL we need to generate here looks like this:"},{"line_number":1076,"context_line":"    #"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_bbd033f9","line":1073,"range":{"start_line":1073,"start_character":18,"end_line":1073,"end_character":61},"in_reply_to":"9f6a8fd7_a9c0f2e1","updated":"2018-05-02 05:25:17.000000000","message":"You are right in assuming that. Thanks to this feature 1) we can have a shortcut path for the cases where there is no nested provider in the environment, 2) and we can avoid combining a root provider and the root provider itself. This is similar to that we have currently excluded \"MISC_SHARES_VIA_AGGREGATE\" non-tagged providers (i.e. non-sharing providers) in _get_providers_with_shared_capacity function.\n\nAdded some more notes.","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db820c583ddf80c487c3e7baff3cde705c04ecf6","unresolved":false,"context_lines":[{"line_number":1139,"context_line":"    sel \u003d sel.where(cond)"},{"line_number":1140,"context_line":"    sel \u003d sel.group_by(rp_tbl.c.id)"},{"line_number":1141,"context_line":"    return [r[0] for r in ctx.session.execute(sel)]"},{"line_number":1142,"context_line":""},{"line_number":1143,"context_line":""},{"line_number":1144,"context_line":"@db_api.api_context_manager.reader"},{"line_number":1145,"context_line":"def _get_all_with_nested_and_shared(ctx, resources, member_of\u003dNone):"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_49b7d687","line":1142,"updated":"2018-05-01 22:07:08.000000000","message":"Yet another method with a large amount of duplicated logic.  At some point we should DRY up this file.","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"4b7fc840d63a84dfb35f36a24c553c783ef6f381","unresolved":false,"context_lines":[{"line_number":1139,"context_line":"    sel \u003d sel.where(cond)"},{"line_number":1140,"context_line":"    sel \u003d sel.group_by(rp_tbl.c.id)"},{"line_number":1141,"context_line":"    return [r[0] for r in ctx.session.execute(sel)]"},{"line_number":1142,"context_line":""},{"line_number":1143,"context_line":""},{"line_number":1144,"context_line":"@db_api.api_context_manager.reader"},{"line_number":1145,"context_line":"def _get_all_with_nested_and_shared(ctx, resources, member_of\u003dNone):"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_5b7c77ea","line":1142,"in_reply_to":"9f6a8fd7_49b7d687","updated":"2018-05-02 05:25:17.000000000","message":"Indeed!","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db820c583ddf80c487c3e7baff3cde705c04ecf6","unresolved":false,"context_lines":[{"line_number":1150,"context_line":"    :param resources: Dict keyed by resource class integer ID of requested"},{"line_number":1151,"context_line":"                      amounts of that resource"},{"line_number":1152,"context_line":"    :param member_of: List of aggregate UUID"},{"line_number":1153,"context_line":"    \"\"\""},{"line_number":1154,"context_line":"    # NOTE(jaypipes): The SQL we generate here depends on which resource"},{"line_number":1155,"context_line":"    # classes have providers that share that resource via an aggregate."},{"line_number":1156,"context_line":"    #"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_c4d98d22","line":1153,"updated":"2018-05-01 22:07:08.000000000","message":"I really want a :return: doc here.  It looks like this is returning ResourceProvider objects for only the *root* providers.\n\n(Which seems like a shame.  We\u0027ve done all this work to identify the nested \u0026 sharing providers involved in the request, and we just throw them away, what, so we have to go rediscover them later?)","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"4b7fc840d63a84dfb35f36a24c553c783ef6f381","unresolved":false,"context_lines":[{"line_number":1150,"context_line":"    :param resources: Dict keyed by resource class integer ID of requested"},{"line_number":1151,"context_line":"                      amounts of that resource"},{"line_number":1152,"context_line":"    :param member_of: List of aggregate UUID"},{"line_number":1153,"context_line":"    \"\"\""},{"line_number":1154,"context_line":"    # NOTE(jaypipes): The SQL we generate here depends on which resource"},{"line_number":1155,"context_line":"    # classes have providers that share that resource via an aggregate."},{"line_number":1156,"context_line":"    #"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_c1ae5ae6","line":1153,"in_reply_to":"9f6a8fd7_c4d98d22","updated":"2018-05-02 05:25:17.000000000","message":"Added a :returns: doc and added more notes that we don\u0027t lay down any limitation to get root or non-sharing providers. We expect this function to return nested providers and shared providers as well.\n\n\u003e we have to go rediscover them later?\n\nHmm, yes, because the way we join tables is different depending on whether there is nested/shared provider for each resource class requested. We can\u0027t predict for which resource class we should take nested or shared.\nI\u0027m not saying that\u0027s impossible. A possible way coming up to my mind is to change select columns accordingly with if/else conditions, but that means the callers should also be aware of that flexibility and change behavior depending on how many columns they get, which sounds to me resulting in more complex codes...","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db820c583ddf80c487c3e7baff3cde705c04ecf6","unresolved":false,"context_lines":[{"line_number":1484,"context_line":"            amount % it.c.step_size \u003d\u003d 0)"},{"line_number":1485,"context_line":"        if not (nrp or sps):"},{"line_number":1486,"context_line":"            where_conds.append(usage_cond)"},{"line_number":1487,"context_line":"        elif nrp:"},{"line_number":1488,"context_line":"            nested \u003d nested_tables[rc_id]"},{"line_number":1489,"context_line":"            cond \u003d sa.or_("},{"line_number":1490,"context_line":"                sa.and_("}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_c9aa0618","line":1487,"range":{"start_line":1487,"start_character":8,"end_line":1487,"end_character":17},"updated":"2018-05-01 22:07:08.000000000","message":"Looks like this doesn\u0027t account for when there\u0027s sharing *and* nested.  The logic should be more like:\n\n if not nrp or sps:\n     where_conds.append(usage_cond)\n else:\n     if nrp:\n         ...\n     if sps:\n         ...\n\nkind of thing.\n\n[Later] But I would have expected your test case to fail.  Clearly I don\u0027t understand how this is working.","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"04f05e4b622f1377901d0b7179940825037efe18","unresolved":false,"context_lines":[{"line_number":1484,"context_line":"            amount % it.c.step_size \u003d\u003d 0)"},{"line_number":1485,"context_line":"        if not (nrp or sps):"},{"line_number":1486,"context_line":"            where_conds.append(usage_cond)"},{"line_number":1487,"context_line":"        elif nrp:"},{"line_number":1488,"context_line":"            nested \u003d nested_tables[rc_id]"},{"line_number":1489,"context_line":"            cond \u003d sa.or_("},{"line_number":1490,"context_line":"                sa.and_("}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_fdb8d6e5","line":1487,"range":{"start_line":1487,"start_character":8,"end_line":1487,"end_character":17},"in_reply_to":"9f6a8fd7_41e9ea17","updated":"2018-05-02 13:38:23.000000000","message":"\u003e But you are right in the point that this can produce a bug that\n \u003e \"allocation candidates ignore shared providers if there is the same\n \u003e resource class on the nested providers.\"\n\nAh, that\u0027s what I was looking for, thanks.  So we should add a test case for that.","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"4b7fc840d63a84dfb35f36a24c553c783ef6f381","unresolved":false,"context_lines":[{"line_number":1484,"context_line":"            amount % it.c.step_size \u003d\u003d 0)"},{"line_number":1485,"context_line":"        if not (nrp or sps):"},{"line_number":1486,"context_line":"            where_conds.append(usage_cond)"},{"line_number":1487,"context_line":"        elif nrp:"},{"line_number":1488,"context_line":"            nested \u003d nested_tables[rc_id]"},{"line_number":1489,"context_line":"            cond \u003d sa.or_("},{"line_number":1490,"context_line":"                sa.and_("}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_41e9ea17","line":1487,"range":{"start_line":1487,"start_character":8,"end_line":1487,"end_character":17},"in_reply_to":"9f6a8fd7_c9aa0618","updated":"2018-05-02 05:25:17.000000000","message":"\u003e [Later] But I would have expected your test case to fail.  Clearly I don\u0027t understand how this is working.\n\nI _guess_ you are just missing one fact that this condition is evaluated for each resource class. (This is in the clause of \"for rc_id in resources\" @L1456)\n\nBut you are right in the point that this can produce a bug that \"allocation candidates ignore shared providers if there is the same resource class on the nested providers.\" so let me take your logic :)\n\nUpdated.","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"5356dec20f1024487457b9676822a9fe0bf920d1","unresolved":false,"context_lines":[{"line_number":1484,"context_line":"            amount % it.c.step_size \u003d\u003d 0)"},{"line_number":1485,"context_line":"        if not (nrp or sps):"},{"line_number":1486,"context_line":"            where_conds.append(usage_cond)"},{"line_number":1487,"context_line":"        elif nrp:"},{"line_number":1488,"context_line":"            nested \u003d nested_tables[rc_id]"},{"line_number":1489,"context_line":"            cond \u003d sa.or_("},{"line_number":1490,"context_line":"                sa.and_("}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_efd95df4","line":1487,"range":{"start_line":1487,"start_character":8,"end_line":1487,"end_character":17},"in_reply_to":"9f6a8fd7_fdb8d6e5","updated":"2018-05-03 08:12:15.000000000","message":"Done","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db820c583ddf80c487c3e7baff3cde705c04ecf6","unresolved":false,"context_lines":[{"line_number":1700,"context_line":"        #        total - reserved) * inv.allocation_ratio) AND"},{"line_number":1701,"context_line":"        #        inv.min_unit \u003c\u003d $AMOUNT_Z AND inv.max_unit \u003e\u003d $AMOUNT_Z AND"},{"line_number":1702,"context_line":"        #        $AMOUNT_Z % inv.step_size \u003d\u003d 0))"},{"line_number":1703,"context_line":"        # GROUP BY rp.id"},{"line_number":1704,"context_line":"        # HAVING"},{"line_number":1705,"context_line":"        #  COUNT(DISTINCT(inv.resource_class_id)) \u003d\u003d len($RESOURCE_CLASSES)"},{"line_number":1706,"context_line":"        #"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_894bae85","line":1703,"updated":"2018-05-01 22:07:08.000000000","message":"and root \u0026 parent UUIDs?\n\n(sorry, that\u0027s a fix from another patch)","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"4b7fc840d63a84dfb35f36a24c553c783ef6f381","unresolved":false,"context_lines":[{"line_number":1700,"context_line":"        #        total - reserved) * inv.allocation_ratio) AND"},{"line_number":1701,"context_line":"        #        inv.min_unit \u003c\u003d $AMOUNT_Z AND inv.max_unit \u003e\u003d $AMOUNT_Z AND"},{"line_number":1702,"context_line":"        #        $AMOUNT_Z % inv.step_size \u003d\u003d 0))"},{"line_number":1703,"context_line":"        # GROUP BY rp.id"},{"line_number":1704,"context_line":"        # HAVING"},{"line_number":1705,"context_line":"        #  COUNT(DISTINCT(inv.resource_class_id)) \u003d\u003d len($RESOURCE_CLASSES)"},{"line_number":1706,"context_line":"        #"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_81bf02fa","line":1703,"in_reply_to":"9f6a8fd7_894bae85","updated":"2018-05-02 05:25:17.000000000","message":"Are you talking about the fix about PostgreSQL? That\u0027s not ported to this function yet, so forgive me to leave the comment as it is in this patch...","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"34062342f0affeaa489749161060b5e5ce34e3a3","unresolved":false,"context_lines":[{"line_number":1257,"context_line":"                   inv_tbl.c.min_unit \u003c\u003d amount,"},{"line_number":1258,"context_line":"                   inv_tbl.c.max_unit \u003e\u003d amount,"},{"line_number":1259,"context_line":"                   amount % inv_tbl.c.step_size \u003d\u003d 0)"},{"line_number":1260,"context_line":"    # Exclude root providers"},{"line_number":1261,"context_line":"    cond \u003d sa.and_(rp_tbl.c.root_provider_id !\u003d sa.null(),"},{"line_number":1262,"context_line":"                   rp_tbl.c.id !\u003d rp_tbl.c.root_provider_id,"},{"line_number":1263,"context_line":"                   cond)"},{"line_number":1264,"context_line":"    # Filter return values to be only descendents of the root_ids"},{"line_number":1265,"context_line":"    if root_ids:"},{"line_number":1266,"context_line":"        cond \u003d sa.and_(rp_tbl.c.root_provider_id.in_(root_ids), cond)"}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_6977563c","line":1263,"range":{"start_line":1260,"start_character":0,"end_line":1263,"end_character":24},"updated":"2018-05-07 14:42:01.000000000","message":"I\u0027m not sure why you are filtering out root providers here?","commit_id":"3913475476be7554c189b1ae3924659e7c8ce5fe"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"0522e52c12f0393f0c719a3bdfde5eb58b3776fc","unresolved":false,"context_lines":[{"line_number":1257,"context_line":"                   inv_tbl.c.min_unit \u003c\u003d amount,"},{"line_number":1258,"context_line":"                   inv_tbl.c.max_unit \u003e\u003d amount,"},{"line_number":1259,"context_line":"                   amount % inv_tbl.c.step_size \u003d\u003d 0)"},{"line_number":1260,"context_line":"    # Exclude root providers"},{"line_number":1261,"context_line":"    cond \u003d sa.and_(rp_tbl.c.root_provider_id !\u003d sa.null(),"},{"line_number":1262,"context_line":"                   rp_tbl.c.id !\u003d rp_tbl.c.root_provider_id,"},{"line_number":1263,"context_line":"                   cond)"},{"line_number":1264,"context_line":"    # Filter return values to be only descendents of the root_ids"},{"line_number":1265,"context_line":"    if root_ids:"},{"line_number":1266,"context_line":"        cond \u003d sa.and_(rp_tbl.c.root_provider_id.in_(root_ids), cond)"}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_92877210","line":1263,"range":{"start_line":1260,"start_character":0,"end_line":1263,"end_character":24},"in_reply_to":"5f7c97a3_6977563c","updated":"2018-05-08 07:36:31.000000000","message":"Because I want to avoid combining a root provider and the root provider itself when building allocation candidates in the next patch. This is exactly the same logic with that we have currently excluded \"MISC_SHARES_VIA_AGGREGATE\" non-tagged providers (i.e. non-sharing providers) in _get_providers_with_shared_capacity function.","commit_id":"3913475476be7554c189b1ae3924659e7c8ce5fe"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"34062342f0affeaa489749161060b5e5ce34e3a3","unresolved":false,"context_lines":[{"line_number":1511,"context_line":"    nested_providers \u003d {"},{"line_number":1512,"context_line":"        rc_id: _get_nested_providers_with_capacity(ctx, rc_id, amount)"},{"line_number":1513,"context_line":"        for rc_id, amount in resources.items()"},{"line_number":1514,"context_line":"    }"},{"line_number":1515,"context_line":""},{"line_number":1516,"context_line":"    # Contains a list of sharing resource provider IDs for each resource class"},{"line_number":1517,"context_line":"    # requested"}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_694f56bd","line":1514,"updated":"2018-05-07 14:42:01.000000000","message":"I think you should use the _get_trees_matching_all() function:\n\nhttps://github.com/openstack/nova/blob/master/nova/api/openstack/placement/objects/resource_provider.py#L3164\n\nfor grabbing the provider trees (non-sharing-providers) that meet the required resource and traits constraints.\n\nand then merge the sharing providers with the provider trees in this function. The single SQL statement produced in this function is getting too much to deal with, IMHO (and yes, I\u0027m aware that I originally wrote it this way...).","commit_id":"3913475476be7554c189b1ae3924659e7c8ce5fe"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"0522e52c12f0393f0c719a3bdfde5eb58b3776fc","unresolved":false,"context_lines":[{"line_number":1511,"context_line":"    nested_providers \u003d {"},{"line_number":1512,"context_line":"        rc_id: _get_nested_providers_with_capacity(ctx, rc_id, amount)"},{"line_number":1513,"context_line":"        for rc_id, amount in resources.items()"},{"line_number":1514,"context_line":"    }"},{"line_number":1515,"context_line":""},{"line_number":1516,"context_line":"    # Contains a list of sharing resource provider IDs for each resource class"},{"line_number":1517,"context_line":"    # requested"}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_f280268e","line":1514,"in_reply_to":"5f7c97a3_694f56bd","updated":"2018-05-08 07:36:31.000000000","message":"Hmm, but as you wrote in [1], _get_trees_matching_all_function can be used only for cases where sharing providers are *not* present. This is because we can\u0027t abondon a tree with few resource or few traits without looking into sharing providers since a sharing provider can provide that.\n\n[1] https://github.com/openstack/nova/blob/master/nova/api/openstack/placement/objects/resource_provider.py#L3186-L3187\n\nOne possibility is adding sharing provider check in _get_trees_matching_all_function, but I left that function for non-sharing provider cases. Note that for non-sharing provider cases I use it, _get_trees_matching_all_function. That is done in the next next patch [2].\n\n[2] https://review.openstack.org/#/c/561842/7/nova/api/openstack/placement/objects/resource_provider.py\n\nIf you look into the patch [2], you will know that\n1) the _get_all_with_nested_and_shared I\u0027m writing here in this patch is only for cases where there are sharing providers in the environment.\n2) I\u0027m agreed with there can be too much nested providers to deal with, so before building allocation combinations of root-nested-sharing, I use a filter in _get_nested_providers_with_capacity that is prepared in this patch (the argument  of root_ids, which is not used here though in this patch but used in the next patch[3]) to get *only* children of \"root providers that _get_trees_matching_all_function (or _get_all_with_nested_and_shared if sharing rps exist) return.\"\n\n[3] https://review.openstack.org/#/c/556514/15/nova/api/openstack/placement/objects/resource_provider.py\n\nUpdated the commit message accordingly.","commit_id":"3913475476be7554c189b1ae3924659e7c8ce5fe"}],"nova/tests/functional/api/openstack/placement/db/test_resource_provider.py":[{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"88da31f09b392e1d0d650856f7ec55c6662c6d1a","unresolved":false,"context_lines":[{"line_number":2987,"context_line":"        pf2.parent_provider_uuid \u003d cn2_uuid"},{"line_number":2988,"context_line":"        pf2.create()"},{"line_number":2989,"context_line":""},{"line_number":2990,"context_line":"        # Give the child providers some inventory"},{"line_number":2991,"context_line":"        for (i, pf) in enumerate([cn1, pf1, cn2, pf2]):"},{"line_number":2992,"context_line":"            vf \u003d rp_obj.Inventory("},{"line_number":2993,"context_line":"                resource_provider\u003dpf,"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_a922b8b7","line":2990,"range":{"start_line":2990,"start_character":8,"end_line":2990,"end_character":49},"updated":"2018-04-03 09:39:07.000000000","message":"In your case:\ncn1 has 1 vf, pf1 has 2 vf;\ncn2 has 3 vf, pf2 has 4 vf\n\nJust a question for below block, the real world, the resource inventory(like, the vf count of pf) should be the part of parent inventory(like, the cn)?\n\nThat is, cn1 inventory should contains the vf count of his child pf1?\n\nI think the answer is No, right?\n\nThat is,\ncn1 has its own 1 vf, and pf1 has 2vf\ncn2 has its own 3 vf, and pf2 has 4vf\n\nIf so, I think maybe we could add some description on the model you build.","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"1d42864403aefe4aa311e74daf58e010bae5cf31","unresolved":false,"context_lines":[{"line_number":2987,"context_line":"        pf2.parent_provider_uuid \u003d cn2_uuid"},{"line_number":2988,"context_line":"        pf2.create()"},{"line_number":2989,"context_line":""},{"line_number":2990,"context_line":"        # Give the child providers some inventory"},{"line_number":2991,"context_line":"        for (i, pf) in enumerate([cn1, pf1, cn2, pf2]):"},{"line_number":2992,"context_line":"            vf \u003d rp_obj.Inventory("},{"line_number":2993,"context_line":"                resource_provider\u003dpf,"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_09e5ae0a","line":2990,"range":{"start_line":2990,"start_character":8,"end_line":2990,"end_character":49},"in_reply_to":"bf659307_a922b8b7","updated":"2018-04-05 04:39:02.000000000","message":"The answer is No, right. Added some words.","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"88da31f09b392e1d0d650856f7ec55c6662c6d1a","unresolved":false,"context_lines":[{"line_number":2988,"context_line":"        pf2.create()"},{"line_number":2989,"context_line":""},{"line_number":2990,"context_line":"        # Give the child providers some inventory"},{"line_number":2991,"context_line":"        for (i, pf) in enumerate([cn1, pf1, cn2, pf2]):"},{"line_number":2992,"context_line":"            vf \u003d rp_obj.Inventory("},{"line_number":2993,"context_line":"                resource_provider\u003dpf,"},{"line_number":2994,"context_line":"                resource_class\u003dfields.ResourceClass.SRIOV_NET_VF,"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_492d1ca6","line":2991,"range":{"start_line":2991,"start_character":16,"end_line":2991,"end_character":18},"updated":"2018-04-03 09:39:07.000000000","message":"maybe \"rp\"?","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"1d42864403aefe4aa311e74daf58e010bae5cf31","unresolved":false,"context_lines":[{"line_number":2988,"context_line":"        pf2.create()"},{"line_number":2989,"context_line":""},{"line_number":2990,"context_line":"        # Give the child providers some inventory"},{"line_number":2991,"context_line":"        for (i, pf) in enumerate([cn1, pf1, cn2, pf2]):"},{"line_number":2992,"context_line":"            vf \u003d rp_obj.Inventory("},{"line_number":2993,"context_line":"                resource_provider\u003dpf,"},{"line_number":2994,"context_line":"                resource_class\u003dfields.ResourceClass.SRIOV_NET_VF,"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_69e0eafb","line":2991,"range":{"start_line":2991,"start_character":16,"end_line":2991,"end_character":18},"in_reply_to":"bf659307_492d1ca6","updated":"2018-04-05 04:39:02.000000000","message":"Done","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"88da31f09b392e1d0d650856f7ec55c6662c6d1a","unresolved":false,"context_lines":[{"line_number":3007,"context_line":"            fields.ResourceClass.STANDARD.index("},{"line_number":3008,"context_line":"                fields.ResourceClass.SRIOV_NET_VF),"},{"line_number":3009,"context_line":"            3)"},{"line_number":3010,"context_line":"        self.assertEqual([(pf2.id, cn2.id)], got_ids)"},{"line_number":3011,"context_line":""},{"line_number":3012,"context_line":"    def test_get_all_with_shared(self):"},{"line_number":3013,"context_line":"        # The aggregate that will be associated to everything..."}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_cc393af2","line":3010,"range":{"start_line":3010,"start_character":45,"end_line":3010,"end_character":52},"updated":"2018-04-03 09:39:07.000000000","message":"+1, Here is our expected tuple because pf2 is our wanted. even the cn2 has 3 vf, but its root id is itself.\n\nand seems we need a case to cover root id \u003d\u003d None?","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"1d42864403aefe4aa311e74daf58e010bae5cf31","unresolved":false,"context_lines":[{"line_number":3007,"context_line":"            fields.ResourceClass.STANDARD.index("},{"line_number":3008,"context_line":"                fields.ResourceClass.SRIOV_NET_VF),"},{"line_number":3009,"context_line":"            3)"},{"line_number":3010,"context_line":"        self.assertEqual([(pf2.id, cn2.id)], got_ids)"},{"line_number":3011,"context_line":""},{"line_number":3012,"context_line":"    def test_get_all_with_shared(self):"},{"line_number":3013,"context_line":"        # The aggregate that will be associated to everything..."}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_e9163af2","line":3010,"range":{"start_line":3010,"start_character":45,"end_line":3010,"end_character":52},"in_reply_to":"bf659307_cc393af2","updated":"2018-04-05 04:39:02.000000000","message":"Sure. Done.","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"88da31f09b392e1d0d650856f7ec55c6662c6d1a","unresolved":false,"context_lines":[{"line_number":3073,"context_line":"        pf2.create()"},{"line_number":3074,"context_line":""},{"line_number":3075,"context_line":"        # Give the child providers some inventory"},{"line_number":3076,"context_line":"        for pf in [pf1, pf2]:"},{"line_number":3077,"context_line":"            vf \u003d rp_obj.Inventory("},{"line_number":3078,"context_line":"                resource_provider\u003dpf,"},{"line_number":3079,"context_line":"                resource_class\u003dfields.ResourceClass.SRIOV_NET_VF,"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_5f5dca12","line":3076,"range":{"start_line":3076,"start_character":18,"end_line":3076,"end_character":29},"updated":"2018-04-03 09:39:07.000000000","message":"super tiny nit, (pf1, pf2) is better","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"1d42864403aefe4aa311e74daf58e010bae5cf31","unresolved":false,"context_lines":[{"line_number":3073,"context_line":"        pf2.create()"},{"line_number":3074,"context_line":""},{"line_number":3075,"context_line":"        # Give the child providers some inventory"},{"line_number":3076,"context_line":"        for pf in [pf1, pf2]:"},{"line_number":3077,"context_line":"            vf \u003d rp_obj.Inventory("},{"line_number":3078,"context_line":"                resource_provider\u003dpf,"},{"line_number":3079,"context_line":"                resource_class\u003dfields.ResourceClass.SRIOV_NET_VF,"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_89d1be32","line":3076,"range":{"start_line":3076,"start_character":18,"end_line":3076,"end_character":29},"in_reply_to":"bf659307_5f5dca12","updated":"2018-04-05 04:39:02.000000000","message":"Yup, I like it too. Done.","commit_id":"aa0095b3ec2b9d353e378186b2b6a0079c452a8c"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db820c583ddf80c487c3e7baff3cde705c04ecf6","unresolved":false,"context_lines":[{"line_number":3085,"context_line":"        STANDARDS \u003d fields.ResourceClass.STANDARD"},{"line_number":3086,"context_line":"        VCPU_ID \u003d STANDARDS.index(fields.ResourceClass.VCPU)"},{"line_number":3087,"context_line":"        DISK_GB_ID \u003d STANDARDS.index(fields.ResourceClass.DISK_GB)"},{"line_number":3088,"context_line":"        SRIOV_NET_VF \u003d STANDARDS.index(fields.ResourceClass.SRIOV_NET_VF)"},{"line_number":3089,"context_line":"        # The resources we will request"},{"line_number":3090,"context_line":"        resources \u003d {"},{"line_number":3091,"context_line":"            VCPU_ID: 1,"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_090d5e3d","line":3088,"range":{"start_line":3088,"start_character":8,"end_line":3088,"end_character":20},"updated":"2018-05-01 22:07:08.000000000","message":"naming consistency (_ID)","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db820c583ddf80c487c3e7baff3cde705c04ecf6","unresolved":false,"context_lines":[{"line_number":3097,"context_line":"    def test_nested_provider_capacity(self):"},{"line_number":3098,"context_line":"        \"\"\"Sets up a resource provider that has SRIOV_NET_VF inventory"},{"line_number":3099,"context_line":"        for his child resource provider and ensures the"},{"line_number":3100,"context_line":"        _get_providers_nested_capacity() function finds that child"},{"line_number":3101,"context_line":"        providers and not root providers."},{"line_number":3102,"context_line":"        \"\"\""},{"line_number":3103,"context_line":"        # Create the two \"local disk\" compute node providers"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_2908622b","line":3100,"range":{"start_line":3100,"start_character":8,"end_line":3100,"end_character":38},"updated":"2018-05-01 22:07:08.000000000","message":"_get_providers_with_nested_capacity (or whatever you rename it to)","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"db820c583ddf80c487c3e7baff3cde705c04ecf6","unresolved":false,"context_lines":[{"line_number":3097,"context_line":"    def test_nested_provider_capacity(self):"},{"line_number":3098,"context_line":"        \"\"\"Sets up a resource provider that has SRIOV_NET_VF inventory"},{"line_number":3099,"context_line":"        for his child resource provider and ensures the"},{"line_number":3100,"context_line":"        _get_providers_nested_capacity() function finds that child"},{"line_number":3101,"context_line":"        providers and not root providers."},{"line_number":3102,"context_line":"        \"\"\""},{"line_number":3103,"context_line":"        # Create the two \"local disk\" compute node providers"}],"source_content_type":"text/x-python","patch_set":12,"id":"9f6a8fd7_c9068621","line":3100,"range":{"start_line":3100,"start_character":56,"end_line":3100,"end_character":60},"updated":"2018-05-01 22:07:08.000000000","message":"those","commit_id":"5d20cf2b07893d19886498ac61178f4723b7ddcd"}]}
