)]}'
{"nova/cells/state.py":[{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"bd59a554564fc8d05672eda73c39a7f6fee1c293","unresolved":false,"context_lines":[{"line_number":263,"context_line":""},{"line_number":264,"context_line":"        def _defaultdict_int():"},{"line_number":265,"context_line":"            return collections.defaultdict(int)"},{"line_number":266,"context_line":"        compute_hosts \u003d collections.defaultdict(_defaultdict_int)"},{"line_number":267,"context_line":""},{"line_number":268,"context_line":"        def _get_compute_hosts():"},{"line_number":269,"context_line":"            compute_nodes \u003d self.db.compute_node_get_all(ctxt)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9aa7fdbe_d114bcea","line":266,"updated":"2014-10-27 09:30:19.000000000","message":"Feels a bit like magic below, but it does make it much easier to read, so lets go for it.","commit_id":"72e1adaaf169294b1ea3a2060be65c83a7829803"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"bd59a554564fc8d05672eda73c39a7f6fee1c293","unresolved":false,"context_lines":[{"line_number":267,"context_line":""},{"line_number":268,"context_line":"        def _get_compute_hosts():"},{"line_number":269,"context_line":"            compute_nodes \u003d self.db.compute_node_get_all(ctxt)"},{"line_number":270,"context_line":"            for compute in compute_nodes:"},{"line_number":271,"context_line":"                service \u003d compute[\u0027service\u0027]"},{"line_number":272,"context_line":"                if not service or service[\u0027disabled\u0027]:"},{"line_number":273,"context_line":"                    continue"}],"source_content_type":"text/x-python","patch_set":2,"id":"9aa7fdbe_d1ebdcd9","line":270,"updated":"2014-10-27 09:30:19.000000000","message":"can you change this to node in compute_nodes?\n\nI think that makes it clearer when you see the talk about host, rather than just having \"compute\".","commit_id":"72e1adaaf169294b1ea3a2060be65c83a7829803"},{"author":{"_account_id":475,"name":"Rick Harris","email":"rick.harris@rackspace.com","username":"rconradharris"},"change_message_id":"245125fe6456649ddea93eefc2439e6398743d4d","unresolved":false,"context_lines":[{"line_number":272,"context_line":"                    continue"},{"line_number":273,"context_line":"                host \u003d service[\u0027host\u0027]"},{"line_number":274,"context_line":""},{"line_number":275,"context_line":"                compute_hosts[host][\u0027free_ram_mb\u0027] +\u003d node[\u0027free_ram_mb\u0027]"},{"line_number":276,"context_line":"                free_disk \u003d node[\u0027free_disk_gb\u0027] * 1024"},{"line_number":277,"context_line":"                compute_hosts[host][\u0027free_disk_mb\u0027] +\u003d free_disk"},{"line_number":278,"context_line":"                compute_hosts[host][\u0027total_ram_mb\u0027] +\u003d node[\u0027memory_mb\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"da86d52c_527bcff3","line":275,"updated":"2015-02-16 22:31:57.000000000","message":"Minor nit, but you can assign compute_hosts[host] to a temporary variable and make it a bit more readable IMHO.\n\n    chost \u003d compute_hosts[\u0027host\u0027]\n\n    chost[\u0027free_ram_mb\u0027] +\u003d node[\u0027free_ram_mb\u0027]\n    chost[\u0027free_disk_mb\u0027] +\u003d node[\u0027free_disk_gb\u0027] * 1024\n    chost[\u0027total_ram_mb\u0027] +\u003d node[\u0027memory_mb\u0027]\n    chost[\u0027total_disk_mb\u0027] +\u003d node[\u0027local_gb\u0027] * 1024","commit_id":"8e7cad6c7feb905bef112034757732a47f604523"},{"author":{"_account_id":12548,"name":"Dheeraj Gupta","email":"dheeraj.gupta4@gmail.com","username":"dgupta"},"change_message_id":"0a1e3977b32b71724ea6c1b3aa3bd68345bb0ca8","unresolved":false,"context_lines":[{"line_number":279,"context_line":"                    continue"},{"line_number":280,"context_line":""},{"line_number":281,"context_line":"                chost \u003d compute_hosts[host]"},{"line_number":282,"context_line":"                chost[\u0027free_ram_mb\u0027] +\u003d node[\u0027free_ram_mb\u0027]"},{"line_number":283,"context_line":"                free_disk \u003d node[\u0027free_disk_gb\u0027] * 1024"},{"line_number":284,"context_line":"                chost[\u0027free_disk_mb\u0027] +\u003d free_disk"},{"line_number":285,"context_line":"                chost[\u0027total_ram_mb\u0027] +\u003d node[\u0027memory_mb\u0027]"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba7be1f8_f8a00b45","line":282,"updated":"2015-02-24 07:44:31.000000000","message":"\"node\" is undefined","commit_id":"08f2e7831dea7a20882aa5865d1014bc1fc96a3e"},{"author":{"_account_id":10343,"name":"Jim Rollenhagen","email":"jim@jimrollenhagen.com","username":"jimrollenhagen"},"change_message_id":"ba28addc23c0aee998540424aa3a4f692b80438a","unresolved":false,"context_lines":[{"line_number":279,"context_line":"                    continue"},{"line_number":280,"context_line":""},{"line_number":281,"context_line":"                chost \u003d compute_hosts[host]"},{"line_number":282,"context_line":"                chost[\u0027free_ram_mb\u0027] +\u003d node[\u0027free_ram_mb\u0027]"},{"line_number":283,"context_line":"                free_disk \u003d node[\u0027free_disk_gb\u0027] * 1024"},{"line_number":284,"context_line":"                chost[\u0027free_disk_mb\u0027] +\u003d free_disk"},{"line_number":285,"context_line":"                chost[\u0027total_ram_mb\u0027] +\u003d node[\u0027memory_mb\u0027]"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba7be1f8_9c817cc5","line":282,"in_reply_to":"ba7be1f8_6780d746","updated":"2015-02-25 14:40:55.000000000","message":"Oops, fixing :)","commit_id":"08f2e7831dea7a20882aa5865d1014bc1fc96a3e"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"368f5bedbf3b2c80f29b013ae1cad3692c6e8906","unresolved":false,"context_lines":[{"line_number":279,"context_line":"                    continue"},{"line_number":280,"context_line":""},{"line_number":281,"context_line":"                chost \u003d compute_hosts[host]"},{"line_number":282,"context_line":"                chost[\u0027free_ram_mb\u0027] +\u003d node[\u0027free_ram_mb\u0027]"},{"line_number":283,"context_line":"                free_disk \u003d node[\u0027free_disk_gb\u0027] * 1024"},{"line_number":284,"context_line":"                chost[\u0027free_disk_mb\u0027] +\u003d free_disk"},{"line_number":285,"context_line":"                chost[\u0027total_ram_mb\u0027] +\u003d node[\u0027memory_mb\u0027]"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba7be1f8_6780d746","line":282,"in_reply_to":"ba7be1f8_f8a00b45","updated":"2015-02-24 20:57:49.000000000","message":"Hm,","commit_id":"08f2e7831dea7a20882aa5865d1014bc1fc96a3e"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"368f5bedbf3b2c80f29b013ae1cad3692c6e8906","unresolved":false,"context_lines":[{"line_number":279,"context_line":"                    continue"},{"line_number":280,"context_line":""},{"line_number":281,"context_line":"                chost \u003d compute_hosts[host]"},{"line_number":282,"context_line":"                chost[\u0027free_ram_mb\u0027] +\u003d node[\u0027free_ram_mb\u0027]"},{"line_number":283,"context_line":"                free_disk \u003d node[\u0027free_disk_gb\u0027] * 1024"},{"line_number":284,"context_line":"                chost[\u0027free_disk_mb\u0027] +\u003d free_disk"},{"line_number":285,"context_line":"                chost[\u0027total_ram_mb\u0027] +\u003d node[\u0027memory_mb\u0027]"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba7be1f8_47f2f306","line":282,"in_reply_to":"ba7be1f8_f8a00b45","updated":"2015-02-24 20:57:49.000000000","message":"Hm, something must have gotten mixed up during the rebase.","commit_id":"08f2e7831dea7a20882aa5865d1014bc1fc96a3e"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"8526d3618c63ea3462668b25462731490eddc7f4","unresolved":false,"context_lines":[{"line_number":263,"context_line":""},{"line_number":264,"context_line":"        def _defaultdict_int():"},{"line_number":265,"context_line":"            return collections.defaultdict(int)"},{"line_number":266,"context_line":"        compute_hosts \u003d collections.defaultdict(_defaultdict_int)"},{"line_number":267,"context_line":""},{"line_number":268,"context_line":"        def _get_compute_hosts():"},{"line_number":269,"context_line":"            service_refs \u003d {service.host: service"}],"source_content_type":"text/x-python","patch_set":11,"id":"5afe65bd_24ef27b2","line":266,"updated":"2015-06-01 20:00:21.000000000","message":"This could be a bit cleaner with a lambda here, or simpler with an \u0027chost \u003d compute_hosts.get(host); if chost is None: ... else: ...\u0027 below.  But not worth respinnning for.","commit_id":"d50f4fef268535747a274e1563494000d3bbbd37"}],"nova/tests/cells/test_cells_state_manager.py":[{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"bd59a554564fc8d05672eda73c39a7f6fee1c293","unresolved":false,"context_lines":[{"line_number":55,"context_line":"]"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"def _node(host, total_mem, total_disk, free_mem, free_disk):"},{"line_number":59,"context_line":"    service \u003d {\u0027host\u0027: host, \u0027disabled\u0027: False}"},{"line_number":60,"context_line":"    return {\u0027service\u0027: service,"},{"line_number":61,"context_line":"            \u0027memory_mb\u0027: total_mem,"}],"source_content_type":"text/x-python","patch_set":2,"id":"9aa7fdbe_51b7ecf4","line":58,"updated":"2014-10-27 09:30:19.000000000","message":"_fake_node or _create_fake_node, might be better now this is a top level thing. But its a micro nit really.","commit_id":"72e1adaaf169294b1ea3a2060be65c83a7829803"}],"nova/tests/unit/cells/test_cells_state_manager.py":[{"author":{"_account_id":475,"name":"Rick Harris","email":"rick.harris@rackspace.com","username":"rconradharris"},"change_message_id":"245125fe6456649ddea93eefc2439e6398743d4d","unresolved":false,"context_lines":[{"line_number":57,"context_line":""},{"line_number":58,"context_line":"def _create_fake_node(host, total_mem, total_disk, free_mem, free_disk):"},{"line_number":59,"context_line":"    service \u003d {\u0027host\u0027: host, \u0027disabled\u0027: False}"},{"line_number":60,"context_line":"    return {\u0027service\u0027: service,"},{"line_number":61,"context_line":"            \u0027host\u0027: host,"},{"line_number":62,"context_line":"            \u0027memory_mb\u0027: total_mem,"},{"line_number":63,"context_line":"            \u0027local_gb\u0027: total_disk,"}],"source_content_type":"text/x-python","patch_set":6,"id":"da86d52c_1271570c","line":60,"updated":"2015-02-16 22:31:57.000000000","message":"This needs to be updated now that we\u0027re using ComputeNode objects instead of just vanilla dictionaries.","commit_id":"8e7cad6c7feb905bef112034757732a47f604523"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"5cf656b82624bb0af021b32faa3bd7aff3dbc486","unresolved":false,"context_lines":[{"line_number":194,"context_line":""},{"line_number":195,"context_line":"        self.stubs.Set(db, \u0027compute_node_get_all\u0027,"},{"line_number":196,"context_line":"                       _fake_compute_node_n_to_one_get_all)"},{"line_number":197,"context_line":"        self.stubs.Set(db, \u0027flavor_get_all\u0027, _fake_instance_type_all)"},{"line_number":198,"context_line":""},{"line_number":199,"context_line":"    def test_capacity_part_reserve(self):"},{"line_number":200,"context_line":"        # utilize half the cell\u0027s free capacity"}],"source_content_type":"text/x-python","patch_set":6,"id":"da86d52c_cc6164aa","line":197,"updated":"2015-02-06 04:58:15.000000000","message":"I think you don\u0027t need this as TestCellsStateManager.setUp() already did the same thing.","commit_id":"8e7cad6c7feb905bef112034757732a47f604523"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"5cf656b82624bb0af021b32faa3bd7aff3dbc486","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        # utilize half the cell\u0027s free capacity"},{"line_number":201,"context_line":"        cap \u003d self._capacity(50.0)"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":"        cell_free_ram \u003d sum(compute[3] for compute in FAKE_COMPUTES)"},{"line_number":204,"context_line":"        self.assertEqual(cell_free_ram, cap[\u0027ram_free\u0027][\u0027total_mb\u0027])"},{"line_number":205,"context_line":""},{"line_number":206,"context_line":"        cell_free_disk \u003d 1024 * sum(compute[4] for compute in FAKE_COMPUTES)"}],"source_content_type":"text/x-python","patch_set":6,"id":"da86d52c_6c3dd82a","line":203,"updated":"2015-02-06 04:58:15.000000000","message":"Though the calculation is the same, I think this should use FAKE_COMPUTES_N_TO_ONE being this is TestCellsStateManagerNToOne, right?","commit_id":"8e7cad6c7feb905bef112034757732a47f604523"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"5cf656b82624bb0af021b32faa3bd7aff3dbc486","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        cell_free_ram \u003d sum(compute[3] for compute in FAKE_COMPUTES)"},{"line_number":204,"context_line":"        self.assertEqual(cell_free_ram, cap[\u0027ram_free\u0027][\u0027total_mb\u0027])"},{"line_number":205,"context_line":""},{"line_number":206,"context_line":"        cell_free_disk \u003d 1024 * sum(compute[4] for compute in FAKE_COMPUTES)"},{"line_number":207,"context_line":"        self.assertEqual(cell_free_disk, cap[\u0027disk_free\u0027][\u0027total_mb\u0027])"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"        self.assertEqual(0, cap[\u0027ram_free\u0027][\u0027units_by_mb\u0027][\u00270\u0027])"}],"source_content_type":"text/x-python","patch_set":6,"id":"da86d52c_ac4350ad","line":206,"updated":"2015-02-06 04:58:15.000000000","message":"Same comment.","commit_id":"8e7cad6c7feb905bef112034757732a47f604523"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"5cf656b82624bb0af021b32faa3bd7aff3dbc486","unresolved":false,"context_lines":[{"line_number":209,"context_line":"        self.assertEqual(0, cap[\u0027ram_free\u0027][\u0027units_by_mb\u0027][\u00270\u0027])"},{"line_number":210,"context_line":"        self.assertEqual(0, cap[\u0027disk_free\u0027][\u0027units_by_mb\u0027][\u00270\u0027])"},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"        units \u003d 6  # 6 from host 1"},{"line_number":213,"context_line":"        self.assertEqual(units, cap[\u0027ram_free\u0027][\u0027units_by_mb\u0027][\u002750\u0027])"},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"        sz \u003d 25 * 1024"}],"source_content_type":"text/x-python","patch_set":6,"id":"da86d52c_3c45c442","line":212,"updated":"2015-02-06 04:58:15.000000000","message":"Shouldn\u0027t this be \"from host 2\" also?","commit_id":"8e7cad6c7feb905bef112034757732a47f604523"},{"author":{"_account_id":475,"name":"Rick Harris","email":"rick.harris@rackspace.com","username":"rconradharris"},"change_message_id":"3ca526a37ab0f4f7d752b8e9827249c3d124ad9c","unresolved":false,"context_lines":[{"line_number":202,"context_line":"    def setUp(self):"},{"line_number":203,"context_line":"        super(TestCellsStateManagerNToOne, self).setUp()"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"        self.stubs.Set(objects.ComputeNodeList, \u0027get_all\u0027,"},{"line_number":206,"context_line":"                       _fake_compute_node_n_to_one_get_all)"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"    def test_capacity_part_reserve(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba7be1f8_f52ca604","line":205,"updated":"2015-02-23 20:23:33.000000000","message":"It might be better to use @mock.patch.object instead of `stubs`.\n\nIt seems like the emphasis has been in new tests to use `mock` where possible.","commit_id":"08f2e7831dea7a20882aa5865d1014bc1fc96a3e"},{"author":{"_account_id":10343,"name":"Jim Rollenhagen","email":"jim@jimrollenhagen.com","username":"jimrollenhagen"},"change_message_id":"ba28addc23c0aee998540424aa3a4f692b80438a","unresolved":false,"context_lines":[{"line_number":202,"context_line":"    def setUp(self):"},{"line_number":203,"context_line":"        super(TestCellsStateManagerNToOne, self).setUp()"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"        self.stubs.Set(objects.ComputeNodeList, \u0027get_all\u0027,"},{"line_number":206,"context_line":"                       _fake_compute_node_n_to_one_get_all)"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"    def test_capacity_part_reserve(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba7be1f8_1cfaec42","line":205,"in_reply_to":"ba7be1f8_00bc9adb","updated":"2015-02-25 14:40:55.000000000","message":"I\u0027m going to punt on this, since this is a subclass of TestCellsStateManager, I\u0027d have to change stubs to mock there as well.","commit_id":"08f2e7831dea7a20882aa5865d1014bc1fc96a3e"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"ee10cf6d6abe7886a2b9c218bb34e467b80753c3","unresolved":false,"context_lines":[{"line_number":202,"context_line":"    def setUp(self):"},{"line_number":203,"context_line":"        super(TestCellsStateManagerNToOne, self).setUp()"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"        self.stubs.Set(objects.ComputeNodeList, \u0027get_all\u0027,"},{"line_number":206,"context_line":"                       _fake_compute_node_n_to_one_get_all)"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"    def test_capacity_part_reserve(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba7be1f8_00bc9adb","line":205,"in_reply_to":"ba7be1f8_f52ca604","updated":"2015-02-23 20:49:21.000000000","message":"This is true, it\u0027s best if we use mock for new tests. Can easily do this by setting the mock.side_effect to _fake_compute_node_n_to_one_get_all I think","commit_id":"08f2e7831dea7a20882aa5865d1014bc1fc96a3e"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"8a9964f0edca42e705ed16641c77988d54297364","unresolved":false,"context_lines":[{"line_number":221,"context_line":"        self.assertEqual(0, cap[\u0027ram_free\u0027][\u0027units_by_mb\u0027][\u00270\u0027])"},{"line_number":222,"context_line":"        self.assertEqual(0, cap[\u0027disk_free\u0027][\u0027units_by_mb\u0027][\u00270\u0027])"},{"line_number":223,"context_line":""},{"line_number":224,"context_line":"        units \u003d 6  # 6 from host 1"},{"line_number":225,"context_line":"        self.assertEqual(units, cap[\u0027ram_free\u0027][\u0027units_by_mb\u0027][\u002750\u0027])"},{"line_number":226,"context_line":""},{"line_number":227,"context_line":"        sz \u003d 25 * 1024"}],"source_content_type":"text/x-python","patch_set":10,"id":"7a016987_e731b40c","line":224,"updated":"2015-05-28 05:02:24.000000000","message":"I think you meant \"6 from host 2\"","commit_id":"b5067b46c8b6115f26192bf8b68b63738d906c1d"},{"author":{"_account_id":14760,"name":"John L. Villalovos","email":"openstack.org@sodarock.com","username":"jlvillal"},"change_message_id":"dbe30f10c061f55633f12d0826405c4ff03f2acf","unresolved":false,"context_lines":[{"line_number":221,"context_line":"        self.assertEqual(0, cap[\u0027ram_free\u0027][\u0027units_by_mb\u0027][\u00270\u0027])"},{"line_number":222,"context_line":"        self.assertEqual(0, cap[\u0027disk_free\u0027][\u0027units_by_mb\u0027][\u00270\u0027])"},{"line_number":223,"context_line":""},{"line_number":224,"context_line":"        units \u003d 6  # 6 from host 1"},{"line_number":225,"context_line":"        self.assertEqual(units, cap[\u0027ram_free\u0027][\u0027units_by_mb\u0027][\u002750\u0027])"},{"line_number":226,"context_line":""},{"line_number":227,"context_line":"        sz \u003d 25 * 1024"}],"source_content_type":"text/x-python","patch_set":10,"id":"7a016987_f94023a7","line":224,"in_reply_to":"7a016987_e731b40c","updated":"2015-05-28 16:22:22.000000000","message":"Thanks.  Done.","commit_id":"b5067b46c8b6115f26192bf8b68b63738d906c1d"}]}
