)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"9c44071696d89b8d6d3241f5348cf7d0a548923c","unresolved":false,"context_lines":[{"line_number":22,"context_line":"to the schema (i.e. beginning with \"CUSTOM_\")."},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"The problem is that this relies on the local system\u0027s notion of the set"},{"line_number":25,"context_line":"of standard resource classes. If the placement service is running newer"},{"line_number":26,"context_line":"code, standard resource classes may have been added that the compute"},{"line_number":27,"context_line":"service doesn\u0027t know about yet."},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"This change set solves the problem by only attempting to create resource"},{"line_number":30,"context_line":"classes with the \u0027CUSTOM_\u0027 prefix."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"3fa0c359_09c52ef1","line":27,"range":{"start_line":25,"start_character":30,"end_line":27,"end_character":31},"updated":"2018-02-09 04:59:31.000000000","message":"Are there any cases where standard resource classes may have been *removed*? Probably not, but if this change assumes anything, it is good for us to be aware of that.","commit_id":"9af5f96705e3b0607c4ee02bcd907948beac20d5"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"1d79f19aecae0e76f355466ee39c3a76021c804f","unresolved":false,"context_lines":[{"line_number":22,"context_line":"to the schema (i.e. beginning with \"CUSTOM_\")."},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"The problem is that this relies on the local system\u0027s notion of the set"},{"line_number":25,"context_line":"of standard resource classes. If the placement service is running newer"},{"line_number":26,"context_line":"code, standard resource classes may have been added that the compute"},{"line_number":27,"context_line":"service doesn\u0027t know about yet."},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"This change set solves the problem by only attempting to create resource"},{"line_number":30,"context_line":"classes with the \u0027CUSTOM_\u0027 prefix."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"3fa0c359_88e4ca3d","line":27,"range":{"start_line":25,"start_character":30,"end_line":27,"end_character":31},"in_reply_to":"3fa0c359_09c52ef1","updated":"2018-02-09 14:36:35.000000000","message":"That seems vanishingly unlikely.\n\nBut we\u0027d still be constrained by microversion boundaries.  E.g. if microversion 1.41 has a particular resource class, 1.41 has a commitment to continue supporting that resource class.  If microversion 1.42 removes it, you would have to be talking at microversion 1.42 to be impacted by the change.\n\nThis is the same philosophy that makes it okay for us to base the logic in this change set on the hardcoded \u0027CUSTOM_\u0027 prefix.  Initial patch sets always asked placement for the list of known resource classes and filtered against that; but cdent set me straight :)","commit_id":"9af5f96705e3b0607c4ee02bcd907948beac20d5"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"2ac402f028b422d67fa4882e5bd5bcb24b56f1c7","unresolved":false,"context_lines":[{"line_number":22,"context_line":"to the schema (i.e. beginning with \"CUSTOM_\")."},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"The problem is that this relies on the local system\u0027s notion of the set"},{"line_number":25,"context_line":"of standard resource classes. If the placement service is running newer"},{"line_number":26,"context_line":"code, standard resource classes may have been added that the compute"},{"line_number":27,"context_line":"service doesn\u0027t know about yet."},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"This change set solves the problem by only attempting to create resource"},{"line_number":30,"context_line":"classes with the \u0027CUSTOM_\u0027 prefix."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"3fa0c359_564dca3b","line":27,"range":{"start_line":25,"start_character":30,"end_line":27,"end_character":31},"in_reply_to":"3fa0c359_289c965b","updated":"2018-02-13 00:52:30.000000000","message":"Nice to know. Thanks!","commit_id":"9af5f96705e3b0607c4ee02bcd907948beac20d5"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"06c49746ec00fc07fdf203ad73957bc16a472d7e","unresolved":false,"context_lines":[{"line_number":22,"context_line":"to the schema (i.e. beginning with \"CUSTOM_\")."},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"The problem is that this relies on the local system\u0027s notion of the set"},{"line_number":25,"context_line":"of standard resource classes. If the placement service is running newer"},{"line_number":26,"context_line":"code, standard resource classes may have been added that the compute"},{"line_number":27,"context_line":"service doesn\u0027t know about yet."},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"This change set solves the problem by only attempting to create resource"},{"line_number":30,"context_line":"classes with the \u0027CUSTOM_\u0027 prefix."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"3fa0c359_289c965b","line":27,"range":{"start_line":25,"start_character":30,"end_line":27,"end_character":31},"in_reply_to":"3fa0c359_88e4ca3d","updated":"2018-02-09 14:45:42.000000000","message":"\u003e That seems vanishingly unlikely.\n\nIt\u0027s not allowed, by defintion.\n\n \u003e But we\u0027d still be constrained by microversion boundaries.  E.g. if\n \u003e microversion 1.41 has a particular resource class, 1.41 has a\n \u003e commitment to continue supporting that resource class.  If\n \u003e microversion 1.42 removes it, you would have to be talking at\n \u003e microversion 1.42 to be impacted by the change.\n\nI\u0027m not certain that microversions apply to resource class _values_. They apply to the structure of responses and very rarely to some values which are strictly enumerations, which I don\u0027t think resource classes would qualify as, given the existence of CUSTOM_*.\n\nBut it\u0027s mostly moot given that removing the standard ones is not supposed to happen.","commit_id":"9af5f96705e3b0607c4ee02bcd907948beac20d5"}],"nova/scheduler/client/report.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f0747e00b0ef0fad2dfcf4d9db96ce11ccaa3e5a","unresolved":false,"context_lines":[{"line_number":1136,"context_line":""},{"line_number":1137,"context_line":"    @safe_connect"},{"line_number":1138,"context_line":"    def _ensure_resource_classes(self, names):"},{"line_number":1139,"context_line":"        \"\"\"Make sure resource classes exists."},{"line_number":1140,"context_line":""},{"line_number":1141,"context_line":"        :param names: Iterable of string names of the resource classes to"},{"line_number":1142,"context_line":"                      check/create."}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_5f42b8ac","line":1139,"range":{"start_line":1139,"start_character":43,"end_line":1139,"end_character":44},"updated":"2018-02-01 17:46:04.000000000","message":"exist","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8949919c57484f9af2407a7dd47dc824fea7b2d2","unresolved":false,"context_lines":[{"line_number":1136,"context_line":""},{"line_number":1137,"context_line":"    @safe_connect"},{"line_number":1138,"context_line":"    def _ensure_resource_classes(self, names):"},{"line_number":1139,"context_line":"        \"\"\"Make sure resource classes exists."},{"line_number":1140,"context_line":""},{"line_number":1141,"context_line":"        :param names: Iterable of string names of the resource classes to"},{"line_number":1142,"context_line":"                      check/create."}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_b94178a8","line":1139,"range":{"start_line":1139,"start_character":43,"end_line":1139,"end_character":44},"in_reply_to":"5f93b717_5f42b8ac","updated":"2018-02-02 23:39:28.000000000","message":"Done","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f0747e00b0ef0fad2dfcf4d9db96ce11ccaa3e5a","unresolved":false,"context_lines":[{"line_number":1143,"context_line":"        :raises: exception.InvalidResourceClass if an attempt is made to create"},{"line_number":1144,"context_line":"                 an invalid resource class."},{"line_number":1145,"context_line":"        :raises: exception.ResourceClassRetrievalFailed if an error occurs"},{"line_number":1146,"context_line":"                 attempting to populate the cache."},{"line_number":1147,"context_line":"        \"\"\""},{"line_number":1148,"context_line":"        if not names:"},{"line_number":1149,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_9f01203b","line":1146,"range":{"start_line":1146,"start_character":17,"end_line":1146,"end_character":50},"updated":"2018-02-01 17:46:04.000000000","message":"AFAICT, there\u0027s no cache that\u0027s being updated anywhere...","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"e8758a42c3619ca3fb500935d5abc59f78d99748","unresolved":false,"context_lines":[{"line_number":1143,"context_line":"        :raises: exception.InvalidResourceClass if an attempt is made to create"},{"line_number":1144,"context_line":"                 an invalid resource class."},{"line_number":1145,"context_line":"        :raises: exception.ResourceClassRetrievalFailed if an error occurs"},{"line_number":1146,"context_line":"                 attempting to populate the cache."},{"line_number":1147,"context_line":"        \"\"\""},{"line_number":1148,"context_line":"        if not names:"},{"line_number":1149,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_b2a3f3ff","line":1146,"range":{"start_line":1146,"start_character":17,"end_line":1146,"end_character":50},"in_reply_to":"5f93b717_9f01203b","updated":"2018-02-01 18:22:13.000000000","message":"D\u0027oh, from earlier sandbox version that was actually trying to maintain a cache in report client.","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8949919c57484f9af2407a7dd47dc824fea7b2d2","unresolved":false,"context_lines":[{"line_number":1143,"context_line":"        :raises: exception.InvalidResourceClass if an attempt is made to create"},{"line_number":1144,"context_line":"                 an invalid resource class."},{"line_number":1145,"context_line":"        :raises: exception.ResourceClassRetrievalFailed if an error occurs"},{"line_number":1146,"context_line":"                 attempting to populate the cache."},{"line_number":1147,"context_line":"        \"\"\""},{"line_number":1148,"context_line":"        if not names:"},{"line_number":1149,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_7919b0d4","line":1146,"range":{"start_line":1146,"start_character":17,"end_line":1146,"end_character":50},"in_reply_to":"5f93b717_b2a3f3ff","updated":"2018-02-02 23:39:28.000000000","message":"Done","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"c1d69d1cc5997c12cd826a3f42665c94b73ace22","unresolved":false,"context_lines":[{"line_number":1153,"context_line":"            raise exception.ResourceClassRetrievalFailed()"},{"line_number":1154,"context_line":"        all_rcs \u003d set([d[\u0027name\u0027] for d in resp.json()[\u0027resource_classes\u0027]])"},{"line_number":1155,"context_line":""},{"line_number":1156,"context_line":"        for name in (set(names) - all_rcs):"},{"line_number":1157,"context_line":"            # no payload on the put request"},{"line_number":1158,"context_line":"            resp \u003d self.put(\"/resource_classes/%s\" % name, None, version\u003d\"1.7\")"},{"line_number":1159,"context_line":"            if not resp:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_26f2419b","line":1156,"range":{"start_line":1156,"start_character":21,"end_line":1156,"end_character":41},"updated":"2018-02-01 21:25:43.000000000","message":"nit: it would read better to not cast all_rcs to a set in the line above, and then make this line:\n\n  for name in (set(names) - set(all_rcs)):","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8949919c57484f9af2407a7dd47dc824fea7b2d2","unresolved":false,"context_lines":[{"line_number":1153,"context_line":"            raise exception.ResourceClassRetrievalFailed()"},{"line_number":1154,"context_line":"        all_rcs \u003d set([d[\u0027name\u0027] for d in resp.json()[\u0027resource_classes\u0027]])"},{"line_number":1155,"context_line":""},{"line_number":1156,"context_line":"        for name in (set(names) - all_rcs):"},{"line_number":1157,"context_line":"            # no payload on the put request"},{"line_number":1158,"context_line":"            resp \u003d self.put(\"/resource_classes/%s\" % name, None, version\u003d\"1.7\")"},{"line_number":1159,"context_line":"            if not resp:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_9946fcbf","line":1156,"range":{"start_line":1156,"start_character":21,"end_line":1156,"end_character":41},"in_reply_to":"5f93b717_26f2419b","updated":"2018-02-02 23:39:28.000000000","message":"Actually what I had meant to do above was\n\n all_rcs \u003d set(d[\u0027name\u0027] for d in resp.json()[\u0027resource_classes\u0027])\n\ni.e. without creating the intermediary list, which saves a little memory (even though it doesn\u0027t read as pretty, as you say).","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"fa204df5853e0b468d07733e5dc11c7f25b56131","unresolved":false,"context_lines":[{"line_number":1216,"context_line":"            msg \u003d (\"Created resource class record via placement API for \""},{"line_number":1217,"context_line":"                   \"resource class %s.\")"},{"line_number":1218,"context_line":"            LOG.info(msg, name)"},{"line_number":1219,"context_line":"        elif resp.status_code \u003d\u003d 409:"},{"line_number":1220,"context_line":"            # Another thread concurrently created a resource class with the"},{"line_number":1221,"context_line":"            # same name. Log a warning and then just return"},{"line_number":1222,"context_line":"            msg \u003d (\"Another thread already created a resource class with the \""},{"line_number":1223,"context_line":"                   \"name %s. Returning.\")"},{"line_number":1224,"context_line":"            LOG.info(msg, name)"},{"line_number":1225,"context_line":"        else:"},{"line_number":1226,"context_line":"            msg \u003d (\"Failed to create resource class %(resource_class)s in \""},{"line_number":1227,"context_line":"                   \"placement API. Got %(status_code)d: %(err_text)s.\")"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa0c359_0bacb48a","side":"PARENT","line":1224,"range":{"start_line":1219,"start_character":0,"end_line":1224,"end_character":31},"updated":"2018-02-05 18:05:55.000000000","message":"This is an important no-raise-exception block that is missing in the new code. Would you mind returning this block, since if another thread added a resource class, we don\u0027t need to raise InvalidResourceClass. We can just continue...","commit_id":"16cb9c1b3810e5038fb876d6e98e0a51afe68cd0"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"acc4361332ebca43c7743e30026f7a63ee61e315","unresolved":false,"context_lines":[{"line_number":1216,"context_line":"            msg \u003d (\"Created resource class record via placement API for \""},{"line_number":1217,"context_line":"                   \"resource class %s.\")"},{"line_number":1218,"context_line":"            LOG.info(msg, name)"},{"line_number":1219,"context_line":"        elif resp.status_code \u003d\u003d 409:"},{"line_number":1220,"context_line":"            # Another thread concurrently created a resource class with the"},{"line_number":1221,"context_line":"            # same name. Log a warning and then just return"},{"line_number":1222,"context_line":"            msg \u003d (\"Another thread already created a resource class with the \""},{"line_number":1223,"context_line":"                   \"name %s. Returning.\")"},{"line_number":1224,"context_line":"            LOG.info(msg, name)"},{"line_number":1225,"context_line":"        else:"},{"line_number":1226,"context_line":"            msg \u003d (\"Failed to create resource class %(resource_class)s in \""},{"line_number":1227,"context_line":"                   \"placement API. Got %(status_code)d: %(err_text)s.\")"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa0c359_6e8546ad","side":"PARENT","line":1224,"range":{"start_line":1219,"start_character":0,"end_line":1224,"end_character":31},"in_reply_to":"3fa0c359_0bacb48a","updated":"2018-02-05 18:56:19.000000000","message":"That behavior is limited to pre-1.7.  At 1.7, PUTting an already-extant resource class returns 204 [1].  (Unless you\u0027re saying we can generate a 409 if multiple threads hit the server code at the same time, which would be an API bug.)\n\n[1] https://developer.openstack.org/api-ref/placement/#update-resource-class","commit_id":"16cb9c1b3810e5038fb876d6e98e0a51afe68cd0"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f8532b59b8b88f933cdd70cbdf54a0fb37daaf1c","unresolved":false,"context_lines":[{"line_number":1216,"context_line":"            msg \u003d (\"Created resource class record via placement API for \""},{"line_number":1217,"context_line":"                   \"resource class %s.\")"},{"line_number":1218,"context_line":"            LOG.info(msg, name)"},{"line_number":1219,"context_line":"        elif resp.status_code \u003d\u003d 409:"},{"line_number":1220,"context_line":"            # Another thread concurrently created a resource class with the"},{"line_number":1221,"context_line":"            # same name. Log a warning and then just return"},{"line_number":1222,"context_line":"            msg \u003d (\"Another thread already created a resource class with the \""},{"line_number":1223,"context_line":"                   \"name %s. Returning.\")"},{"line_number":1224,"context_line":"            LOG.info(msg, name)"},{"line_number":1225,"context_line":"        else:"},{"line_number":1226,"context_line":"            msg \u003d (\"Failed to create resource class %(resource_class)s in \""},{"line_number":1227,"context_line":"                   \"placement API. Got %(status_code)d: %(err_text)s.\")"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa0c359_0eab621d","side":"PARENT","line":1224,"range":{"start_line":1219,"start_character":0,"end_line":1224,"end_character":31},"in_reply_to":"3fa0c359_6e8546ad","updated":"2018-02-05 18:57:29.000000000","message":"Gah, right you are. Thanks!","commit_id":"16cb9c1b3810e5038fb876d6e98e0a51afe68cd0"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"e78bde495653be7a379f2d8aefc5cca80a34a3be","unresolved":false,"context_lines":[{"line_number":1061,"context_line":"            rp_uuid, rp_name, parent_provider_uuid\u003dparent_provider_uuid)"},{"line_number":1062,"context_line":""},{"line_number":1063,"context_line":"        # Auto-create custom resource classes coming from a virt driver"},{"line_number":1064,"context_line":"        self._ensure_resource_classes(set(inv_data))"},{"line_number":1065,"context_line":""},{"line_number":1066,"context_line":"        if inv_data:"},{"line_number":1067,"context_line":"            self._update_inventory(rp_uuid, inv_data)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa0c359_762429c7","line":1064,"range":{"start_line":1064,"start_character":8,"end_line":1064,"end_character":52},"updated":"2018-02-06 09:14:59.000000000","message":"In the \u0027self._update_inentory\u0027, there is check about whether the inventory needs to be updated. We can move this after that check. Then we can save the useless PUT call.\n\nAt least, it is easier than the case I said at line 1237","commit_id":"df144573247eba99f1760acddfa072b0b84987cc"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"dd3666f18d38f783e891372cdf5adab2109efd21","unresolved":false,"context_lines":[{"line_number":1061,"context_line":"            rp_uuid, rp_name, parent_provider_uuid\u003dparent_provider_uuid)"},{"line_number":1062,"context_line":""},{"line_number":1063,"context_line":"        # Auto-create custom resource classes coming from a virt driver"},{"line_number":1064,"context_line":"        self._ensure_resource_classes(set(inv_data))"},{"line_number":1065,"context_line":""},{"line_number":1066,"context_line":"        if inv_data:"},{"line_number":1067,"context_line":"            self._update_inventory(rp_uuid, inv_data)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa0c359_6ce215d8","line":1064,"range":{"start_line":1064,"start_character":8,"end_line":1064,"end_character":52},"in_reply_to":"3fa0c359_762429c7","updated":"2018-02-06 16:47:47.000000000","message":"I agree in principle.  But...\n\nI don\u0027t want to move the _ensure_resource_classes all the way down into _update_inventory_attempt, because then it gets run on every attempt.  Which, if caching resource classes were practical, might be okay, but it isn\u0027t - see below.\n\nAnd we don\u0027t want to do\n\n self._provider_tree.has_inventory_changed(inv_data)\n\nhere, because we\u0027re not sure if the cache is current - the _refresh_and_get_inventory within _update_inventory_attempt is what does that for us.\n\nAt some point in the near future, I would like to do a refactor of a lot of the code in this module to provide more consistency for things like this.  For now, though, I\u0027m just trying to solve one problem in the simplest way.","commit_id":"df144573247eba99f1760acddfa072b0b84987cc"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"e78bde495653be7a379f2d8aefc5cca80a34a3be","unresolved":false,"context_lines":[{"line_number":1233,"context_line":""},{"line_number":1234,"context_line":"        for name in to_ensure:"},{"line_number":1235,"context_line":"            # no payload on the put request"},{"line_number":1236,"context_line":"            resp \u003d self.put(\"/resource_classes/%s\" % name, None,"},{"line_number":1237,"context_line":"                            version\u003dversion)"},{"line_number":1238,"context_line":"            if not resp:"},{"line_number":1239,"context_line":"                msg \u003d (\"Failed to ensure resource class record with placement \""},{"line_number":1240,"context_line":"                       \"API for resource class %(rc_name)s. Got \""}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa0c359_76f9897e","line":1237,"range":{"start_line":1236,"start_character":12,"end_line":1237,"end_character":44},"updated":"2018-02-06 09:14:59.000000000","message":"It\u0027s good to cache the custom RC we validated. It is waste to do that every time.","commit_id":"df144573247eba99f1760acddfa072b0b84987cc"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"dd3666f18d38f783e891372cdf5adab2109efd21","unresolved":false,"context_lines":[{"line_number":1233,"context_line":""},{"line_number":1234,"context_line":"        for name in to_ensure:"},{"line_number":1235,"context_line":"            # no payload on the put request"},{"line_number":1236,"context_line":"            resp \u003d self.put(\"/resource_classes/%s\" % name, None,"},{"line_number":1237,"context_line":"                            version\u003dversion)"},{"line_number":1238,"context_line":"            if not resp:"},{"line_number":1239,"context_line":"                msg \u003d (\"Failed to ensure resource class record with placement \""},{"line_number":1240,"context_line":"                       \"API for resource class %(rc_name)s. Got \""}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa0c359_4cbcf9db","line":1237,"range":{"start_line":1236,"start_character":12,"end_line":1237,"end_character":44},"in_reply_to":"3fa0c359_76f9897e","updated":"2018-02-06 16:47:47.000000000","message":"I started off with a solution that did caching, but gave up on it for a couple of reasons.\n\nIn this case, the main problem is that we can\u0027t know whether some other agent (another thread, another process, a CLI user, whatever) deleted the custom RC since the last time we executed this code.\n\nI\u0027m also working with the cdent philosophy that we shouldn\u0027t implement optimizations preemptively - we should wait until there\u0027s actually a demonstrated problem.","commit_id":"df144573247eba99f1760acddfa072b0b84987cc"},{"author":{"_account_id":6167,"name":"Ken\u0027ichi Ohmichi","email":"ken1ohmichi@gmail.com","username":"oomichi"},"change_message_id":"99307cc5f202e00e0bc2ad009f79171f4750cdc0","unresolved":false,"context_lines":[{"line_number":1220,"context_line":"            resp \u003d self.put("},{"line_number":1221,"context_line":"                \"/resource_classes/%s\" % name, None, version\u003dversion,"},{"line_number":1222,"context_line":"                global_request_id\u003dcontext.global_id)"},{"line_number":1223,"context_line":"            if not resp:"},{"line_number":1224,"context_line":"                msg \u003d (\"Failed to ensure resource class record with placement \""},{"line_number":1225,"context_line":"                       \"API for resource class %(rc_name)s. Got \""},{"line_number":1226,"context_line":"                       \"%(status_code)d: %(err_text)s.\")"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa0c359_cab5db33","line":1223,"range":{"start_line":1223,"start_character":12,"end_line":1223,"end_character":24},"updated":"2018-02-10 02:54:50.000000000","message":"I am not sure this change from the response status code check.\nThere is the same check way in this report.py and maybe this is not matter.\nI just want to know we will change this kind of change like this.","commit_id":"02a1551f6455792ee050d6009c94514402b7df04"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"e0b24f7651add842a422abdf12480df2851fc224","unresolved":false,"context_lines":[{"line_number":1220,"context_line":"            resp \u003d self.put("},{"line_number":1221,"context_line":"                \"/resource_classes/%s\" % name, None, version\u003dversion,"},{"line_number":1222,"context_line":"                global_request_id\u003dcontext.global_id)"},{"line_number":1223,"context_line":"            if not resp:"},{"line_number":1224,"context_line":"                msg \u003d (\"Failed to ensure resource class record with placement \""},{"line_number":1225,"context_line":"                       \"API for resource class %(rc_name)s. Got \""},{"line_number":1226,"context_line":"                       \"%(status_code)d: %(err_text)s.\")"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa0c359_8b06eb1b","line":1223,"range":{"start_line":1223,"start_character":12,"end_line":1223,"end_character":24},"in_reply_to":"3fa0c359_cab5db33","updated":"2018-02-11 21:34:53.000000000","message":"Response overrides __bool__ to return False on failing status codes.  Basically this condition just says \"on failure:\".  It\u0027s a common idiom (though I only recently learned about it) and as you noted, it\u0027s the same one we\u0027re using elsewhere.","commit_id":"02a1551f6455792ee050d6009c94514402b7df04"}],"nova/tests/functional/api/openstack/placement/test_report_client.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f0747e00b0ef0fad2dfcf4d9db96ce11ccaa3e5a","unresolved":false,"context_lines":[{"line_number":255,"context_line":"            self.client.update_compute_node(self.context, self.compute_node)"},{"line_number":256,"context_line":"            # Simulate that our locally-running code has an outdated notion of"},{"line_number":257,"context_line":"            # standard resource classes."},{"line_number":258,"context_line":"            with mock.patch.object(fields.ResourceClass, \u0027STANDARD\u0027,"},{"line_number":259,"context_line":"                                   (\u0027VCPU\u0027, \u0027MEMORY_MB\u0027, \u0027DISK_GB\u0027)):"},{"line_number":260,"context_line":"                self.client.set_inventory_for_provider("},{"line_number":261,"context_line":"                    self.context, self.compute_uuid, self.compute_name, inv)"},{"line_number":262,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_1f52f03b","line":259,"range":{"start_line":258,"start_character":0,"end_line":259,"end_character":69},"updated":"2018-02-01 17:46:04.000000000","message":"This mock can be removed entirely since the fields.ResourceClass.STANDARD attribute is no longer utilized.","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"e8758a42c3619ca3fb500935d5abc59f78d99748","unresolved":false,"context_lines":[{"line_number":255,"context_line":"            self.client.update_compute_node(self.context, self.compute_node)"},{"line_number":256,"context_line":"            # Simulate that our locally-running code has an outdated notion of"},{"line_number":257,"context_line":"            # standard resource classes."},{"line_number":258,"context_line":"            with mock.patch.object(fields.ResourceClass, \u0027STANDARD\u0027,"},{"line_number":259,"context_line":"                                   (\u0027VCPU\u0027, \u0027MEMORY_MB\u0027, \u0027DISK_GB\u0027)):"},{"line_number":260,"context_line":"                self.client.set_inventory_for_provider("},{"line_number":261,"context_line":"                    self.context, self.compute_uuid, self.compute_name, inv)"},{"line_number":262,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_32904395","line":259,"range":{"start_line":258,"start_character":0,"end_line":259,"end_character":69},"in_reply_to":"5f93b717_1f52f03b","updated":"2018-02-01 18:22:13.000000000","message":"Hmm, true, but then how do I demonstrate that we\u0027ve actually done anything here?\n\nPut another way, if you take the mock out and then take the fix away, the test passes.","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"98f797e1ab2952c9057fa14958c3abb038b5a173","unresolved":false,"context_lines":[{"line_number":255,"context_line":"            self.client.update_compute_node(self.context, self.compute_node)"},{"line_number":256,"context_line":"            # Simulate that our locally-running code has an outdated notion of"},{"line_number":257,"context_line":"            # standard resource classes."},{"line_number":258,"context_line":"            with mock.patch.object(fields.ResourceClass, \u0027STANDARD\u0027,"},{"line_number":259,"context_line":"                                   (\u0027VCPU\u0027, \u0027MEMORY_MB\u0027, \u0027DISK_GB\u0027)):"},{"line_number":260,"context_line":"                self.client.set_inventory_for_provider("},{"line_number":261,"context_line":"                    self.context, self.compute_uuid, self.compute_name, inv)"},{"line_number":262,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_d23c7fe2","line":259,"range":{"start_line":258,"start_character":0,"end_line":259,"end_character":69},"in_reply_to":"5f93b717_32904395","updated":"2018-02-01 18:24:56.000000000","message":"You need to mock out the return from reportclient.get(\u0027/resource_classes\u0027).","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8949919c57484f9af2407a7dd47dc824fea7b2d2","unresolved":false,"context_lines":[{"line_number":255,"context_line":"            self.client.update_compute_node(self.context, self.compute_node)"},{"line_number":256,"context_line":"            # Simulate that our locally-running code has an outdated notion of"},{"line_number":257,"context_line":"            # standard resource classes."},{"line_number":258,"context_line":"            with mock.patch.object(fields.ResourceClass, \u0027STANDARD\u0027,"},{"line_number":259,"context_line":"                                   (\u0027VCPU\u0027, \u0027MEMORY_MB\u0027, \u0027DISK_GB\u0027)):"},{"line_number":260,"context_line":"                self.client.set_inventory_for_provider("},{"line_number":261,"context_line":"                    self.context, self.compute_uuid, self.compute_name, inv)"},{"line_number":262,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_b9ec18bb","line":259,"range":{"start_line":258,"start_character":0,"end_line":259,"end_character":69},"in_reply_to":"5f93b717_d23c7fe2","updated":"2018-02-02 23:39:28.000000000","message":"To what?  The whole point is that reportclient.get(\u0027/resource_classes\u0027) returns *placement\u0027s* idea of what resource classes are there, which needs to *include* the PCI_DEVICE class we were deliberately failing on before.  And if I mock it to return that guy, it\u0027s like not having mocked it at all.","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"},{"author":{"_account_id":6167,"name":"Ken\u0027ichi Ohmichi","email":"ken1ohmichi@gmail.com","username":"oomichi"},"change_message_id":"99307cc5f202e00e0bc2ad009f79171f4750cdc0","unresolved":false,"context_lines":[{"line_number":278,"context_line":"            # standard resource classes."},{"line_number":279,"context_line":"            with mock.patch.object(fields.ResourceClass, \u0027STANDARD\u0027,"},{"line_number":280,"context_line":"                                   (\u0027VCPU\u0027, \u0027MEMORY_MB\u0027, \u0027DISK_GB\u0027)):"},{"line_number":281,"context_line":"                # TODO(efried): Once bug #1746615 is fixed, this will no longer"},{"line_number":282,"context_line":"                # raise, and can be replaced with:"},{"line_number":283,"context_line":"                # self.client.set_inventory_for_provider("},{"line_number":284,"context_line":"                #     self.context, self.compute_uuid, self.compute_name, inv)"},{"line_number":285,"context_line":"                self.assertRaises("}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa0c359_4a7b0b7a","side":"PARENT","line":282,"range":{"start_line":281,"start_character":0,"end_line":282,"end_character":50},"updated":"2018-02-10 02:54:50.000000000","message":"Nice change :)","commit_id":"ecfbf1fcdf5b7317e5a5a2d19e71ac0c9b635eee"}],"nova/tests/unit/scheduler/client/test_report.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f0747e00b0ef0fad2dfcf4d9db96ce11ccaa3e5a","unresolved":false,"context_lines":[{"line_number":3588,"context_line":"        self.mock_get.assert_called_once_with(\u0027/resource_classes\u0027)"},{"line_number":3589,"context_line":"        # Only called with the \"unknown\" one"},{"line_number":3590,"context_line":"        self.mock_put.assert_called_once_with("},{"line_number":3591,"context_line":"            \u0027/resource_classes/FOO\u0027, None, version\u003d\u00271.7\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f93b717_9f2280b8","line":3591,"updated":"2018-02-01 17:46:04.000000000","message":"good test cleanups in here, ++","commit_id":"b233e9d3b6eba79adcf605c91bdfa0585331debe"}]}
