)]}'
{"nova/compute/resource_tracker.py":[{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"63e74fe8aca774dc3aee3c6c06184a7992093e28","unresolved":false,"context_lines":[{"line_number":307,"context_line":"        if \u0027pci_passthrough_devices\u0027 in resources:"},{"line_number":308,"context_line":"            if not self.pci_tracker:"},{"line_number":309,"context_line":"                self.pci_tracker \u003d pci_manager.PciDevTracker("},{"line_number":310,"context_line":"                    context, self.host, self.nodename)"},{"line_number":311,"context_line":"            self.pci_tracker.set_hvdevs(jsonutils.loads(resources.pop("},{"line_number":312,"context_line":"                \u0027pci_passthrough_devices\u0027)))"},{"line_number":313,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_1e6f5cc5","line":310,"updated":"2014-06-26 12:44:49.000000000","message":"as said per IRC, I think that a tuple (host, node) is worth a try.","commit_id":"c8cf5f4929288eb240845caaa713537f851e6e07"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"56b3fbcad488f7b296328135d01d34e1f0dc137c","unresolved":false,"context_lines":[{"line_number":305,"context_line":"        if \u0027pci_passthrough_devices\u0027 in resources:"},{"line_number":306,"context_line":"            if not self.pci_tracker:"},{"line_number":307,"context_line":"                self.pci_tracker \u003d pci_manager.PciDevTracker("},{"line_number":308,"context_line":"                    self.host, self.nodename)"},{"line_number":309,"context_line":"            self.pci_tracker.set_hvdevs(jsonutils.loads(resources.pop("},{"line_number":310,"context_line":"                \u0027pci_passthrough_devices\u0027)))"},{"line_number":311,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_2b215c4d","line":308,"updated":"2014-07-03 07:49:00.000000000","message":"nit: I would prefer a tuple (host, node) instead of 2 args here","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"6d700ebaf3290f47c979214e1bbc5c16cee84042","unresolved":false,"context_lines":[{"line_number":305,"context_line":"        if \u0027pci_passthrough_devices\u0027 in resources:"},{"line_number":306,"context_line":"            if not self.pci_tracker:"},{"line_number":307,"context_line":"                self.pci_tracker \u003d pci_manager.PciDevTracker("},{"line_number":308,"context_line":"                    self.host, self.nodename)"},{"line_number":309,"context_line":"            self.pci_tracker.set_hvdevs(jsonutils.loads(resources.pop("},{"line_number":310,"context_line":"                \u0027pci_passthrough_devices\u0027)))"},{"line_number":311,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_9ed612f0","line":308,"in_reply_to":"baada198_2b215c4d","updated":"2014-07-03 17:37:06.000000000","message":"In fact, I use the (host, node) in previous change set according to your suggestion, and one comments I got was it\u0027s a bit confusing, and I have the same feeling thus change back :)","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"}],"nova/pci/pci_manager.py":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"7269679e85e4d0259059e507378aa8d83044f870","unresolved":false,"context_lines":[{"line_number":48,"context_line":"    def __init__(self, compute_node):"},{"line_number":49,"context_line":"        \"\"\"Create a pci device tracker."},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"        If a node_id is passed in, it will fetch pci devices information"},{"line_number":52,"context_line":"        from database, otherwise, it will create an empty devices list"},{"line_number":53,"context_line":"        and the resource tracker will update the node_id information later."},{"line_number":54,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_203532da","line":51,"updated":"2014-07-01 23:44:08.000000000","message":"Docstring needs update.","commit_id":"63948d33cdd0a278f5413031392b2ac1b23469c5"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"0e338cff5a330b8632b573d45d02c2a982372358","unresolved":false,"context_lines":[{"line_number":48,"context_line":"    def __init__(self, compute_node):"},{"line_number":49,"context_line":"        \"\"\"Create a pci device tracker."},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"        If a node_id is passed in, it will fetch pci devices information"},{"line_number":52,"context_line":"        from database, otherwise, it will create an empty devices list"},{"line_number":53,"context_line":"        and the resource tracker will update the node_id information later."},{"line_number":54,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_03911852","line":51,"in_reply_to":"baada198_203532da","updated":"2014-08-07 21:43:14.000000000","message":"Done","commit_id":"63948d33cdd0a278f5413031392b2ac1b23469c5"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"7269679e85e4d0259059e507378aa8d83044f870","unresolved":false,"context_lines":[{"line_number":55,"context_line":""},{"line_number":56,"context_line":"        super(PciDevTracker, self).__init__()"},{"line_number":57,"context_line":"        self.stale \u003d {}"},{"line_number":58,"context_line":"        self.host, self.node \u003d compute_node"},{"line_number":59,"context_line":"        self.node_id \u003d None"},{"line_number":60,"context_line":"        self._fetch_initial_pci_devices()"},{"line_number":61,"context_line":"        self._initial_instance_usage()"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_e03fba23","line":58,"updated":"2014-07-01 23:44:08.000000000","message":"This was confusing until I looked back again at resource_tracker.py to see that compute_node is a tuple. The name sounds like a compute node object or dict.","commit_id":"63948d33cdd0a278f5413031392b2ac1b23469c5"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"0e338cff5a330b8632b573d45d02c2a982372358","unresolved":false,"context_lines":[{"line_number":55,"context_line":""},{"line_number":56,"context_line":"        super(PciDevTracker, self).__init__()"},{"line_number":57,"context_line":"        self.stale \u003d {}"},{"line_number":58,"context_line":"        self.host, self.node \u003d compute_node"},{"line_number":59,"context_line":"        self.node_id \u003d None"},{"line_number":60,"context_line":"        self._fetch_initial_pci_devices()"},{"line_number":61,"context_line":"        self._initial_instance_usage()"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_6389f425","line":58,"in_reply_to":"baada198_e03fba23","updated":"2014-08-07 21:43:14.000000000","message":"Done.","commit_id":"63948d33cdd0a278f5413031392b2ac1b23469c5"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"56b3fbcad488f7b296328135d01d34e1f0dc137c","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        except exception.ComputeHostNotFound:"},{"line_number":71,"context_line":"            self.pci_devs \u003d list()"},{"line_number":72,"context_line":"        else:"},{"line_number":73,"context_line":"            self.node_id \u003d compute_node.id"},{"line_number":74,"context_line":"            self.pci_devs \u003d list("},{"line_number":75,"context_line":"                pci_device_obj.PciDeviceList.get_by_compute_node("},{"line_number":76,"context_line":"                    ctxt, compute_node.id))"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_ab4e4c6d","line":73,"updated":"2014-07-03 07:49:00.000000000","message":"just wonderinf if compute_node[\u0027id\u0027] would not be better, as you did L140","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"6d700ebaf3290f47c979214e1bbc5c16cee84042","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        except exception.ComputeHostNotFound:"},{"line_number":71,"context_line":"            self.pci_devs \u003d list()"},{"line_number":72,"context_line":"        else:"},{"line_number":73,"context_line":"            self.node_id \u003d compute_node.id"},{"line_number":74,"context_line":"            self.pci_devs \u003d list("},{"line_number":75,"context_line":"                pci_device_obj.PciDeviceList.get_by_compute_node("},{"line_number":76,"context_line":"                    ctxt, compute_node.id))"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_3e4186a9","line":73,"in_reply_to":"baada198_ab4e4c6d","updated":"2014-07-03 17:37:06.000000000","message":"Thanks for suggestion, possibly I should change the followed compute_node[\u0027id\u0027] to be compute_node.id, since we are using object in this code path.","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"}],"nova/tests/compute/test_claims.py":[{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"56b3fbcad488f7b296328135d01d34e1f0dc137c","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    @mock.patch(\u0027nova.db.compute_node_get_by_hypervisorname\u0027,"},{"line_number":41,"context_line":"                side_effect\u003dexception.ComputeHostNotFound(host\u003d\u0027h1\u0027))"},{"line_number":42,"context_line":"    def new_pci_tracker(self, mock_node):"},{"line_number":43,"context_line":"        self.pci_tracker \u003d pci_manager.PciDevTracker(\u0027h1\u0027, \u0027n1\u0027)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_ab9c8cc1","line":42,"updated":"2014-07-03 07:49:00.000000000","message":"nit: there is no need to pass the mock in param if you don\u0027t use it","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"6d700ebaf3290f47c979214e1bbc5c16cee84042","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    @mock.patch(\u0027nova.db.compute_node_get_by_hypervisorname\u0027,"},{"line_number":41,"context_line":"                side_effect\u003dexception.ComputeHostNotFound(host\u003d\u0027h1\u0027))"},{"line_number":42,"context_line":"    def new_pci_tracker(self, mock_node):"},{"line_number":43,"context_line":"        self.pci_tracker \u003d pci_manager.PciDevTracker(\u0027h1\u0027, \u0027n1\u0027)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_1e8762d8","line":42,"in_reply_to":"baada198_ab9c8cc1","updated":"2014-07-03 17:37:06.000000000","message":"Seems it does not work?","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"56b3fbcad488f7b296328135d01d34e1f0dc137c","unresolved":false,"context_lines":[{"line_number":41,"context_line":"                side_effect\u003dexception.ComputeHostNotFound(host\u003d\u0027h1\u0027))"},{"line_number":42,"context_line":"    def new_pci_tracker(self, mock_node):"},{"line_number":43,"context_line":"        self.pci_tracker \u003d pci_manager.PciDevTracker(\u0027h1\u0027, \u0027n1\u0027)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"class ClaimTestCase(test.NoDBTestCase):"},{"line_number":47,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_8bb50833","line":44,"updated":"2014-07-03 07:49:00.000000000","message":"what is the assertion you want to test ? Here you only ensure that the method won\u0027t raise an exception,but I would appreciate some introspection from the values","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"24585d23aa28abbdc4eb41e08ed2003fc86928a5","unresolved":false,"context_lines":[{"line_number":41,"context_line":"                side_effect\u003dexception.ComputeHostNotFound(host\u003d\u0027h1\u0027))"},{"line_number":42,"context_line":"    def new_pci_tracker(self, mock_node):"},{"line_number":43,"context_line":"        self.pci_tracker \u003d pci_manager.PciDevTracker(\u0027h1\u0027, \u0027n1\u0027)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"class ClaimTestCase(test.NoDBTestCase):"},{"line_number":47,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_e5f2da04","line":44,"in_reply_to":"baada198_39436043","updated":"2014-07-07 09:00:28.000000000","message":"My bad, missed the classname.\n\nIf you want a dummy tracker, I would suggest to inherit from the one you want to mock and override any necessary method to get that done.\n\nI don\u0027t like a call to new_pci_tracker() if PCIDevTracker doesn\u0027t have this method. Think ducktyping and keep all existing methods, don\u0027t do something new and not related to what you want to test.","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"6d700ebaf3290f47c979214e1bbc5c16cee84042","unresolved":false,"context_lines":[{"line_number":41,"context_line":"                side_effect\u003dexception.ComputeHostNotFound(host\u003d\u0027h1\u0027))"},{"line_number":42,"context_line":"    def new_pci_tracker(self, mock_node):"},{"line_number":43,"context_line":"        self.pci_tracker \u003d pci_manager.PciDevTracker(\u0027h1\u0027, \u0027n1\u0027)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"class ClaimTestCase(test.NoDBTestCase):"},{"line_number":47,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_39436043","line":44,"in_reply_to":"baada198_8bb50833","updated":"2014-07-03 17:37:06.000000000","message":"This is a dummy tracker, and the pci_tracker will be used by followed test cases, so this is not a test case for the pci device tracker itself.\n\nI added the side_effect here, to make sure the PciDevTracker will get the empty list when created, instead of trying to fetch existed PCI devices for the compute node.","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"}],"nova/tests/compute/test_resource_tracker.py":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"7269679e85e4d0259059e507378aa8d83044f870","unresolved":false,"context_lines":[{"line_number":16,"context_line":"\"\"\"Tests for compute resource tracking.\"\"\""},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"import copy"},{"line_number":19,"context_line":"import mock"},{"line_number":20,"context_line":"import uuid"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"from oslo.config import cfg"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_23637cdd","line":19,"updated":"2014-07-01 23:44:08.000000000","message":"This one should be with oslo, but I know it was already this way before this patch.","commit_id":"63948d33cdd0a278f5413031392b2ac1b23469c5"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"0e338cff5a330b8632b573d45d02c2a982372358","unresolved":false,"context_lines":[{"line_number":16,"context_line":"\"\"\"Tests for compute resource tracking.\"\"\""},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"import copy"},{"line_number":19,"context_line":"import mock"},{"line_number":20,"context_line":"import uuid"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"from oslo.config import cfg"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_4372304a","line":19,"in_reply_to":"baada198_23637cdd","updated":"2014-08-07 21:43:14.000000000","message":"Yes, I don\u0027t want to touch it.","commit_id":"63948d33cdd0a278f5413031392b2ac1b23469c5"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"7269679e85e4d0259059e507378aa8d83044f870","unresolved":false,"context_lines":[{"line_number":434,"context_line":"        self.tracker.update_available_resource(self.context)"},{"line_number":435,"context_line":"        self.limits \u003d self._limits()"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"    def _fake_compute_node_get_by_hypervisorname(self, ctxt, host, node):"},{"line_number":438,"context_line":"        if not self.compute:"},{"line_number":439,"context_line":"            self.compute \u003d self._create_compute_node()"},{"line_number":440,"context_line":"        return self.compute"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_6032ca11","line":437,"updated":"2014-07-01 23:44:08.000000000","message":"What are the function args ctxt, host, and node for?","commit_id":"63948d33cdd0a278f5413031392b2ac1b23469c5"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"0e338cff5a330b8632b573d45d02c2a982372358","unresolved":false,"context_lines":[{"line_number":434,"context_line":"        self.tracker.update_available_resource(self.context)"},{"line_number":435,"context_line":"        self.limits \u003d self._limits()"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"    def _fake_compute_node_get_by_hypervisorname(self, ctxt, host, node):"},{"line_number":438,"context_line":"        if not self.compute:"},{"line_number":439,"context_line":"            self.compute \u003d self._create_compute_node()"},{"line_number":440,"context_line":"        return self.compute"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_03c67849","line":437,"in_reply_to":"baada198_6032ca11","updated":"2014-08-07 21:43:14.000000000","message":"This is the parameter to \u0027compute_node_get_by_hypervisorname\u0027","commit_id":"63948d33cdd0a278f5413031392b2ac1b23469c5"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"56b3fbcad488f7b296328135d01d34e1f0dc137c","unresolved":false,"context_lines":[{"line_number":148,"context_line":"        self.host \u003d \u0027fakehost\u0027"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"    def _create_compute_node(self, values\u003dNone):"},{"line_number":151,"context_line":"        compute \u003d copy.deepcopy(test_compute_node.fake_compute_node)"},{"line_number":152,"context_line":"        compute[\u0027hypervisor_hostname\u0027] \u003d \u0027fakenode\u0027"},{"line_number":153,"context_line":"        if values:"},{"line_number":154,"context_line":"            compute.update(values)"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_2bdebc6d","line":151,"updated":"2014-07-03 07:49:00.000000000","message":"thanks for the change here, I\u0027m just wondering if it\u0027s worth keeping the PCI change minimalistic. As the RT doesn\u0027t use objects yet, maybe this should not yet be replaced","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"6d700ebaf3290f47c979214e1bbc5c16cee84042","unresolved":false,"context_lines":[{"line_number":148,"context_line":"        self.host \u003d \u0027fakehost\u0027"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"    def _create_compute_node(self, values\u003dNone):"},{"line_number":151,"context_line":"        compute \u003d copy.deepcopy(test_compute_node.fake_compute_node)"},{"line_number":152,"context_line":"        compute[\u0027hypervisor_hostname\u0027] \u003d \u0027fakenode\u0027"},{"line_number":153,"context_line":"        if values:"},{"line_number":154,"context_line":"            compute.update(values)"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_3eb26694","line":151,"in_reply_to":"baada198_2bdebc6d","updated":"2014-07-03 17:37:06.000000000","message":"The reason is because I\u0027m using the compute node object in the pci device manager :). \n\nAlso the fake_compute_node is not a object, but a real DB-like return value dict, while current compute is a dict w/o DB return value like updated_at etc. Since this value is used to fake several DB call, it should be better.\n\nYour idea?","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"24585d23aa28abbdc4eb41e08ed2003fc86928a5","unresolved":false,"context_lines":[{"line_number":148,"context_line":"        self.host \u003d \u0027fakehost\u0027"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"    def _create_compute_node(self, values\u003dNone):"},{"line_number":151,"context_line":"        compute \u003d copy.deepcopy(test_compute_node.fake_compute_node)"},{"line_number":152,"context_line":"        compute[\u0027hypervisor_hostname\u0027] \u003d \u0027fakenode\u0027"},{"line_number":153,"context_line":"        if values:"},{"line_number":154,"context_line":"            compute.update(values)"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_e50e5ae4","line":151,"in_reply_to":"baada198_3eb26694","updated":"2014-07-07 09:00:28.000000000","message":"Objects are backwards compatible with dicts so that\u0027s not a problem. Again, I really would like to see the change as minimalistic as possible and your proposal here introduces change while it\u0027s not necessary (and possibly confusing)","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":7546,"name":"Blair Bethwaite","email":"blair.bethwaite@gmail.com","username":"blairo"},"change_message_id":"5d6d9c82a8b1b643917c22d42fea25e88504d169","unresolved":false,"context_lines":[{"line_number":166,"context_line":"            \"vcpus_used\": 1,"},{"line_number":167,"context_line":"            \"memory_mb_used\": 1,"},{"line_number":168,"context_line":"            \"local_gb_used\": 1,"},{"line_number":169,"context_line":"            \u0027hypervisor_type\u0027: \u0027Hyper-Dan-VM-ware\u0027,"},{"line_number":170,"context_line":"            \u0027hypervisor_version\u0027: 1001,"},{"line_number":171,"context_line":"            \"free_ram_mb\": 1,"},{"line_number":172,"context_line":"            \"free_disk_gb\": 1,"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a8c0949_34d1df57","line":169,"updated":"2014-11-06 22:19:40.000000000","message":"looks like some unwarranted/unused cruft in here, can\u0027t see where used...?","commit_id":"ccff51d2ad117cf7b1a8bc04e8fa4d54bd9241f3"}],"nova/tests/pci/test_pci_manager.py":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"7269679e85e4d0259059e507378aa8d83044f870","unresolved":false,"context_lines":[{"line_number":14,"context_line":"#    under the License."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"import copy"},{"line_number":17,"context_line":"import mock"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"from nova.compute import task_states"},{"line_number":20,"context_line":"from nova.compute import vm_states"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_e313445a","line":17,"updated":"2014-07-01 23:44:08.000000000","message":"This is third party lib so there should be a space between copy and mock.","commit_id":"63948d33cdd0a278f5413031392b2ac1b23469c5"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"0e338cff5a330b8632b573d45d02c2a982372358","unresolved":false,"context_lines":[{"line_number":14,"context_line":"#    under the License."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"import copy"},{"line_number":17,"context_line":"import mock"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"from nova.compute import task_states"},{"line_number":20,"context_line":"from nova.compute import vm_states"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_43c0702a","line":17,"in_reply_to":"baada198_e313445a","updated":"2014-08-07 21:43:14.000000000","message":"Done.\n\nI always forgot mock is 3rd party lib in python 2.x :$","commit_id":"63948d33cdd0a278f5413031392b2ac1b23469c5"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"56b3fbcad488f7b296328135d01d34e1f0dc137c","unresolved":false,"context_lines":[{"line_number":104,"context_line":"        self.stubs.Set(pci_request, \u0027get_instance_pci_requests\u0027,"},{"line_number":105,"context_line":"            self._fake_get_instance_pci_requests)"},{"line_number":106,"context_line":"        self._create_fake_instance()"},{"line_number":107,"context_line":"        self.patch1 \u003d mock.patch(\u0027nova.db.compute_node_get_by_hypervisorname\u0027)"},{"line_number":108,"context_line":"        self.fake_compute_node \u003d self.patch1.start()"},{"line_number":109,"context_line":"        self.fake_compute_node.return_value \u003d ("},{"line_number":110,"context_line":"            test_compute_node.fake_compute_node)"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_2bc5dc8d","line":107,"updated":"2014-07-03 07:49:00.000000000","message":"mock.patch.object(db, \u0027compute_node_get_by_hypervisorname\u0027) sounds better to me as nova.db is already imported","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"56b3fbcad488f7b296328135d01d34e1f0dc137c","unresolved":false,"context_lines":[{"line_number":105,"context_line":"            self._fake_get_instance_pci_requests)"},{"line_number":106,"context_line":"        self._create_fake_instance()"},{"line_number":107,"context_line":"        self.patch1 \u003d mock.patch(\u0027nova.db.compute_node_get_by_hypervisorname\u0027)"},{"line_number":108,"context_line":"        self.fake_compute_node \u003d self.patch1.start()"},{"line_number":109,"context_line":"        self.fake_compute_node.return_value \u003d ("},{"line_number":110,"context_line":"            test_compute_node.fake_compute_node)"},{"line_number":111,"context_line":"        self.tracker \u003d pci_manager.PciDevTracker(\u0027h1\u0027, \u0027n1\u0027)"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_cb09c0de","line":108,"updated":"2014-07-03 07:49:00.000000000","message":"I recently had a -1 (which I agree) about the placement of mocking methods which should be done on a test basis, not in setUp.\n\nAlso, if you decide to do that in setUp with .start(), don\u0027t forget to call .addCleanup(stop)...\nhttp://www.voidspace.org.uk/python/mock/patch.html#patch-methods-start-and-stop","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"6d700ebaf3290f47c979214e1bbc5c16cee84042","unresolved":false,"context_lines":[{"line_number":105,"context_line":"            self._fake_get_instance_pci_requests)"},{"line_number":106,"context_line":"        self._create_fake_instance()"},{"line_number":107,"context_line":"        self.patch1 \u003d mock.patch(\u0027nova.db.compute_node_get_by_hypervisorname\u0027)"},{"line_number":108,"context_line":"        self.fake_compute_node \u003d self.patch1.start()"},{"line_number":109,"context_line":"        self.fake_compute_node.return_value \u003d ("},{"line_number":110,"context_line":"            test_compute_node.fake_compute_node)"},{"line_number":111,"context_line":"        self.tracker \u003d pci_manager.PciDevTracker(\u0027h1\u0027, \u0027n1\u0027)"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_f9072816","line":108,"in_reply_to":"baada198_cb09c0de","updated":"2014-07-03 17:37:06.000000000","message":"I think if the mock will apply for all (or most) of the test cases, it should be ok to do it in setUp? Can you please share me your -1?\n\nThanks for reminding the cleanup, can\u0027t imagine I forgot it :$","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"24585d23aa28abbdc4eb41e08ed2003fc86928a5","unresolved":false,"context_lines":[{"line_number":105,"context_line":"            self._fake_get_instance_pci_requests)"},{"line_number":106,"context_line":"        self._create_fake_instance()"},{"line_number":107,"context_line":"        self.patch1 \u003d mock.patch(\u0027nova.db.compute_node_get_by_hypervisorname\u0027)"},{"line_number":108,"context_line":"        self.fake_compute_node \u003d self.patch1.start()"},{"line_number":109,"context_line":"        self.fake_compute_node.return_value \u003d ("},{"line_number":110,"context_line":"            test_compute_node.fake_compute_node)"},{"line_number":111,"context_line":"        self.tracker \u003d pci_manager.PciDevTracker(\u0027h1\u0027, \u0027n1\u0027)"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_a5070281","line":108,"in_reply_to":"baada198_f9072816","updated":"2014-07-07 09:00:28.000000000","message":"See the comment L52 on https://review.openstack.org/#/c/82778/13/nova/tests/scheduler/test_client.py\n\nMocks are preffered to be method-based.","commit_id":"2df41ae7a26e9a80181b7c6f165eddd4dbf2118c"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"88be17354c8d8564b0005ee0658ffe3e5654bb9b","unresolved":false,"context_lines":[{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def setUp(self):"},{"line_number":101,"context_line":"        super(PciDevTrackerTestCase, self).setUp()"},{"line_number":102,"context_line":"        self.patchers \u003d []"},{"line_number":103,"context_line":"        self.patchers.append("},{"line_number":104,"context_line":"            mock.patch.object(db, \u0027pci_device_get_all_by_node\u0027,"},{"line_number":105,"context_line":"                return_value \u003d fake_db_devs[:]))"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_05e0aef8","line":102,"updated":"2014-07-07 09:00:45.000000000","message":"I don\u0027t like the idea of a list of patched methods. You can keep each call to each mock, that\u0027s better for clarity","commit_id":"55a7c4b9c807a2f3ea9ba65b476426c379e070c5"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"3824d410febb8c04e5706ad39c987ddae6486110","unresolved":false,"context_lines":[{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def setUp(self):"},{"line_number":101,"context_line":"        super(PciDevTrackerTestCase, self).setUp()"},{"line_number":102,"context_line":"        self.patchers \u003d []"},{"line_number":103,"context_line":"        self.patchers.append("},{"line_number":104,"context_line":"            mock.patch.object(db, \u0027pci_device_get_all_by_node\u0027,"},{"line_number":105,"context_line":"                return_value \u003d fake_db_devs[:]))"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_c57f04aa","line":102,"in_reply_to":"baada198_05e0aef8","updated":"2014-07-23 21:10:39.000000000","message":"hmm, that make sense, will work this way.","commit_id":"55a7c4b9c807a2f3ea9ba65b476426c379e070c5"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"88be17354c8d8564b0005ee0658ffe3e5654bb9b","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        self.patchers \u003d []"},{"line_number":103,"context_line":"        self.patchers.append("},{"line_number":104,"context_line":"            mock.patch.object(db, \u0027pci_device_get_all_by_node\u0027,"},{"line_number":105,"context_line":"                return_value \u003d fake_db_devs[:]))"},{"line_number":106,"context_line":"        self.patchers.append("},{"line_number":107,"context_line":"            mock.patch.object(pci_request, \u0027get_instance_pci_requests\u0027,"},{"line_number":108,"context_line":"                side_effect \u003d self._fake_get_instance_pci_requests))"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_a5a462ba","line":105,"updated":"2014-07-07 09:00:45.000000000","message":"nit: please don\u0027t leave whitespaces here around \u003d","commit_id":"55a7c4b9c807a2f3ea9ba65b476426c379e070c5"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"3824d410febb8c04e5706ad39c987ddae6486110","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        self.patchers \u003d []"},{"line_number":103,"context_line":"        self.patchers.append("},{"line_number":104,"context_line":"            mock.patch.object(db, \u0027pci_device_get_all_by_node\u0027,"},{"line_number":105,"context_line":"                return_value \u003d fake_db_devs[:]))"},{"line_number":106,"context_line":"        self.patchers.append("},{"line_number":107,"context_line":"            mock.patch.object(pci_request, \u0027get_instance_pci_requests\u0027,"},{"line_number":108,"context_line":"                side_effect \u003d self._fake_get_instance_pci_requests))"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_2565201d","line":105,"in_reply_to":"baada198_a5a462ba","updated":"2014-07-23 21:10:39.000000000","message":"Strange, why pep8 check not working here :)","commit_id":"55a7c4b9c807a2f3ea9ba65b476426c379e070c5"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"88be17354c8d8564b0005ee0658ffe3e5654bb9b","unresolved":false,"context_lines":[{"line_number":115,"context_line":""},{"line_number":116,"context_line":"        self.tracker \u003d pci_manager.PciDevTracker(\u0027h1\u0027, \u0027n1\u0027)"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    def tearDown(self):"},{"line_number":119,"context_line":"        for patcher in self.patchers:"},{"line_number":120,"context_line":"            patcher.stop()"},{"line_number":121,"context_line":"        super(PciDevTrackerTestCase, self).tearDown()"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_451e260d","line":118,"updated":"2014-07-07 09:00:45.000000000","message":"don\u0027t use tearDown please, this method is not called if an StopException gets in before end of the test. Please use addCleanup instead.","commit_id":"55a7c4b9c807a2f3ea9ba65b476426c379e070c5"},{"author":{"_account_id":4573,"name":"yunhong-jiang","email":"yunhong.jiang@intel.com","username":"yunhong-jiang"},"change_message_id":"3824d410febb8c04e5706ad39c987ddae6486110","unresolved":false,"context_lines":[{"line_number":115,"context_line":""},{"line_number":116,"context_line":"        self.tracker \u003d pci_manager.PciDevTracker(\u0027h1\u0027, \u0027n1\u0027)"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    def tearDown(self):"},{"line_number":119,"context_line":"        for patcher in self.patchers:"},{"line_number":120,"context_line":"            patcher.stop()"},{"line_number":121,"context_line":"        super(PciDevTrackerTestCase, self).tearDown()"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_456cd408","line":118,"in_reply_to":"baada198_451e260d","updated":"2014-07-23 21:10:39.000000000","message":"thanks for pointing this out.","commit_id":"55a7c4b9c807a2f3ea9ba65b476426c379e070c5"}]}
