)]}'
{"nova/objects/resource_provider.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"71fd3f7e4350659823b1d79555d594bb3cc2c593","unresolved":false,"context_lines":[{"line_number":2861,"context_line":"    :param ctx: nova.context.Context object"},{"line_number":2862,"context_line":"    :param names: list of string trait names"},{"line_number":2863,"context_line":"    \"\"\""},{"line_number":2864,"context_line":"    unames \u003d []"},{"line_number":2865,"context_line":"    for name in names:"},{"line_number":2866,"context_line":"        # Avoid SAWarnings about unicode types..."},{"line_number":2867,"context_line":"        unames.append(six.text_type(name))"},{"line_number":2868,"context_line":"    tt \u003d sa.alias(_TRAIT_TBL, name\u003d\u0027t\u0027)"},{"line_number":2869,"context_line":"    sel \u003d sa.select([tt.c.name, tt.c.id]).where(tt.c.name.in_(unames))"},{"line_number":2870,"context_line":"    return {r[0]: r[1] for r in ctx.session.execute(sel)}"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f4b6375_6fe17a9b","line":2867,"range":{"start_line":2864,"start_character":0,"end_line":2867,"end_character":42},"updated":"2017-11-02 12:03:17.000000000","message":"or\n\n unames \u003d map(six.text_type, names)","commit_id":"f971373d9e36f31c077939c356a97e4c8d544a7a"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"71fd3f7e4350659823b1d79555d594bb3cc2c593","unresolved":false,"context_lines":[{"line_number":2956,"context_line":"            # We know there\u0027s no sharing providers, so we can more efficiently"},{"line_number":2957,"context_line":"            # get a list of resource provider IDs that have ALL the requested"},{"line_number":2958,"context_line":"            # resources and more efficiently construct the allocation requests"},{"line_number":2959,"context_line":"            rp_ids \u003d _get_provider_ids_matching_all(context, resources,"},{"line_number":2960,"context_line":"                                                    trait_map)"},{"line_number":2961,"context_line":"            return _alloc_candidates_no_shared(context, resources, rp_ids)"},{"line_number":2962,"context_line":""},{"line_number":2963,"context_line":"        # rp_ids contains a list of resource provider IDs that EITHER have all"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f4b6375_cf474e77","line":2960,"range":{"start_line":2959,"start_character":61,"end_line":2960,"end_character":61},"updated":"2017-11-02 12:03:17.000000000","message":"We should start passing the whole \u0027filters\u0027 here.  Very soon it\u0027s going to be the whole list of RequestGroup instances; eventually it may be a more complex object (e.g. including limit info).  So rather than keep adding params to the signature...","commit_id":"f971373d9e36f31c077939c356a97e4c8d544a7a"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"a99ae68cba29418a675883d9bf40449ce37ffd61","unresolved":false,"context_lines":[{"line_number":2427,"context_line":""},{"line_number":2428,"context_line":""},{"line_number":2429,"context_line":"@db_api.api_context_manager.reader"},{"line_number":2430,"context_line":"def _get_provider_ids_having_all_traits(ctx, required_traits):"},{"line_number":2431,"context_line":"    \"\"\"Returns a list of resource provider internal IDs that have ALL of the"},{"line_number":2432,"context_line":"    required traits."},{"line_number":2433,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f4b6375_ccc13150","line":2430,"range":{"start_line":2430,"start_character":4,"end_line":2430,"end_character":39},"updated":"2017-11-07 21:39:52.000000000","message":"This doesn\u0027t work for\n- RPs with no traits (they aren\u0027t in the ResourceProviderTrait table)\n- Queries that don\u0027t require any traits (rptt.c.trait_id is never \u0027in\u0027 the empty list).\n\nThis is accounted for by the (currently one) caller of this method; but the behavior should be noted in the docstring and/or comments.\n\nActually recommend raising ValueError if required_traits is empty/None.  That\u0027ll prevent \"accidents\", since the behavior in that case is definitely not what\u0027s expected.","commit_id":"3bccfacbb35d8fe6307ffb4aad3f29e40c4b7eea"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"1af271d37d822dee5f6a4fac95db4ac55a6c0077","unresolved":false,"context_lines":[{"line_number":2427,"context_line":""},{"line_number":2428,"context_line":""},{"line_number":2429,"context_line":"@db_api.api_context_manager.reader"},{"line_number":2430,"context_line":"def _get_provider_ids_having_all_traits(ctx, required_traits):"},{"line_number":2431,"context_line":"    \"\"\"Returns a list of resource provider internal IDs that have ALL of the"},{"line_number":2432,"context_line":"    required traits."},{"line_number":2433,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f4b6375_47007a66","line":2430,"range":{"start_line":2430,"start_character":4,"end_line":2430,"end_character":39},"in_reply_to":"3f4b6375_ccc13150","updated":"2017-11-07 22:00:31.000000000","message":"Done","commit_id":"3bccfacbb35d8fe6307ffb4aad3f29e40c4b7eea"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"328beec979898c52030ee5023476ca837abb31b9","unresolved":false,"context_lines":[{"line_number":2444,"context_line":"    # need to GROUP BY the resource provider and ensure that the COUNT(DISTINCT"},{"line_number":2445,"context_line":"    # trait_id) is equal to the number of traits we are requiring"},{"line_number":2446,"context_line":"    num_traits \u003d len(required_traits)"},{"line_number":2447,"context_line":"    cond \u003d sa.func.count(sa.distinct(rptt.c.trait_id)) \u003d\u003d num_traits"},{"line_number":2448,"context_line":"    sel \u003d sel.having(cond)"},{"line_number":2449,"context_line":"    return [r[0] for r in ctx.session.execute(sel)]"},{"line_number":2450,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f4b6375_e9b991cb","line":2447,"range":{"start_line":2447,"start_character":25,"end_line":2447,"end_character":36},"updated":"2017-11-07 01:38:56.000000000","message":"We don\u0027t need this, since the primary key is (trait_id, resource_provide_id)","commit_id":"3bccfacbb35d8fe6307ffb4aad3f29e40c4b7eea"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"1af271d37d822dee5f6a4fac95db4ac55a6c0077","unresolved":false,"context_lines":[{"line_number":2444,"context_line":"    # need to GROUP BY the resource provider and ensure that the COUNT(DISTINCT"},{"line_number":2445,"context_line":"    # trait_id) is equal to the number of traits we are requiring"},{"line_number":2446,"context_line":"    num_traits \u003d len(required_traits)"},{"line_number":2447,"context_line":"    cond \u003d sa.func.count(sa.distinct(rptt.c.trait_id)) \u003d\u003d num_traits"},{"line_number":2448,"context_line":"    sel \u003d sel.having(cond)"},{"line_number":2449,"context_line":"    return [r[0] for r in ctx.session.execute(sel)]"},{"line_number":2450,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f4b6375_27fb3e79","line":2447,"range":{"start_line":2447,"start_character":25,"end_line":2447,"end_character":36},"in_reply_to":"3f4b6375_c7b7ca20","updated":"2017-11-07 22:00:31.000000000","message":"Done","commit_id":"3bccfacbb35d8fe6307ffb4aad3f29e40c4b7eea"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"a99ae68cba29418a675883d9bf40449ce37ffd61","unresolved":false,"context_lines":[{"line_number":2444,"context_line":"    # need to GROUP BY the resource provider and ensure that the COUNT(DISTINCT"},{"line_number":2445,"context_line":"    # trait_id) is equal to the number of traits we are requiring"},{"line_number":2446,"context_line":"    num_traits \u003d len(required_traits)"},{"line_number":2447,"context_line":"    cond \u003d sa.func.count(sa.distinct(rptt.c.trait_id)) \u003d\u003d num_traits"},{"line_number":2448,"context_line":"    sel \u003d sel.having(cond)"},{"line_number":2449,"context_line":"    return [r[0] for r in ctx.session.execute(sel)]"},{"line_number":2450,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f4b6375_c7b7ca20","line":2447,"range":{"start_line":2447,"start_character":25,"end_line":2447,"end_character":36},"in_reply_to":"3f4b6375_e9b991cb","updated":"2017-11-07 21:39:52.000000000","message":"I tested this and it appears the DISTINCT is not needed.","commit_id":"3bccfacbb35d8fe6307ffb4aad3f29e40c4b7eea"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"9fa4aba3b589d621fb916502d8af5004b4ff38b8","unresolved":false,"context_lines":[{"line_number":2850,"context_line":"def _provider_traits(ctx, rp_ids):"},{"line_number":2851,"context_line":"    \"\"\"Given a list of resource provider internal IDs, returns a dict, keyed by"},{"line_number":2852,"context_line":"    those provider IDs, of string trait names associated with that provider."},{"line_number":2853,"context_line":""},{"line_number":2854,"context_line":"    :param ctx: nova.context.Context object"},{"line_number":2855,"context_line":"    :param rp_ids: list of resource provider IDs"},{"line_number":2856,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_d8e54a3a","line":2853,"updated":"2017-11-20 13:24:24.000000000","message":"This method ought to ValueError if rp_ids is empty.","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"88e770e3e327627c02dbb8a33d3a8996305e6e89","unresolved":false,"context_lines":[{"line_number":2850,"context_line":"def _provider_traits(ctx, rp_ids):"},{"line_number":2851,"context_line":"    \"\"\"Given a list of resource provider internal IDs, returns a dict, keyed by"},{"line_number":2852,"context_line":"    those provider IDs, of string trait names associated with that provider."},{"line_number":2853,"context_line":""},{"line_number":2854,"context_line":"    :param ctx: nova.context.Context object"},{"line_number":2855,"context_line":"    :param rp_ids: list of resource provider IDs"},{"line_number":2856,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_52ffb200","line":2853,"in_reply_to":"ff82abbf_d8e54a3a","updated":"2017-11-21 16:42:19.000000000","message":"Done","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"9fa4aba3b589d621fb916502d8af5004b4ff38b8","unresolved":false,"context_lines":[{"line_number":2869,"context_line":"def _trait_ids_from_names(ctx, names):"},{"line_number":2870,"context_line":"    \"\"\"Given a list of string trait names, returns a dict, keyed by those"},{"line_number":2871,"context_line":"    string names, of the corresponding internal integer trait ID."},{"line_number":2872,"context_line":""},{"line_number":2873,"context_line":"    :param ctx: nova.context.Context object"},{"line_number":2874,"context_line":"    :param names: list of string trait names"},{"line_number":2875,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_f88dae7b","line":2872,"updated":"2017-11-20 13:24:24.000000000","message":"This method ought to ValueError if `names` is empty.","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"88e770e3e327627c02dbb8a33d3a8996305e6e89","unresolved":false,"context_lines":[{"line_number":2869,"context_line":"def _trait_ids_from_names(ctx, names):"},{"line_number":2870,"context_line":"    \"\"\"Given a list of string trait names, returns a dict, keyed by those"},{"line_number":2871,"context_line":"    string names, of the corresponding internal integer trait ID."},{"line_number":2872,"context_line":""},{"line_number":2873,"context_line":"    :param ctx: nova.context.Context object"},{"line_number":2874,"context_line":"    :param names: list of string trait names"},{"line_number":2875,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_af049718","line":2872,"in_reply_to":"ff82abbf_f88dae7b","updated":"2017-11-21 16:42:19.000000000","message":"Done","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"9fa4aba3b589d621fb916502d8af5004b4ff38b8","unresolved":false,"context_lines":[{"line_number":2873,"context_line":"    :param ctx: nova.context.Context object"},{"line_number":2874,"context_line":"    :param names: list of string trait names"},{"line_number":2875,"context_line":"    \"\"\""},{"line_number":2876,"context_line":"    unames \u003d []"},{"line_number":2877,"context_line":"    for name in names:"},{"line_number":2878,"context_line":"        # Avoid SAWarnings about unicode types..."},{"line_number":2879,"context_line":"        unames.append(six.text_type(name))"},{"line_number":2880,"context_line":"    tt \u003d sa.alias(_TRAIT_TBL, name\u003d\u0027t\u0027)"},{"line_number":2881,"context_line":"    sel \u003d sa.select([tt.c.name, tt.c.id]).where(tt.c.name.in_(unames))"},{"line_number":2882,"context_line":"    return {r[0]: r[1] for r in ctx.session.execute(sel)}"}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_f85fee0b","line":2879,"range":{"start_line":2876,"start_character":0,"end_line":2879,"end_character":42},"updated":"2017-11-20 13:24:24.000000000","message":"Or\n\n unames \u003d map(six.text_type, names)","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"88e770e3e327627c02dbb8a33d3a8996305e6e89","unresolved":false,"context_lines":[{"line_number":2873,"context_line":"    :param ctx: nova.context.Context object"},{"line_number":2874,"context_line":"    :param names: list of string trait names"},{"line_number":2875,"context_line":"    \"\"\""},{"line_number":2876,"context_line":"    unames \u003d []"},{"line_number":2877,"context_line":"    for name in names:"},{"line_number":2878,"context_line":"        # Avoid SAWarnings about unicode types..."},{"line_number":2879,"context_line":"        unames.append(six.text_type(name))"},{"line_number":2880,"context_line":"    tt \u003d sa.alias(_TRAIT_TBL, name\u003d\u0027t\u0027)"},{"line_number":2881,"context_line":"    sel \u003d sa.select([tt.c.name, tt.c.id]).where(tt.c.name.in_(unames))"},{"line_number":2882,"context_line":"    return {r[0]: r[1] for r in ctx.session.execute(sel)}"}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_d2dc2276","line":2879,"range":{"start_line":2876,"start_character":0,"end_line":2879,"end_character":42},"in_reply_to":"ff82abbf_f85fee0b","updated":"2017-11-21 16:42:19.000000000","message":"Done","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"19950257eb1ad488f02526743a74102e8a0b7ff5","unresolved":false,"context_lines":[{"line_number":2879,"context_line":"        unames.append(six.text_type(name))"},{"line_number":2880,"context_line":"    tt \u003d sa.alias(_TRAIT_TBL, name\u003d\u0027t\u0027)"},{"line_number":2881,"context_line":"    sel \u003d sa.select([tt.c.name, tt.c.id]).where(tt.c.name.in_(unames))"},{"line_number":2882,"context_line":"    return {r[0]: r[1] for r in ctx.session.execute(sel)}"},{"line_number":2883,"context_line":""},{"line_number":2884,"context_line":""},{"line_number":2885,"context_line":"@base.NovaObjectRegistry.register_if(False)"}],"source_content_type":"text/x-python","patch_set":12,"id":"1f485f77_0f988d67","line":2882,"range":{"start_line":2882,"start_character":4,"end_line":2882,"end_character":57},"updated":"2017-11-17 11:36:55.000000000","message":"In such case of \u0027no such trait\u0027, this function just returns an empty dict, which means that we can check and raise an error out of this function such as inserting it in L2948. My recommendation is to not take error handlings inside of the function for versatility.","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"beadbb09ee173330a9c1f118711dd13a75900be6","unresolved":false,"context_lines":[{"line_number":2878,"context_line":"        # Avoid SAWarnings about unicode types..."},{"line_number":2879,"context_line":"        unames.append(six.text_type(name))"},{"line_number":2880,"context_line":"    tt \u003d sa.alias(_TRAIT_TBL, name\u003d\u0027t\u0027)"},{"line_number":2881,"context_line":"    sel \u003d sa.select([tt.c.name, tt.c.id]).where(tt.c.name.in_(unames))"},{"line_number":2882,"context_line":"    return {r[0]: r[1] for r in ctx.session.execute(sel)}"},{"line_number":2883,"context_line":""},{"line_number":2884,"context_line":""},{"line_number":2885,"context_line":"@base.NovaObjectRegistry.register_if(False)"}],"source_content_type":"text/x-python","patch_set":12,"id":"1f485f77_e1eaefd5","line":2882,"range":{"start_line":2881,"start_character":4,"end_line":2882,"end_character":57},"updated":"2017-11-17 06:11:57.000000000","message":"There is a case for the trait doesn\u0027t exist.\n\nWe can check the traits whether valid in the API, but I feel that is waste,basically this sql is smilar to the valid trait checking sql.\n\nSo I think we check that at here is good option.","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"785a92da5e6ddc5ade87a38b72945294b33479c0","unresolved":false,"context_lines":[{"line_number":2879,"context_line":"        unames.append(six.text_type(name))"},{"line_number":2880,"context_line":"    tt \u003d sa.alias(_TRAIT_TBL, name\u003d\u0027t\u0027)"},{"line_number":2881,"context_line":"    sel \u003d sa.select([tt.c.name, tt.c.id]).where(tt.c.name.in_(unames))"},{"line_number":2882,"context_line":"    return {r[0]: r[1] for r in ctx.session.execute(sel)}"},{"line_number":2883,"context_line":""},{"line_number":2884,"context_line":""},{"line_number":2885,"context_line":"@base.NovaObjectRegistry.register_if(False)"}],"source_content_type":"text/x-python","patch_set":12,"id":"1f485f77_8afc6b3e","line":2882,"range":{"start_line":2882,"start_character":4,"end_line":2882,"end_character":57},"in_reply_to":"1f485f77_0f988d67","updated":"2017-11-17 12:36:40.000000000","message":"@Tetsuro, yea, you are right. I mean we should check the valid in those object layer, it shouldn\u0027t be in this functional defnitely. Sorry I didn\u0027t clear about that","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"9fa4aba3b589d621fb916502d8af5004b4ff38b8","unresolved":false,"context_lines":[{"line_number":2879,"context_line":"        unames.append(six.text_type(name))"},{"line_number":2880,"context_line":"    tt \u003d sa.alias(_TRAIT_TBL, name\u003d\u0027t\u0027)"},{"line_number":2881,"context_line":"    sel \u003d sa.select([tt.c.name, tt.c.id]).where(tt.c.name.in_(unames))"},{"line_number":2882,"context_line":"    return {r[0]: r[1] for r in ctx.session.execute(sel)}"},{"line_number":2883,"context_line":""},{"line_number":2884,"context_line":""},{"line_number":2885,"context_line":"@base.NovaObjectRegistry.register_if(False)"}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_b8ede626","line":2882,"range":{"start_line":2882,"start_character":4,"end_line":2882,"end_character":57},"in_reply_to":"1f485f77_8afc6b3e","updated":"2017-11-20 13:24:24.000000000","message":"Not sure I agree; but it sounds like I\u0027m in the minority.","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"beadbb09ee173330a9c1f118711dd13a75900be6","unresolved":false,"context_lines":[{"line_number":2929,"context_line":"        # For now, this extracts just the sharing group\u0027s resources \u0026 traits."},{"line_number":2930,"context_line":"        sharing_groups \u003d [request_group for request_group in requests"},{"line_number":2931,"context_line":"                          if not request_group.use_same_provider]"},{"line_number":2932,"context_line":"        if len(sharing_groups) !\u003d 1 or not sharing_groups[0].resources:"},{"line_number":2933,"context_line":"            raise ValueError(_(\"The requests parameter must contain one \""},{"line_number":2934,"context_line":"                               \"RequestGroup with use_same_provider\u003dFalse and \""},{"line_number":2935,"context_line":"                               \"nonempty resources.\"))"}],"source_content_type":"text/x-python","patch_set":12,"id":"1f485f77_01198b20","line":2932,"range":{"start_line":2932,"start_character":39,"end_line":2932,"end_character":70},"updated":"2017-11-17 06:11:57.000000000","message":"looks like we don\u0027t have test for this case","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"88e770e3e327627c02dbb8a33d3a8996305e6e89","unresolved":false,"context_lines":[{"line_number":2929,"context_line":"        # For now, this extracts just the sharing group\u0027s resources \u0026 traits."},{"line_number":2930,"context_line":"        sharing_groups \u003d [request_group for request_group in requests"},{"line_number":2931,"context_line":"                          if not request_group.use_same_provider]"},{"line_number":2932,"context_line":"        if len(sharing_groups) !\u003d 1 or not sharing_groups[0].resources:"},{"line_number":2933,"context_line":"            raise ValueError(_(\"The requests parameter must contain one \""},{"line_number":2934,"context_line":"                               \"RequestGroup with use_same_provider\u003dFalse and \""},{"line_number":2935,"context_line":"                               \"nonempty resources.\"))"}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_b274fe36","line":2932,"range":{"start_line":2932,"start_character":39,"end_line":2932,"end_character":70},"in_reply_to":"1f485f77_01198b20","updated":"2017-11-21 16:42:19.000000000","message":"Done","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"614c347a32d71140cd3b650e3408a7bb90a25bc2","unresolved":false,"context_lines":[{"line_number":2944,"context_line":"        # maps the trait name to the trait internal ID"},{"line_number":2945,"context_line":"        trait_map \u003d {}"},{"line_number":2946,"context_line":"        if traits:"},{"line_number":2947,"context_line":"            trait_map \u003d _trait_ids_from_names(context, traits)"},{"line_number":2948,"context_line":""},{"line_number":2949,"context_line":"        # Contains a set of resource provider IDs that share some inventory for"},{"line_number":2950,"context_line":"        # each resource class requested. We do this here as an optimization. If"}],"source_content_type":"text/x-python","patch_set":12,"id":"1f485f77_e2f2cc6f","line":2947,"updated":"2017-11-19 16:12:12.000000000","message":"OK, @alex_xu, would you prefer we compare the len(trait_map) to the len(sharing_groups[0].required_traits) here, to check for non-existing traits?\n\nOr, alternately, would you prefer we do that kind of \"pre-check\" in the RequestGroup instantiation from the REST API handler for allocation candidates?\n\nLet me know and I\u0027ll make the change :)\n\nBest,\n\n-jay","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"11ee82d92c983186c3848f00c62a74bc5196f985","unresolved":false,"context_lines":[{"line_number":2944,"context_line":"        # maps the trait name to the trait internal ID"},{"line_number":2945,"context_line":"        trait_map \u003d {}"},{"line_number":2946,"context_line":"        if traits:"},{"line_number":2947,"context_line":"            trait_map \u003d _trait_ids_from_names(context, traits)"},{"line_number":2948,"context_line":""},{"line_number":2949,"context_line":"        # Contains a set of resource provider IDs that share some inventory for"},{"line_number":2950,"context_line":"        # each resource class requested. We do this here as an optimization. If"}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_ecc5f45c","line":2947,"in_reply_to":"1f485f77_e2f2cc6f","updated":"2017-11-20 10:32:14.000000000","message":":) The first one I think. If we \"pre-check\" in the RequestGroup instantiation from the REST API, we need to execute one more sql query, that is waste I think, does make sense?","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"88e770e3e327627c02dbb8a33d3a8996305e6e89","unresolved":false,"context_lines":[{"line_number":2944,"context_line":"        # maps the trait name to the trait internal ID"},{"line_number":2945,"context_line":"        trait_map \u003d {}"},{"line_number":2946,"context_line":"        if traits:"},{"line_number":2947,"context_line":"            trait_map \u003d _trait_ids_from_names(context, traits)"},{"line_number":2948,"context_line":""},{"line_number":2949,"context_line":"        # Contains a set of resource provider IDs that share some inventory for"},{"line_number":2950,"context_line":"        # each resource class requested. We do this here as an optimization. If"}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_728f562a","line":2947,"in_reply_to":"ff82abbf_d86c6a9e","updated":"2017-11-21 16:42:19.000000000","message":"Done","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"9fa4aba3b589d621fb916502d8af5004b4ff38b8","unresolved":false,"context_lines":[{"line_number":2944,"context_line":"        # maps the trait name to the trait internal ID"},{"line_number":2945,"context_line":"        trait_map \u003d {}"},{"line_number":2946,"context_line":"        if traits:"},{"line_number":2947,"context_line":"            trait_map \u003d _trait_ids_from_names(context, traits)"},{"line_number":2948,"context_line":""},{"line_number":2949,"context_line":"        # Contains a set of resource provider IDs that share some inventory for"},{"line_number":2950,"context_line":"        # each resource class requested. We do this here as an optimization. If"}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_d86c6a9e","line":2947,"in_reply_to":"ff82abbf_ecc5f45c","updated":"2017-11-20 13:24:24.000000000","message":"I think you should do more than validate the length, to help out the consumer.\n\n missing_traits \u003d traits - set(trait_map)\n if missing_traits:\n     do_whatever_will_400(\"Invalid required trait(s): %s\" % \",\".join(missing_traits))","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"98e79f12562f3ca31e6bc08af77bec74c9b31165","unresolved":false,"context_lines":[{"line_number":2856,"context_line":"    :param ctx: nova.context.Context object"},{"line_number":2857,"context_line":"    :param rp_ids: list of resource provider IDs"},{"line_number":2858,"context_line":"    \"\"\""},{"line_number":2859,"context_line":"    if not rp_ids:"},{"line_number":2860,"context_line":"        raise ValueError(_(\"Expected rp_ids to be a list of resource provider \""},{"line_number":2861,"context_line":"                           \"internal IDs, but got an empty list.\"))"},{"line_number":2862,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"ff82abbf_5d4fbabc","line":2859,"range":{"start_line":2859,"start_character":4,"end_line":2859,"end_character":18},"updated":"2017-11-22 01:04:53.000000000","message":"This isn\u0027t usefull, since we have check in the caller.","commit_id":"fefeb776ed1c7c7a75e2385bb78ba4a389057069"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"98e79f12562f3ca31e6bc08af77bec74c9b31165","unresolved":false,"context_lines":[{"line_number":2881,"context_line":"    :param ctx: nova.context.Context object"},{"line_number":2882,"context_line":"    :param names: list of string trait names"},{"line_number":2883,"context_line":"    \"\"\""},{"line_number":2884,"context_line":"    if not names:"},{"line_number":2885,"context_line":"        raise ValueError(_(\"Expected names to be a list of string trait \""},{"line_number":2886,"context_line":"                           \"names, but got an empty list.\"))"},{"line_number":2887,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"ff82abbf_7d4cfec6","line":2884,"range":{"start_line":2884,"start_character":4,"end_line":2884,"end_character":17},"updated":"2017-11-22 01:04:53.000000000","message":"This check isn\u0027t useful also.","commit_id":"fefeb776ed1c7c7a75e2385bb78ba4a389057069"}],"nova/tests/functional/db/test_allocation_candidates.py":[{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"19950257eb1ad488f02526743a74102e8a0b7ff5","unresolved":false,"context_lines":[{"line_number":483,"context_line":"        self.assertIsNotNone(cn2_p_sum)"},{"line_number":484,"context_line":"        self.assertEqual(1, len(cn2_p_sum.traits))"},{"line_number":485,"context_line":"        self.assertEqual(os_traits.HW_CPU_X86_AVX2, cn2_p_sum.traits[0].name)"},{"line_number":486,"context_line":""},{"line_number":487,"context_line":"    def test_local_with_shared_disk(self):"},{"line_number":488,"context_line":"        \"\"\"Create some resource providers that can satisfy the request for"},{"line_number":489,"context_line":"        resources with local VCPU and MEMORY_MB but rely on a shared storage"}],"source_content_type":"text/x-python","patch_set":12,"id":"1f485f77_417f8314","line":486,"updated":"2017-11-17 11:36:55.000000000","message":"good to add _validate_allocation_requests() check","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"88e770e3e327627c02dbb8a33d3a8996305e6e89","unresolved":false,"context_lines":[{"line_number":483,"context_line":"        self.assertIsNotNone(cn2_p_sum)"},{"line_number":484,"context_line":"        self.assertEqual(1, len(cn2_p_sum.traits))"},{"line_number":485,"context_line":"        self.assertEqual(os_traits.HW_CPU_X86_AVX2, cn2_p_sum.traits[0].name)"},{"line_number":486,"context_line":""},{"line_number":487,"context_line":"    def test_local_with_shared_disk(self):"},{"line_number":488,"context_line":"        \"\"\"Create some resource providers that can satisfy the request for"},{"line_number":489,"context_line":"        resources with local VCPU and MEMORY_MB but rely on a shared storage"}],"source_content_type":"text/x-python","patch_set":12,"id":"ff82abbf_729af614","line":486,"in_reply_to":"1f485f77_417f8314","updated":"2017-11-21 16:42:19.000000000","message":"Done, good idea.","commit_id":"83bd5a082ed607d7926e92bf426ac6c6b5abae7d"}],"nova/tests/functional/db/test_resource_provider.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"71fd3f7e4350659823b1d79555d594bb3cc2c593","unresolved":false,"context_lines":[{"line_number":2661,"context_line":"        self.assertIsNotNone(cn2_req_disk)"},{"line_number":2662,"context_line":"        self.assertEqual(requested_resources[\u0027DISK_GB\u0027], cn2_req_disk.amount)"},{"line_number":2663,"context_line":""},{"line_number":2664,"context_line":"        # Now let\u0027s add traits into the mix. Currently, none of the compute"},{"line_number":2665,"context_line":"        # nodes has the AVX2 trait associated with it, so we should get 0"},{"line_number":2666,"context_line":"        # results if we required AVX2"},{"line_number":2667,"context_line":"        p_alts \u003d rp_obj.AllocationCandidates.get_by_filters("}],"source_content_type":"text/x-python","patch_set":3,"id":"3f4b6375_ca0a9c1e","line":2664,"updated":"2017-11-02 12:03:17.000000000","message":"Definitely need to expand trait test cases.  Off the top:\n\n- Multiple traits on one RP\n- Traits on multiple RPs\n- Requesting multiple traits\n- Some RPs have a subset of the requested traits (they\u0027re excluded)\n- Some RPs have a superset of the requested traits (they\u0027re included - the extra traits don\u0027t confuse anything)\n- Requests with no traits still return RPs that *have* traits.","commit_id":"f971373d9e36f31c077939c356a97e4c8d544a7a"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"98e79f12562f3ca31e6bc08af77bec74c9b31165","unresolved":false,"context_lines":[{"line_number":74,"context_line":"class ResourceProviderTestCase(ResourceProviderBaseCase):"},{"line_number":75,"context_line":"    \"\"\"Test resource-provider objects\u0027 lifecycles.\"\"\""},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    def test_provider_traits_empty_param(self):"},{"line_number":78,"context_line":"        self.assertRaises(ValueError, rp_obj._provider_traits,"},{"line_number":79,"context_line":"                          self.ctx, [])"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def test_trait_ids_from_names_empty_param(self):"},{"line_number":82,"context_line":"        self.assertRaises(ValueError, rp_obj._trait_ids_from_names,"},{"line_number":83,"context_line":"                          self.ctx, [])"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    def test_create_resource_provider_requires_uuid(self):"},{"line_number":86,"context_line":"        resource_provider \u003d rp_obj.ResourceProvider("}],"source_content_type":"text/x-python","patch_set":13,"id":"ff82abbf_bd85a6af","line":83,"range":{"start_line":77,"start_character":4,"end_line":83,"end_character":39},"updated":"2017-11-22 01:04:53.000000000","message":"yea, the check isn\u0027t very useful, and we have two extra unittests.","commit_id":"fefeb776ed1c7c7a75e2385bb78ba4a389057069"}]}
