)]}'
{"nova/tests/unit/virt/libvirt/test_driver.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"2e55e82e8d14da41c65dd0e902ecbb1cfdb53fb1","unresolved":false,"context_lines":[{"line_number":17397,"context_line":"                return_value\u003d1024)"},{"line_number":17398,"context_line":"    @mock.patch(\u0027nova.virt.libvirt.driver.LibvirtDriver._get_vcpu_total\u0027,"},{"line_number":17399,"context_line":"                return_value\u003d24)"},{"line_number":17400,"context_line":"    @mock.patch("},{"line_number":17401,"context_line":"        \u0027nova.compute.provider_tree.ProviderTree\u0027)"},{"line_number":17402,"context_line":"    def _test_update_provider_tree(self,"},{"line_number":17403,"context_line":"                                   mock_provider_tree,"},{"line_number":17404,"context_line":"                                   mock_vcpu, mock_mem,"}],"source_content_type":"text/x-python","patch_set":2,"id":"9f6a8fd7_a6b55380","line":17401,"range":{"start_line":17400,"start_character":4,"end_line":17401,"end_character":50},"updated":"2018-04-20 11:16:05.000000000","message":"You don\u0027t need this.  See below.","commit_id":"182bdc252859e0754ecc133de634735cce3bdecc"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"2e55e82e8d14da41c65dd0e902ecbb1cfdb53fb1","unresolved":false,"context_lines":[{"line_number":17405,"context_line":"                                   mock_disk, mock_vgpus,"},{"line_number":17406,"context_line":"                                   total_vgpus\u003d0):"},{"line_number":17407,"context_line":"        mock_vgpus.return_value \u003d total_vgpus"},{"line_number":17408,"context_line":"        mock_provider_tree.return_value \u003d mock.Mock()"},{"line_number":17409,"context_line":"        result \u003d {"},{"line_number":17410,"context_line":"            rc_fields.ResourceClass.VCPU: {"},{"line_number":17411,"context_line":"                \u0027total\u0027: 24,"}],"source_content_type":"text/x-python","patch_set":2,"id":"9f6a8fd7_a95444ff","line":17408,"range":{"start_line":17408,"start_character":8,"end_line":17408,"end_character":53},"updated":"2018-04-20 11:16:05.000000000","message":"This isn\u0027t actually doing anything, because we\u0027re not instiating a ProviderTree anywhere in the tested code path.\n\nWhat you should do is remove the mock.patch decorator entirely and just create mock_provider_tree as a Mock with an autospec to ProviderTree.  The autospec will (mostly) ensure that we\u0027re only calling valid methods with appropriate parameter specs.\n\nMore below...","commit_id":"182bdc252859e0754ecc133de634735cce3bdecc"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"74b0adc3835c697953c38a62c544fecb62753cf4","unresolved":false,"context_lines":[{"line_number":17405,"context_line":"                                   mock_disk, mock_vgpus,"},{"line_number":17406,"context_line":"                                   total_vgpus\u003d0):"},{"line_number":17407,"context_line":"        mock_vgpus.return_value \u003d total_vgpus"},{"line_number":17408,"context_line":"        mock_provider_tree.return_value \u003d mock.Mock()"},{"line_number":17409,"context_line":"        result \u003d {"},{"line_number":17410,"context_line":"            rc_fields.ResourceClass.VCPU: {"},{"line_number":17411,"context_line":"                \u0027total\u0027: 24,"}],"source_content_type":"text/x-python","patch_set":2,"id":"9f6a8fd7_69faacbd","line":17408,"range":{"start_line":17408,"start_character":8,"end_line":17408,"end_character":53},"in_reply_to":"9f6a8fd7_a95444ff","updated":"2018-04-20 11:26:00.000000000","message":"\u003e What you should do is remove the mock.patch decorator entirely and\n \u003e just create mock_provider_tree as a Mock with an autospec to\n \u003e ProviderTree.\n\n...or even better, don\u0027t mock - create an actual ProviderTree instance and assert its actual contents on the other side of the update_provider_tree call.","commit_id":"182bdc252859e0754ecc133de634735cce3bdecc"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"2e55e82e8d14da41c65dd0e902ecbb1cfdb53fb1","unresolved":false,"context_lines":[{"line_number":17435,"context_line":"                    \u0027step_size\u0027: 1,"},{"line_number":17436,"context_line":"                }"},{"line_number":17437,"context_line":"            })"},{"line_number":17438,"context_line":"        with mock.patch.object(provider_tree.ProviderTree, \u0027update_inventory\u0027"},{"line_number":17439,"context_line":"                               ) as mock_update_inventory:"},{"line_number":17440,"context_line":"            self.driver.update_provider_tree(mock_provider_tree,"},{"line_number":17441,"context_line":"                                             mock.sentinel.nodename)"},{"line_number":17442,"context_line":"            mock_update_inventory.assert_called_once_with("}],"source_content_type":"text/x-python","patch_set":2,"id":"9f6a8fd7_e9779c9f","line":17439,"range":{"start_line":17438,"start_character":8,"end_line":17439,"end_character":58},"updated":"2018-04-20 11:16:05.000000000","message":"...and then here you don\u0027t need to re-patch anything.  mock_provider_tree.update_inventory will automatically exist for you, and you can just assert its call exactly like you\u0027re doing below.","commit_id":"182bdc252859e0754ecc133de634735cce3bdecc"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"1cb14d2e84f0c8ab10202851484780fdb3ac7bfd","unresolved":false,"context_lines":[{"line_number":17276,"context_line":"        }"},{"line_number":17277,"context_line":""},{"line_number":17278,"context_line":"    @mock.patch(\u0027nova.virt.libvirt.driver.LibvirtDriver._get_vgpu_total\u0027)"},{"line_number":17279,"context_line":"    @mock.patch(\u0027nova.virt.libvirt.driver.LibvirtDriver._get_local_gb_info\u0027,"},{"line_number":17280,"context_line":"                return_value\u003d{\u0027total\u0027: disk_gb})"},{"line_number":17281,"context_line":"    @mock.patch(\u0027nova.virt.libvirt.host.Host.get_memory_mb_total\u0027,"},{"line_number":17282,"context_line":"                return_value\u003dmemory_mb)"},{"line_number":17283,"context_line":"    @mock.patch(\u0027nova.virt.libvirt.driver.LibvirtDriver._get_vcpu_total\u0027,"},{"line_number":17284,"context_line":"                return_value\u003dvcpus)"},{"line_number":17285,"context_line":"    def _test_update_provider_tree(self, mock_vcpu, mock_mem, mock_disk,"},{"line_number":17286,"context_line":"                                   mock_vgpus, total_vgpus\u003d0):"},{"line_number":17287,"context_line":"        mock_vgpus.return_value \u003d total_vgpus"}],"source_content_type":"text/x-python","patch_set":10,"id":"5f7c97a3_ae420b0e","line":17284,"range":{"start_line":17279,"start_character":0,"end_line":17284,"end_character":35},"updated":"2018-05-25 00:21:35.000000000","message":"use new\u003dmock.Mock() for these and you can get rid of the respective (unused) method args.  E.g.\n\n @mock.patch(\u0027..._get_local_gb_info\u0027, new\u003dmock.Mock(return_value\u003d...))","commit_id":"493fbf719c982846250c5006c0e033625fbace1a"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"1cb14d2e84f0c8ab10202851484780fdb3ac7bfd","unresolved":false,"context_lines":[{"line_number":17282,"context_line":"                return_value\u003dmemory_mb)"},{"line_number":17283,"context_line":"    @mock.patch(\u0027nova.virt.libvirt.driver.LibvirtDriver._get_vcpu_total\u0027,"},{"line_number":17284,"context_line":"                return_value\u003dvcpus)"},{"line_number":17285,"context_line":"    def _test_update_provider_tree(self, mock_vcpu, mock_mem, mock_disk,"},{"line_number":17286,"context_line":"                                   mock_vgpus, total_vgpus\u003d0):"},{"line_number":17287,"context_line":"        mock_vgpus.return_value \u003d total_vgpus"},{"line_number":17288,"context_line":"        self.driver.update_provider_tree(self.pt,"}],"source_content_type":"text/x-python","patch_set":10,"id":"5f7c97a3_8e562fce","line":17285,"range":{"start_line":17285,"start_character":8,"end_line":17285,"end_character":34},"updated":"2018-05-25 00:21:35.000000000","message":"nit: You could add an `expected_inventory` arg and do the assertEqual in this method.","commit_id":"493fbf719c982846250c5006c0e033625fbace1a"}],"nova/virt/libvirt/driver.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"056bcfe1300327a42e16526b933dc64a0bf7eccb","unresolved":false,"context_lines":[{"line_number":6330,"context_line":"        # reserved out of the returned dicts here because, for now at least,"},{"line_number":6331,"context_line":"        # the RT injects those values into the inventory dict based on the"},{"line_number":6332,"context_line":"        # compute_nodes record values."},{"line_number":6333,"context_line":"        result \u003d {"},{"line_number":6334,"context_line":"            rc_fields.ResourceClass.VCPU: {"},{"line_number":6335,"context_line":"                \u0027total\u0027: vcpus,"},{"line_number":6336,"context_line":"                \u0027min_unit\u0027: 1,"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_d733cef5","line":6333,"updated":"2018-05-17 14:05:34.000000000","message":"I suspect we\u0027re failing tempest because allocation ratios are not being set properly.  We deliberately avoid calling _normalize_inventory_from_cn_obj [1] from the resource tracker for the update_provider_tree path [2], because we wanted to allow/force virt drivers to handle that stuff themselves.  It is unclear whether that was the right call; but we should subsume that logic in here while we figure that out.\n\n[1] https://github.com/openstack/nova/blob/4b4e005c639204f2c680eda61131a6930379d70e/nova/compute/resource_tracker.py#L83\n[2] https://github.com/openstack/nova/blob/4b4e005c639204f2c680eda61131a6930379d70e/nova/compute/resource_tracker.py#L884-L886","commit_id":"7d2e58931f4ca0905b6f5d5472fa6a67b46900d5"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"98e39a9eac76b99ac87dff18fce87005ad75b866","unresolved":false,"context_lines":[{"line_number":6330,"context_line":"        # reserved out of the returned dicts here because, for now at least,"},{"line_number":6331,"context_line":"        # the RT injects those values into the inventory dict based on the"},{"line_number":6332,"context_line":"        # compute_nodes record values."},{"line_number":6333,"context_line":"        result \u003d {"},{"line_number":6334,"context_line":"            rc_fields.ResourceClass.VCPU: {"},{"line_number":6335,"context_line":"                \u0027total\u0027: vcpus,"},{"line_number":6336,"context_line":"                \u0027min_unit\u0027: 1,"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_172386c0","line":6333,"in_reply_to":"5f7c97a3_d733cef5","updated":"2018-05-17 14:39:17.000000000","message":"[Later] Oh, we can\u0027t duplicate the logic in here, because we don\u0027t have access to the compute node object.","commit_id":"7d2e58931f4ca0905b6f5d5472fa6a67b46900d5"}]}
