)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"74abd590bfcb1ab7bcad7af407a43c2d821f6598","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Sudipta Biswas \u003csbiswas7@in.ibm.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2015-08-17 11:18:07 +0530"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Fix host_mamager to use monitor metric objects"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Per bug 1468012 we changed the monitor metric reporting"},{"line_number":10,"context_line":"to use versioned Monitor Metric objects instead of plain"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"fa1b9901_a1745dcf","line":7,"updated":"2015-08-17 14:33:35.000000000","message":"s/mamager/manager/ :)","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"d45c95c4d5dae6a94a13b2a8ccd48ab334b55690","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Sudipta Biswas \u003csbiswas7@in.ibm.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2015-08-17 11:18:07 +0530"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Fix host_mamager to use monitor metric objects"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Per bug 1468012 we changed the monitor metric reporting"},{"line_number":10,"context_line":"to use versioned Monitor Metric objects instead of plain"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"fa1b9901_53e39033","line":7,"in_reply_to":"fa1b9901_a1745dcf","updated":"2015-08-18 18:42:03.000000000","message":"Done","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"74abd590bfcb1ab7bcad7af407a43c2d821f6598","unresolved":false,"context_lines":[{"line_number":15,"context_line":"_update_metrics_from_compute_node to use the monitor metric object"},{"line_number":16,"context_line":"instead of the current non object implementation."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"This also fixes the existing Unit Tests."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Closes-bug: 1485082"},{"line_number":21,"context_line":"Change-Id: I4dfbea27ce6c3eecc1a8658b1f9dc0feb2298705"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"fa1b9901_617e45b0","line":18,"updated":"2015-08-17 14:33:35.000000000","message":"This line is not needed in the commit message :)","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"d45c95c4d5dae6a94a13b2a8ccd48ab334b55690","unresolved":false,"context_lines":[{"line_number":15,"context_line":"_update_metrics_from_compute_node to use the monitor metric object"},{"line_number":16,"context_line":"instead of the current non object implementation."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"This also fixes the existing Unit Tests."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Closes-bug: 1485082"},{"line_number":21,"context_line":"Change-Id: I4dfbea27ce6c3eecc1a8658b1f9dc0feb2298705"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"fa1b9901_d3cd60b8","line":18,"in_reply_to":"fa1b9901_617e45b0","updated":"2015-08-18 18:42:03.000000000","message":"Done","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"66a4c6228ba97e8639cf0fb0e9c1a29c495f09c7","unresolved":false,"context_lines":[{"line_number":15,"context_line":"_update_metrics_from_compute_node to use the monitor metric object"},{"line_number":16,"context_line":"instead of the current non object implementation."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Closes-bug: 1485082"},{"line_number":19,"context_line":"Change-Id: I4dfbea27ce6c3eecc1a8658b1f9dc0feb2298705"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"fa1b9901_00425fae","line":18,"updated":"2015-08-19 19:02:11.000000000","message":"This isn\u0027t really a bug IMO, it\u0027s just general goodness/cleanup.","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"ee6637eee2fffa0d3b0f5dabfac56978eb4663ed","unresolved":false,"context_lines":[{"line_number":15,"context_line":"_update_metrics_from_compute_node to use the monitor metric object"},{"line_number":16,"context_line":"instead of the current non object implementation."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Closes-bug: 1485082"},{"line_number":19,"context_line":"Change-Id: I4dfbea27ce6c3eecc1a8658b1f9dc0feb2298705"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"fa1b9901_5a5d9113","line":18,"in_reply_to":"fa1b9901_00425fae","updated":"2015-08-20 06:45:43.000000000","message":"Ok I followed the process of the previous bug which was also a re-factoring effort - but a more major one. \n\nCan we live with it or is it something you\u0027d definitely want changed?","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"}],"nova/objects/monitor_metric.py":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"5b9ea30f101635be7f90b5bdd6344f9c84ae04af","unresolved":false,"context_lines":[{"line_number":44,"context_line":"    # NOTE(sbiswas7): This method exists to return a metric object"},{"line_number":45,"context_line":"    # whenever a dict is passed with the required keys mostly as a utility."},{"line_number":46,"context_line":"    @classmethod"},{"line_number":47,"context_line":"    def create_metric_obj(cls, metric_dict):"},{"line_number":48,"context_line":"        membw_key \u003d \"numa_membw_values\""},{"line_number":49,"context_line":"        if membw_key in metric_dict.keys():"},{"line_number":50,"context_line":"            return MonitorMetric(name\u003dmetric_dict[\u0027name\u0027],"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_5748a35b","line":47,"updated":"2015-08-17 13:56:24.000000000","message":"Why not create member \u0027from_list\u0027 for MonitorMetricList, and from_dict for MonitorMetric, as we already have to_list and to_dict.","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"74abd590bfcb1ab7bcad7af407a43c2d821f6598","unresolved":false,"context_lines":[{"line_number":55,"context_line":"        return MonitorMetric(name\u003dmetric_dict[\u0027name\u0027],"},{"line_number":56,"context_line":"                             value\u003dmetric_dict[\u0027value\u0027],"},{"line_number":57,"context_line":"                             timestamp\u003dmetric_dict[\u0027timestamp\u0027],"},{"line_number":58,"context_line":"                             source\u003dmetric_dict[\u0027source\u0027])"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"},{"line_number":61,"context_line":"    # format expected by the RPC notifier for metrics events."}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_55e73b40","line":58,"updated":"2015-08-17 14:33:35.000000000","message":"I don\u0027t actually think this should be a @classmethod. I think it should be a private module-level function called \"_monitor_metric_from_legacy_dict()\", and there should instead by a @classmethod on MonitorMetricList called \"from_legacy_json()\" that takes the legacy JSON string and returns a MonitorMetricList object with MonitorMetric objects by using the obj_make_list() base method.","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"d45c95c4d5dae6a94a13b2a8ccd48ab334b55690","unresolved":false,"context_lines":[{"line_number":55,"context_line":"        return MonitorMetric(name\u003dmetric_dict[\u0027name\u0027],"},{"line_number":56,"context_line":"                             value\u003dmetric_dict[\u0027value\u0027],"},{"line_number":57,"context_line":"                             timestamp\u003dmetric_dict[\u0027timestamp\u0027],"},{"line_number":58,"context_line":"                             source\u003dmetric_dict[\u0027source\u0027])"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"},{"line_number":61,"context_line":"    # format expected by the RPC notifier for metrics events."}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_73c5748c","line":58,"in_reply_to":"fa1b9901_55e73b40","updated":"2015-08-18 18:42:03.000000000","message":"Done","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"c2901c7cece82bac0d649e32653b56c5828a9b10","unresolved":false,"context_lines":[{"line_number":89,"context_line":"def _monitor_metric_from_legacy_dict(metric_dict):"},{"line_number":90,"context_line":"    membw_key \u003d \"numa_membw_values\""},{"line_number":91,"context_line":"    if membw_key in metric_dict.keys():"},{"line_number":92,"context_line":"        return MonitorMetric(name\u003dmetric_dict[\u0027name\u0027],"},{"line_number":93,"context_line":"                             numa_membw_values\u003dmetric_dict[membw_key],"},{"line_number":94,"context_line":"                             timestamp\u003dmetric_dict[\u0027timestamp\u0027],"},{"line_number":95,"context_line":"                             source\u003dmetric_dict[\u0027source\u0027])"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa1b9901_6906bccf","line":92,"updated":"2015-08-19 13:29:50.000000000","message":"I think having the 2 different return statements in here is hard to read. You should just build up a dict of kwargs from the metric_dict, check for \u0027numa_membw_values\u0027 and add it to kwargs if it exists, and then just return MonitorMetric(**kwargs)","commit_id":"8ca6b0d2f3556f6efef159f88bca3f2d20159535"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"66a4c6228ba97e8639cf0fb0e9c1a29c495f09c7","unresolved":false,"context_lines":[{"line_number":76,"context_line":"    }"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    @classmethod"},{"line_number":79,"context_line":"    def from_legacy_json(cls, leg_dict):"},{"line_number":80,"context_line":"        metrics \u003d jsonutils.loads(leg_dict) if leg_dict else []"},{"line_number":81,"context_line":"        metric_list \u003d ["},{"line_number":82,"context_line":"            MonitorMetric(**metric) for metric in metrics]"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_e072cb10","line":79,"updated":"2015-08-19 19:02:11.000000000","message":"Don\u0027t we usually just call this type of helper from_dict elsewhere?  There are 3 other objects that have a from_dict method.  We should be consistent.\n\nI guess maybe it\u0027s the parameter that\u0027s confusing, if it\u0027s a json string, then leg_dict is an odd name.  Maybe it should be called json_metric_list?","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"ee6637eee2fffa0d3b0f5dabfac56978eb4663ed","unresolved":false,"context_lines":[{"line_number":76,"context_line":"    }"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    @classmethod"},{"line_number":79,"context_line":"    def from_legacy_json(cls, leg_dict):"},{"line_number":80,"context_line":"        metrics \u003d jsonutils.loads(leg_dict) if leg_dict else []"},{"line_number":81,"context_line":"        metric_list \u003d ["},{"line_number":82,"context_line":"            MonitorMetric(**metric) for metric in metrics]"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_acb35b99","line":79,"in_reply_to":"fa1b9901_01e33e34","updated":"2015-08-20 06:45:43.000000000","message":"Hi Sylvain, self.metrics \u003d {} is done initially and then the code in _update_metrics_* actually overwrites that variable with a list - hence it works IMHO. However, I agree, that there\u0027s a need to better handle this - because otherwise the metric_filter will not work. Thanks for pointing this out!! :)","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"acd404f85600930fc94128f6fdde122175a8d839","unresolved":false,"context_lines":[{"line_number":76,"context_line":"    }"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    @classmethod"},{"line_number":79,"context_line":"    def from_legacy_json(cls, leg_dict):"},{"line_number":80,"context_line":"        metrics \u003d jsonutils.loads(leg_dict) if leg_dict else []"},{"line_number":81,"context_line":"        metric_list \u003d ["},{"line_number":82,"context_line":"            MonitorMetric(**metric) for metric in metrics]"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_565a612b","line":79,"in_reply_to":"fa1b9901_1b3ad4cc","updated":"2015-08-19 19:24:36.000000000","message":"And because the testing here is so shoddy that\u0027s why this wasn\u0027t caught, the FakeHostState stuff completely stubs this all out:\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/nova/tests/unit/scheduler/filters/test_metrics_filters.py#n24","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"9d8bd26cf9295df4d0805e39a39ec601526b260b","unresolved":false,"context_lines":[{"line_number":76,"context_line":"    }"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    @classmethod"},{"line_number":79,"context_line":"    def from_legacy_json(cls, leg_dict):"},{"line_number":80,"context_line":"        metrics \u003d jsonutils.loads(leg_dict) if leg_dict else []"},{"line_number":81,"context_line":"        metric_list \u003d ["},{"line_number":82,"context_line":"            MonitorMetric(**metric) for metric in metrics]"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_01e33e34","line":79,"in_reply_to":"fa1b9901_565a612b","updated":"2015-08-19 21:28:44.000000000","message":"Well, the problem is rather that the coverage of https://github.com/openstack/nova/blob/master/nova/scheduler/host_manager.py#L168 is really poor here :\nhttps://github.com/openstack/nova/blob/master/nova/tests/unit/scheduler/test_host_manager.py#L985-L990","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"ee6637eee2fffa0d3b0f5dabfac56978eb4663ed","unresolved":false,"context_lines":[{"line_number":76,"context_line":"    }"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    @classmethod"},{"line_number":79,"context_line":"    def from_legacy_json(cls, leg_dict):"},{"line_number":80,"context_line":"        metrics \u003d jsonutils.loads(leg_dict) if leg_dict else []"},{"line_number":81,"context_line":"        metric_list \u003d ["},{"line_number":82,"context_line":"            MonitorMetric(**metric) for metric in metrics]"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_2c4c2bc7","line":79,"in_reply_to":"fa1b9901_565a612b","updated":"2015-08-20 06:45:43.000000000","message":"Yeah this completely missed my radar - possibly because of the shoddy tests in the test_metrics_filter. \n\nThis implies that we should make the required change in the metrics_filter.py \nI will do that in the next PS.","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5b3044d032b64e734b630bf76dbed9524d40aa54","unresolved":false,"context_lines":[{"line_number":76,"context_line":"    }"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    @classmethod"},{"line_number":79,"context_line":"    def from_legacy_json(cls, leg_dict):"},{"line_number":80,"context_line":"        metrics \u003d jsonutils.loads(leg_dict) if leg_dict else []"},{"line_number":81,"context_line":"        metric_list \u003d ["},{"line_number":82,"context_line":"            MonitorMetric(**metric) for metric in metrics]"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_1b3ad4cc","line":79,"in_reply_to":"fa1b9901_e072cb10","updated":"2015-08-19 19:03:59.000000000","message":"I would probably just have:\n\ndef from_json(cls, metrics):\n   ...\n\nBonus points for adding docstring for the method to describe what it does along with what the inputs and outputs are.","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b892206f5c2f435688c5240e71332414cb4a471a","unresolved":false,"context_lines":[{"line_number":81,"context_line":"        and finally returns of MonitorMetricList"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"        :param metrics: a list of json objects"},{"line_number":84,"context_line":"        :returns: a list of MonitorMetric Objects."},{"line_number":85,"context_line":"        \"\"\""},{"line_number":86,"context_line":"        metrics \u003d jsonutils.loads(metrics) if metrics else []"},{"line_number":87,"context_line":"        metric_list \u003d ["}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_0e265068","line":84,"updated":"2015-08-24 17:48:50.000000000","message":"This returns a MonitorMetricList, not a list of MonitorMetric objects :)","commit_id":"bc73445942e43ab67b04a4efb5d94b521f500c5a"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"c60b90c31ecea5f1c4482b6e1df40aaf9a7e8de8","unresolved":false,"context_lines":[{"line_number":81,"context_line":"        and finally returns of MonitorMetricList"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"        :param metrics: a list of json objects"},{"line_number":84,"context_line":"        :returns: a list of MonitorMetric Objects."},{"line_number":85,"context_line":"        \"\"\""},{"line_number":86,"context_line":"        metrics \u003d jsonutils.loads(metrics) if metrics else []"},{"line_number":87,"context_line":"        metric_list \u003d ["}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_9fa4c908","line":84,"in_reply_to":"fa1b9901_0e265068","updated":"2015-08-24 18:23:53.000000000","message":"Yikes. Will do.","commit_id":"bc73445942e43ab67b04a4efb5d94b521f500c5a"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"d0410d062ef60c2007d93b88f769cb56654f7461","unresolved":false,"context_lines":[{"line_number":80,"context_line":"        \"\"\"Converts a legacy json object into a list of MonitorMetric objs"},{"line_number":81,"context_line":"        and finally returns of MonitorMetricList"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"        :param metrics: a list of json objects"},{"line_number":84,"context_line":"        :returns: a MonitorMetricList Object."},{"line_number":85,"context_line":"        \"\"\""},{"line_number":86,"context_line":"        metrics \u003d jsonutils.loads(metrics) if metrics else []"}],"source_content_type":"text/x-python","patch_set":13,"id":"fa1b9901_0a071582","line":83,"updated":"2015-08-24 18:58:48.000000000","message":"Technically, the parameter is a string of JSON-serialized objects, but OK :)","commit_id":"8b274c4e45411b134e5e93af432e11ac4058b972"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"4b51b737540cf1a3fa6a9f0c6875364f6656cb92","unresolved":false,"context_lines":[{"line_number":80,"context_line":"        \"\"\"Converts a legacy json object into a list of MonitorMetric objs"},{"line_number":81,"context_line":"        and finally returns of MonitorMetricList"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"        :param metrics: a list of json objects"},{"line_number":84,"context_line":"        :returns: a MonitorMetricList Object."},{"line_number":85,"context_line":"        \"\"\""},{"line_number":86,"context_line":"        metrics \u003d jsonutils.loads(metrics) if metrics else []"}],"source_content_type":"text/x-python","patch_set":13,"id":"fa1b9901_4ae0ad96","line":83,"in_reply_to":"fa1b9901_0a071582","updated":"2015-08-24 19:15:47.000000000","message":"Done","commit_id":"8b274c4e45411b134e5e93af432e11ac4058b972"}],"nova/scheduler/filters/metrics_filter.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b892206f5c2f435688c5240e71332414cb4a471a","unresolved":false,"context_lines":[{"line_number":47,"context_line":"        metric_list \u003d host_state.metrics"},{"line_number":48,"context_line":"        unavail \u003d ["},{"line_number":49,"context_line":"            i for i, metric in zip(self.keys, metric_list) if i !\u003d metric.name]"},{"line_number":50,"context_line":"        if unavail:"},{"line_number":51,"context_line":"            LOG.debug(\"%(host_state)s does not have the following \""},{"line_number":52,"context_line":"                        \"metrics: %(metrics)s\","},{"line_number":53,"context_line":"                      {\u0027host_state\u0027: host_state,"}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_59a89177","line":50,"updated":"2015-08-24 17:48:50.000000000","message":"The above is kinda, well, ugly :)\n\nHow about this instead?\n\nFirst change self.keys to be a set():\n\n self.keys \u003d set(x[0] for x in opts)\n\nThen here, do:\n\n metrics_on_host \u003d set(m.name for m in host_state.metrics)\n if not self.keys.issubset(metrics_on_host):\n     unavail \u003d metrics_on_host - self.keys\n     ...","commit_id":"bc73445942e43ab67b04a4efb5d94b521f500c5a"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"c60b90c31ecea5f1c4482b6e1df40aaf9a7e8de8","unresolved":false,"context_lines":[{"line_number":47,"context_line":"        metric_list \u003d host_state.metrics"},{"line_number":48,"context_line":"        unavail \u003d ["},{"line_number":49,"context_line":"            i for i, metric in zip(self.keys, metric_list) if i !\u003d metric.name]"},{"line_number":50,"context_line":"        if unavail:"},{"line_number":51,"context_line":"            LOG.debug(\"%(host_state)s does not have the following \""},{"line_number":52,"context_line":"                        \"metrics: %(metrics)s\","},{"line_number":53,"context_line":"                      {\u0027host_state\u0027: host_state,"}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_64b0488c","line":50,"in_reply_to":"fa1b9901_59a89177","updated":"2015-08-24 18:23:53.000000000","message":"Sure :) I was actually willing to make that change using sets but then i just followed the ugly code that was there before :)","commit_id":"bc73445942e43ab67b04a4efb5d94b521f500c5a"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"d0410d062ef60c2007d93b88f769cb56654f7461","unresolved":false,"context_lines":[{"line_number":48,"context_line":"        unavail \u003d set()"},{"line_number":49,"context_line":"        if not self.keys.issubset(metrics_on_host):"},{"line_number":50,"context_line":"            unavail \u003d metrics_on_host - self.keys"},{"line_number":51,"context_line":"        if unavail:"},{"line_number":52,"context_line":"            LOG.debug(\"%(host_state)s does not have the following \""},{"line_number":53,"context_line":"                        \"metrics: %(metrics)s\","},{"line_number":54,"context_line":"                      {\u0027host_state\u0027: host_state,"}],"source_content_type":"text/x-python","patch_set":13,"id":"fa1b9901_2a49b9d0","line":51,"updated":"2015-08-24 18:58:48.000000000","message":"You can just remove line 51 and line 48...","commit_id":"8b274c4e45411b134e5e93af432e11ac4058b972"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"4b51b737540cf1a3fa6a9f0c6875364f6656cb92","unresolved":false,"context_lines":[{"line_number":48,"context_line":"        unavail \u003d set()"},{"line_number":49,"context_line":"        if not self.keys.issubset(metrics_on_host):"},{"line_number":50,"context_line":"            unavail \u003d metrics_on_host - self.keys"},{"line_number":51,"context_line":"        if unavail:"},{"line_number":52,"context_line":"            LOG.debug(\"%(host_state)s does not have the following \""},{"line_number":53,"context_line":"                        \"metrics: %(metrics)s\","},{"line_number":54,"context_line":"                      {\u0027host_state\u0027: host_state,"}],"source_content_type":"text/x-python","patch_set":13,"id":"fa1b9901_4515fee2","line":51,"in_reply_to":"fa1b9901_2a49b9d0","updated":"2015-08-24 19:15:47.000000000","message":"If i remove line 48 - then line 56 will give an error about reference before assignment right?","commit_id":"8b274c4e45411b134e5e93af432e11ac4058b972"}],"nova/scheduler/host_manager.py":[{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"56f937d3b69ffac4339fa6c80bee4537bb8f65b6","unresolved":false,"context_lines":[{"line_number":178,"context_line":"            # NOTE(sbiswas7): The objects impose the mandatory field values"},{"line_number":179,"context_line":"            # now to ensure we don\u0027t have a keyerror"},{"line_number":180,"context_line":"            if membw_key in metric.keys():"},{"line_number":181,"context_line":"                obj \u003d objects.MonitorMetric(name\u003dmetric[\u0027name\u0027],"},{"line_number":182,"context_line":"                                            numa_membw_values\u003dmetric["},{"line_number":183,"context_line":"                                                membw_key],"},{"line_number":184,"context_line":"                                            timestamp\u003dmetric[\u0027timestamp\u0027],"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a4dcd0f_47068686","line":181,"updated":"2015-08-14 20:05:03.000000000","message":"it feels like this should be a helper classmethod on MonitorMetric. That would help compress this down, and the MonitorMetric class can handle the difference in kwargs","commit_id":"1b66d18e1f9fc20c2faa27c5c7852ff53e51be80"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"4a907b84bbb684b4eca2f2fc2cbf8565d406b684","unresolved":false,"context_lines":[{"line_number":178,"context_line":"            # NOTE(sbiswas7): The objects impose the mandatory field values"},{"line_number":179,"context_line":"            # now to ensure we don\u0027t have a keyerror"},{"line_number":180,"context_line":"            if membw_key in metric.keys():"},{"line_number":181,"context_line":"                obj \u003d objects.MonitorMetric(name\u003dmetric[\u0027name\u0027],"},{"line_number":182,"context_line":"                                            numa_membw_values\u003dmetric["},{"line_number":183,"context_line":"                                                membw_key],"},{"line_number":184,"context_line":"                                            timestamp\u003dmetric[\u0027timestamp\u0027],"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a4dcd0f_f702c4b3","line":181,"in_reply_to":"1a4dcd0f_47068686","updated":"2015-08-16 17:30:11.000000000","message":"Tried something per this comment in PS4.","commit_id":"1b66d18e1f9fc20c2faa27c5c7852ff53e51be80"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"74abd590bfcb1ab7bcad7af407a43c2d821f6598","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        #            NULL in the metrics column"},{"line_number":173,"context_line":"        metrics \u003d compute.metrics or []"},{"line_number":174,"context_line":"        if metrics:"},{"line_number":175,"context_line":"            metrics \u003d jsonutils.loads(metrics)"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"        # NOTE(sbiswas7): The objects impose the mandatory field values"},{"line_number":178,"context_line":"        # now to ensure we don\u0027t have a keyerror"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_353c0793","line":175,"updated":"2015-08-17 14:33:35.000000000","message":"And this would just turn into:\n\n self.metrics \u003d objects.MonitorMetricList.from_legacy_json(metrics)\n\nand do the jsonutils.loads() inside of objects.MonitorMetricList.from_legacy_json()","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"d45c95c4d5dae6a94a13b2a8ccd48ab334b55690","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        #            NULL in the metrics column"},{"line_number":173,"context_line":"        metrics \u003d compute.metrics or []"},{"line_number":174,"context_line":"        if metrics:"},{"line_number":175,"context_line":"            metrics \u003d jsonutils.loads(metrics)"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"        # NOTE(sbiswas7): The objects impose the mandatory field values"},{"line_number":178,"context_line":"        # now to ensure we don\u0027t have a keyerror"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_f063ba18","line":175,"in_reply_to":"fa1b9901_353c0793","updated":"2015-08-18 18:42:03.000000000","message":"Done","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"c2901c7cece82bac0d649e32653b56c5828a9b10","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        #            NULL in the metrics column"},{"line_number":173,"context_line":"        metrics \u003d compute.metrics or []"},{"line_number":174,"context_line":"        if metrics:"},{"line_number":175,"context_line":"            metrics \u003d jsonutils.loads(metrics)"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"        # NOTE(sbiswas7): The objects impose the mandatory field values"},{"line_number":178,"context_line":"        # now to ensure we don\u0027t have a keyerror"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa1b9901_29ac449f","line":175,"updated":"2015-08-19 13:29:50.000000000","message":"As Jay mentioned before, move this loads into from_legacy_json()","commit_id":"8ca6b0d2f3556f6efef159f88bca3f2d20159535"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"66a4c6228ba97e8639cf0fb0e9c1a29c495f09c7","unresolved":false,"context_lines":[{"line_number":148,"context_line":"        # Resource oversubscription values for the compute host:"},{"line_number":149,"context_line":"        self.limits \u003d {}"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"        # Generic metrics from compute nodes"},{"line_number":152,"context_line":"        self.metrics \u003d {}"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":"        # List of aggregates the host belongs to"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_60155b47","line":151,"updated":"2015-08-19 19:02:11.000000000","message":"With the change below, you\u0027ve changed this variable from a dict to a list, which is not right if anything is consuming this as a dict with keys that are the metric names.","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"594f56d4fd0e60b0df7766afc9f8db33ea5abc3b","unresolved":false,"context_lines":[{"line_number":148,"context_line":"        # Resource oversubscription values for the compute host:"},{"line_number":149,"context_line":"        self.limits \u003d {}"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"        # Generic metrics from compute nodes"},{"line_number":152,"context_line":"        self.metrics \u003d {}"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":"        # List of aggregates the host belongs to"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_9b6a64ed","line":151,"in_reply_to":"fa1b9901_60155b47","updated":"2015-08-19 19:20:31.000000000","message":"Confirmed that this would break the metrics filter:\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/nova/scheduler/filters/metrics_filter.py#n47","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"66a4c6228ba97e8639cf0fb0e9c1a29c495f09c7","unresolved":false,"context_lines":[{"line_number":170,"context_line":"        #            returned from compute.get, because DB schema allows"},{"line_number":171,"context_line":"        #            NULL in the metrics column"},{"line_number":172,"context_line":"        metrics \u003d compute.metrics or []"},{"line_number":173,"context_line":"        # NOTE(sbiswas7): The objects impose the mandatory field values"},{"line_number":174,"context_line":"        # now to ensure we don\u0027t have a keyerror"},{"line_number":175,"context_line":"        self.metrics \u003d objects.MonitorMetricList.from_legacy_json(metrics)"},{"line_number":176,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_60b9db78","line":173,"updated":"2015-08-19 19:02:11.000000000","message":"This comment is probably good for the commit message but not necessarily needed in the code IMO.","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"aee937fadc202b3d75d345c25509b3b49d9c4d34","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        metrics \u003d compute.metrics or []"},{"line_number":173,"context_line":"        # NOTE(sbiswas7): The objects impose the mandatory field values"},{"line_number":174,"context_line":"        # now to ensure we don\u0027t have a keyerror"},{"line_number":175,"context_line":"        self.metrics \u003d objects.MonitorMetricList.from_legacy_json(metrics)"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    def update_from_compute_node(self, compute):"},{"line_number":178,"context_line":"        \"\"\"Update information about a host from a ComputeNode object.\"\"\""}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_9bda644b","line":175,"updated":"2015-08-19 19:09:12.000000000","message":"I\u0027d pass compute.metrics in here and let the utility method handle the or check and default to [] if compute.metrics is None or empty.","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"ee6637eee2fffa0d3b0f5dabfac56978eb4663ed","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        metrics \u003d compute.metrics or []"},{"line_number":173,"context_line":"        # NOTE(sbiswas7): The objects impose the mandatory field values"},{"line_number":174,"context_line":"        # now to ensure we don\u0027t have a keyerror"},{"line_number":175,"context_line":"        self.metrics \u003d objects.MonitorMetricList.from_legacy_json(metrics)"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    def update_from_compute_node(self, compute):"},{"line_number":178,"context_line":"        \"\"\"Update information about a host from a ComputeNode object.\"\"\""}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_9a39e9d9","line":175,"in_reply_to":"fa1b9901_2c13d95c","updated":"2015-08-20 06:45:43.000000000","message":"Sounds like we need to re-factor the metrics filter as well as a part of this change. Let me try something in the next patchset.","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"ee6637eee2fffa0d3b0f5dabfac56978eb4663ed","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        metrics \u003d compute.metrics or []"},{"line_number":173,"context_line":"        # NOTE(sbiswas7): The objects impose the mandatory field values"},{"line_number":174,"context_line":"        # now to ensure we don\u0027t have a keyerror"},{"line_number":175,"context_line":"        self.metrics \u003d objects.MonitorMetricList.from_legacy_json(metrics)"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    def update_from_compute_node(self, compute):"},{"line_number":178,"context_line":"        \"\"\"Update information about a host from a ComputeNode object.\"\"\""}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_1a2dd994","line":175,"in_reply_to":"fa1b9901_9bda644b","updated":"2015-08-20 06:45:43.000000000","message":"If we do that, I guess we don\u0027t need this _update_metrics_from_compute_node method at all. We can completely get rid of it. Thoughts?","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"9d8bd26cf9295df4d0805e39a39ec601526b260b","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        metrics \u003d compute.metrics or []"},{"line_number":173,"context_line":"        # NOTE(sbiswas7): The objects impose the mandatory field values"},{"line_number":174,"context_line":"        # now to ensure we don\u0027t have a keyerror"},{"line_number":175,"context_line":"        self.metrics \u003d objects.MonitorMetricList.from_legacy_json(metrics)"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    def update_from_compute_node(self, compute):"},{"line_number":178,"context_line":"        \"\"\"Update information about a host from a ComputeNode object.\"\"\""}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_2c13d95c","line":175,"in_reply_to":"fa1b9901_9bda644b","updated":"2015-08-19 21:28:44.000000000","message":"Yeah that cannot work - the HostState.metrics is a dict keyed by names of metrics while here you\u0027re populating thru a list of metrics\n\nAll of that is just badly designed : what\u0027s coming from the DB is a list of dicts but this helper method is tranforming that into a single dictionary keyed by names - and the filter makes the confusion because it iterates over a dict, which is possible (you get the keys) but confusing...","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"}],"nova/tests/unit/scheduler/test_host_manager.py":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"5b9ea30f101635be7f90b5bdd6344f9c84ae04af","unresolved":false,"context_lines":[{"line_number":958,"context_line":""},{"line_number":959,"context_line":"    def test_resources_consumption_from_compute_node(self):"},{"line_number":960,"context_line":"        _ts_now \u003d timeutils.utcnow()"},{"line_number":961,"context_line":"        metrics \u003d ["},{"line_number":962,"context_line":"            dict(name\u003d\u0027cpu.frequency\u0027,"},{"line_number":963,"context_line":"                 value\u003d1.0,"},{"line_number":964,"context_line":"                 source\u003d\u0027source1\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_5700a3aa","line":961,"updated":"2015-08-17 13:56:24.000000000","message":"how about we use MonitorMetricList at here. Then we can ensure MonitorMetricList\u0027s output works as input also.","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"538d347206dc8d9f14762e8016e07f649824d596","unresolved":false,"context_lines":[{"line_number":962,"context_line":"            dict(name\u003d\u0027cpu.frequency\u0027,"},{"line_number":963,"context_line":"                 value\u003d1.0,"},{"line_number":964,"context_line":"                 source\u003d\u0027source1\u0027,"},{"line_number":965,"context_line":"                 timestamp\u003dtimeutils.strtime(_ts_now)),"},{"line_number":966,"context_line":"            dict(name\u003d\u0027numa.membw.current\u0027,"},{"line_number":967,"context_line":"                 numa_membw_values\u003d{\"0\": 10, \"1\": 43},"},{"line_number":968,"context_line":"                 source\u003d\u0027source2\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_f49458e9","line":965,"updated":"2015-08-17 12:42:44.000000000","message":"timeutils.strtime is deprecated. See https://github.com/openstack/oslo.utils/blob/master/oslo_utils/timeutils.py#L71-L77","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"d45c95c4d5dae6a94a13b2a8ccd48ab334b55690","unresolved":false,"context_lines":[{"line_number":962,"context_line":"            dict(name\u003d\u0027cpu.frequency\u0027,"},{"line_number":963,"context_line":"                 value\u003d1.0,"},{"line_number":964,"context_line":"                 source\u003d\u0027source1\u0027,"},{"line_number":965,"context_line":"                 timestamp\u003dtimeutils.strtime(_ts_now)),"},{"line_number":966,"context_line":"            dict(name\u003d\u0027numa.membw.current\u0027,"},{"line_number":967,"context_line":"                 numa_membw_values\u003d{\"0\": 10, \"1\": 43},"},{"line_number":968,"context_line":"                 source\u003d\u0027source2\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_538cf07e","line":965,"in_reply_to":"fa1b9901_f49458e9","updated":"2015-08-18 18:42:03.000000000","message":"Done","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"538d347206dc8d9f14762e8016e07f649824d596","unresolved":false,"context_lines":[{"line_number":966,"context_line":"            dict(name\u003d\u0027numa.membw.current\u0027,"},{"line_number":967,"context_line":"                 numa_membw_values\u003d{\"0\": 10, \"1\": 43},"},{"line_number":968,"context_line":"                 source\u003d\u0027source2\u0027,"},{"line_number":969,"context_line":"                 timestamp\u003dtimeutils.strtime(_ts_now)),"},{"line_number":970,"context_line":"        ]"},{"line_number":971,"context_line":"        hyper_ver_int \u003d utils.convert_version_to_int(\u00276.0.0\u0027)"},{"line_number":972,"context_line":"        compute \u003d objects.ComputeNode("}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_b49ee005","line":969,"updated":"2015-08-17 12:42:44.000000000","message":"same as above","commit_id":"c758c04190cc335de4307d1da7dee650579c0c57"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"47e35b0fe141a617a153bcba978eaa3a0658fa8e","unresolved":false,"context_lines":[{"line_number":962,"context_line":"            dict(name\u003d\u0027cpu.frequency\u0027,"},{"line_number":963,"context_line":"                 value\u003d1.0,"},{"line_number":964,"context_line":"                 source\u003d\u0027source1\u0027,"},{"line_number":965,"context_line":"                 timestamp\u003d_ts_now),"},{"line_number":966,"context_line":"            dict(name\u003d\u0027numa.membw.current\u0027,"},{"line_number":967,"context_line":"                 numa_membw_values\u003d{\"0\": 10, \"1\": 43},"},{"line_number":968,"context_line":"                 source\u003d\u0027source2\u0027,"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa1b9901_9bc84824","line":965,"updated":"2015-08-19 08:29:45.000000000","message":"I\u0027m confused. In patch set 5 timestamp was a string but now it is a datetime object. Which one it really should be?","commit_id":"8ca6b0d2f3556f6efef159f88bca3f2d20159535"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"aead27e55eab3cf73e316969656a770ef222b2a6","unresolved":false,"context_lines":[{"line_number":962,"context_line":"            dict(name\u003d\u0027cpu.frequency\u0027,"},{"line_number":963,"context_line":"                 value\u003d1.0,"},{"line_number":964,"context_line":"                 source\u003d\u0027source1\u0027,"},{"line_number":965,"context_line":"                 timestamp\u003d_ts_now),"},{"line_number":966,"context_line":"            dict(name\u003d\u0027numa.membw.current\u0027,"},{"line_number":967,"context_line":"                 numa_membw_values\u003d{\"0\": 10, \"1\": 43},"},{"line_number":968,"context_line":"                 source\u003d\u0027source2\u0027,"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa1b9901_20a0dc8f","line":965,"in_reply_to":"fa1b9901_9bc84824","updated":"2015-08-19 11:22:52.000000000","message":"https://github.com/openstack/nova/blob/master/nova/objects/monitor_metric.py#L31","commit_id":"8ca6b0d2f3556f6efef159f88bca3f2d20159535"},{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"c2901c7cece82bac0d649e32653b56c5828a9b10","unresolved":false,"context_lines":[{"line_number":988,"context_line":"        self.assertEqual(1.0, host.metrics.to_list()[0][\u0027value\u0027])"},{"line_number":989,"context_line":"        self.assertEqual(\u0027source1\u0027, host.metrics[0].source)"},{"line_number":990,"context_line":"        self.assertEqual(\u0027cpu.frequency\u0027, host.metrics[0].name)"},{"line_number":991,"context_line":"        self.assertEqual(\u0027source2\u0027, host.metrics.to_list()[1][\u0027source\u0027])"},{"line_number":992,"context_line":"        self.assertIsInstance(host.numa_topology, six.string_types)"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa1b9901_49809846","line":991,"updated":"2015-08-19 13:29:50.000000000","message":"I think there should be some sort of assertion here for the numa_membw_values because that is something that changed in your addition. It should simply be just another assertion to make sure it is set to the above values.","commit_id":"8ca6b0d2f3556f6efef159f88bca3f2d20159535"},{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"cb9e6d9d3f3aa737f134e71dcefa6c9b354834c7","unresolved":false,"context_lines":[{"line_number":988,"context_line":"        self.assertEqual(1.0, host.metrics.to_list()[0][\u0027value\u0027])"},{"line_number":989,"context_line":"        self.assertEqual(\u0027source1\u0027, host.metrics[0].source)"},{"line_number":990,"context_line":"        self.assertEqual(\u0027cpu.frequency\u0027, host.metrics[0].name)"},{"line_number":991,"context_line":"        self.assertEqual(\u0027numa.membw.current\u0027, host.metrics[1].name)"},{"line_number":992,"context_line":"        self.assertEqual(\u0027source2\u0027, host.metrics.to_list()[1][\u0027source\u0027])"},{"line_number":993,"context_line":"        self.assertIsInstance(host.numa_topology, six.string_types)"}],"source_content_type":"text/x-python","patch_set":8,"id":"fa1b9901_caa56847","line":991,"updated":"2015-08-19 18:22:55.000000000","message":"I think my previous comment was a little too vague. There should be\n\n assertEqual({\u00270\u0027: 10, \u00271\u0027: 43}, host.metrics[1].numa_membw_values)\n\nhere to make sure that kwarg is being set correctly on the metric. Checking the name on the second shouldn\u0027t be necessary because you\u0027re asserting it on the first metric.","commit_id":"5df2daa99d3b50668aee2b9fd588eb1273b7c36b"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"9d8bd26cf9295df4d0805e39a39ec601526b260b","unresolved":false,"context_lines":[{"line_number":985,"context_line":"        host.update_from_compute_node(compute)"},{"line_number":986,"context_line":""},{"line_number":987,"context_line":"        self.assertEqual(len(host.metrics), 2)"},{"line_number":988,"context_line":"        self.assertEqual(1.0, host.metrics.to_list()[0][\u0027value\u0027])"},{"line_number":989,"context_line":"        self.assertEqual(\u0027source1\u0027, host.metrics[0].source)"},{"line_number":990,"context_line":"        self.assertEqual(\u0027cpu.frequency\u0027, host.metrics[0].name)"},{"line_number":991,"context_line":"        self.assertEqual(\u0027numa.membw.current\u0027, host.metrics[1].name)"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_6c5a312c","line":988,"updated":"2015-08-19 21:28:44.000000000","message":"here is why it\u0027s not catched by the unittests - you\u0027re changing the assertions to match with your needs, and on the other hand you don\u0027t change the passed argument for the filter","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"ee6637eee2fffa0d3b0f5dabfac56978eb4663ed","unresolved":false,"context_lines":[{"line_number":985,"context_line":"        host.update_from_compute_node(compute)"},{"line_number":986,"context_line":""},{"line_number":987,"context_line":"        self.assertEqual(len(host.metrics), 2)"},{"line_number":988,"context_line":"        self.assertEqual(1.0, host.metrics.to_list()[0][\u0027value\u0027])"},{"line_number":989,"context_line":"        self.assertEqual(\u0027source1\u0027, host.metrics[0].source)"},{"line_number":990,"context_line":"        self.assertEqual(\u0027cpu.frequency\u0027, host.metrics[0].name)"},{"line_number":991,"context_line":"        self.assertEqual(\u0027numa.membw.current\u0027, host.metrics[1].name)"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa1b9901_cf14814e","line":988,"in_reply_to":"fa1b9901_6c5a312c","updated":"2015-08-20 06:45:43.000000000","message":"Yeah ... :) This is because, the host_manager.py overwrites the metrics variable - (i guess that\u0027s what you meant) - so i don\u0027t know if we can really catch this from this test. I think the simple solution would be:\n\n1. Change the variable to None while initializing in the self.metrics calls.\n2. Change the metrics_filter to use the MonitorMetricList.to_list() routine.\n\nThoughts?","commit_id":"a95ee29000e3135b52389015f6b62f68f931cc83"}]}
