)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc9c960346a29d30c1001dd56c9193602dd8a748","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Kevin_Zheng \u003czhengzhenyu@huawei.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2017-05-24 15:05:51 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Exclude deleted service records when calling hyervisor statistics"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Hypervisor statistics could be incorrect if not exclude"},{"line_number":10,"context_line":"deleted service records from DB."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"ff0f0b1f_e95cfa19","line":7,"range":{"start_line":7,"start_character":45,"end_line":7,"end_character":54},"updated":"2017-05-25 02:15:07.000000000","message":"hypervisor","commit_id":"06fe2f9ebd025c55d1023b15a27b2957412c8546"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc9c960346a29d30c1001dd56c9193602dd8a748","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Exclude deleted service records when calling hyervisor statistics"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Hypervisor statistics could be incorrect if not exclude"},{"line_number":10,"context_line":"deleted service records from DB."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: I9dfa15f69f8ef9c6cb36b2734a8601bd73e9d6b3"},{"line_number":13,"context_line":"Closes-Bug: #1692397"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"ff0f0b1f_69a6aa11","line":10,"range":{"start_line":9,"start_character":0,"end_line":10,"end_character":32},"updated":"2017-05-25 02:15:07.000000000","message":"Please provide more information here. You should be able to summarize some of what was reported in the bug about having a service running, stopping the compute service on the node, deleting the service record, and then restarting the nova-compute service on the node which creates a new service record, but because we\u0027re not filtering out the deleted one, we\u0027re double reporting the stats.","commit_id":"06fe2f9ebd025c55d1023b15a27b2957412c8546"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a225801ca1e5fd54ca76f8ab49692065986c514d","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Kevin_Zheng \u003czhengzhenyu@huawei.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2017-05-25 19:37:58 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Exclude deleted service records when calling hyperrvisor statistics"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Hypervisor statistics could be incorrect if not"},{"line_number":10,"context_line":"exclude deleted service records from DB."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"ff0f0b1f_4852ae14","line":7,"range":{"start_line":7,"start_character":45,"end_line":7,"end_character":56},"updated":"2017-05-25 14:43:23.000000000","message":"hypervisor","commit_id":"263e7b9f60a72c91a661de705e1f403c067e52c2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a225801ca1e5fd54ca76f8ab49692065986c514d","unresolved":false,"context_lines":[{"line_number":13,"context_line":"compute nodes and delete the service from nova."},{"line_number":14,"context_line":"When delete \u0027nova-compute\u0027 service, it performs"},{"line_number":15,"context_line":"\u0027soft-delete\u0027 to the corresponding db records in"},{"line_number":16,"context_line":"both \u0027service\u0027 table and \u0027compute_nodes\u0027 table."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"If the \u0027nova-compute\u0027 service on that server"},{"line_number":19,"context_line":"re-starts, it will automatically add a record"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"ff0f0b1f_8843263f","line":16,"range":{"start_line":16,"start_character":21,"end_line":16,"end_character":47},"updated":"2017-05-25 14:43:23.000000000","message":"I don\u0027t think this is true - can you link to the code where DELETE /os-services/{service_id} actually deletes a compute node record?","commit_id":"263e7b9f60a72c91a661de705e1f403c067e52c2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"45e311d662b580207525a37a83559e4d35b13be6","unresolved":false,"context_lines":[{"line_number":13,"context_line":"compute nodes and delete the service from nova."},{"line_number":14,"context_line":"When delete \u0027nova-compute\u0027 service, it performs"},{"line_number":15,"context_line":"\u0027soft-delete\u0027 to the corresponding db records in"},{"line_number":16,"context_line":"both \u0027service\u0027 table and \u0027compute_nodes\u0027 table."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"If the \u0027nova-compute\u0027 service on that server"},{"line_number":19,"context_line":"re-starts, it will automatically add a record"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"ff0f0b1f_5d8dcf2f","line":16,"range":{"start_line":16,"start_character":21,"end_line":16,"end_character":47},"in_reply_to":"ff0f0b1f_8843263f","updated":"2017-05-25 15:38:36.000000000","message":"You\u0027re right, I found it:\n\nhttps://github.com/openstack/nova/blob/65402e1aeb770d077620f2935a0cb305474aa7a1/nova/db/sqlalchemy/api.py#L461\n\nNote, however, that this is only for really old compute_nodes records, we no longer create a compute node record linked to the service record - but the db api tests setup things that way, which is why it\u0027s not working in the test as expected.","commit_id":"263e7b9f60a72c91a661de705e1f403c067e52c2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a225801ca1e5fd54ca76f8ab49692065986c514d","unresolved":false,"context_lines":[{"line_number":15,"context_line":"\u0027soft-delete\u0027 to the corresponding db records in"},{"line_number":16,"context_line":"both \u0027service\u0027 table and \u0027compute_nodes\u0027 table."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"If the \u0027nova-compute\u0027 service on that server"},{"line_number":19,"context_line":"re-starts, it will automatically add a record"},{"line_number":20,"context_line":"in \u0027compute_nodes\u0027 table and also a correspoding"},{"line_number":21,"context_line":"record in \u0027service\u0027 table, and if the host name"},{"line_number":22,"context_line":"of the compute node did not change, the newly"},{"line_number":23,"context_line":"created records in \u0027service\u0027 and \u0027compute_nodes\u0027"},{"line_number":24,"context_line":"table will be identical to the priously soft-deleted"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"ff0f0b1f_087156a8","line":21,"range":{"start_line":18,"start_character":0,"end_line":21,"end_character":25},"updated":"2017-05-25 14:43:23.000000000","message":"I agree with this yes.","commit_id":"263e7b9f60a72c91a661de705e1f403c067e52c2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a225801ca1e5fd54ca76f8ab49692065986c514d","unresolved":false,"context_lines":[{"line_number":21,"context_line":"record in \u0027service\u0027 table, and if the host name"},{"line_number":22,"context_line":"of the compute node did not change, the newly"},{"line_number":23,"context_line":"created records in \u0027service\u0027 and \u0027compute_nodes\u0027"},{"line_number":24,"context_line":"table will be identical to the priously soft-deleted"},{"line_number":25,"context_line":"records except the deleted row."},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"When calling Hypervisor-statistics, the DB layer"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"ff0f0b1f_287c1a70","line":24,"range":{"start_line":24,"start_character":14,"end_line":24,"end_character":23},"updated":"2017-05-25 14:43:23.000000000","message":"They won\u0027t be identical, they will have a new uuid which is auto-generated:\n\nhttps://github.com/openstack/nova/blob/65402e1aeb770d077620f2935a0cb305474aa7a1/nova/objects/service.py#L340\n\nhttps://github.com/openstack/nova/blob/65402e1aeb770d077620f2935a0cb305474aa7a1/nova/objects/compute_node.py#L312\n\nAnd uuid is a unique constraint on both tables.\n\nAs noted earlier, we don\u0027t actually delete the compute nodes table though, which is why I think we\u0027re double-accounting for 2 services on the same compute node record in this stats DB API query.","commit_id":"263e7b9f60a72c91a661de705e1f403c067e52c2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a225801ca1e5fd54ca76f8ab49692065986c514d","unresolved":false,"context_lines":[{"line_number":21,"context_line":"record in \u0027service\u0027 table, and if the host name"},{"line_number":22,"context_line":"of the compute node did not change, the newly"},{"line_number":23,"context_line":"created records in \u0027service\u0027 and \u0027compute_nodes\u0027"},{"line_number":24,"context_line":"table will be identical to the priously soft-deleted"},{"line_number":25,"context_line":"records except the deleted row."},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"When calling Hypervisor-statistics, the DB layer"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"ff0f0b1f_885c4619","line":24,"range":{"start_line":24,"start_character":31,"end_line":24,"end_character":39},"updated":"2017-05-25 14:43:23.000000000","message":"previously","commit_id":"263e7b9f60a72c91a661de705e1f403c067e52c2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a225801ca1e5fd54ca76f8ab49692065986c514d","unresolved":false,"context_lines":[{"line_number":26,"context_line":""},{"line_number":27,"context_line":"When calling Hypervisor-statistics, the DB layer"},{"line_number":28,"context_line":"joined records across the whole deployment by"},{"line_number":29,"context_line":"camparing records\u0027 host field selected from"},{"line_number":30,"context_line":"serivce table and records\u0027 host field selected"},{"line_number":31,"context_line":"from compute_nodes table, and the calculated"},{"line_number":32,"context_line":"results could be multiplied if multiple records"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"ff0f0b1f_08f4b6ef","line":29,"range":{"start_line":29,"start_character":0,"end_line":29,"end_character":9},"updated":"2017-05-25 14:43:23.000000000","message":"comparing","commit_id":"263e7b9f60a72c91a661de705e1f403c067e52c2"}],"nova/db/sqlalchemy/api.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a225801ca1e5fd54ca76f8ab49692065986c514d","unresolved":false,"context_lines":[{"line_number":789,"context_line":"        inner_sel, services_tbl,"},{"line_number":790,"context_line":"        sql.and_("},{"line_number":791,"context_line":"            sql.or_("},{"line_number":792,"context_line":"                inner_sel.c.host \u003d\u003d services_tbl.c.host,"},{"line_number":793,"context_line":"                inner_sel.c.service_id \u003d\u003d services_tbl.c.id"},{"line_number":794,"context_line":"            ),"},{"line_number":795,"context_line":"            services_tbl.c.disabled \u003d\u003d false(),"}],"source_content_type":"text/x-python","patch_set":4,"id":"ff0f0b1f_6839f2a1","line":792,"range":{"start_line":792,"start_character":16,"end_line":792,"end_character":56},"updated":"2017-05-25 14:43:23.000000000","message":"Because the compute_nodes record isn\u0027t deleted, when you restart the service and it re-creates the services record, it will be unique per uuid but have the same host, so that\u0027s why we end up getting 2 services for the single compute node record, but one is deleted and the other isn\u0027t.","commit_id":"263e7b9f60a72c91a661de705e1f403c067e52c2"}],"nova/tests/unit/db/test_db_api.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"00edb71755a9649b660e801282d977b210033cfb","unresolved":false,"context_lines":[{"line_number":7846,"context_line":"                                 free_disk_gb\u003d2048, hypervisor_type\u003d\"xen\","},{"line_number":7847,"context_line":"                                 hypervisor_version\u003d1, cpu_info\u003d\"\","},{"line_number":7848,"context_line":"                                 running_vms\u003d0, current_workload\u003d0,"},{"line_number":7849,"context_line":"                                 service_id\u003dself.service[\u0027id\u0027],"},{"line_number":7850,"context_line":"                                 host\u003dself.service[\u0027host\u0027],"},{"line_number":7851,"context_line":"                                 disk_available_least\u003d100,"},{"line_number":7852,"context_line":"                                 hypervisor_hostname\u003d\u0027abracadabra104\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"ff0f0b1f_a9e282d3","line":7849,"range":{"start_line":7849,"start_character":33,"end_line":7849,"end_character":62},"updated":"2017-05-25 02:30:43.000000000","message":"You have a single compute node record pointing at this service record, so you\u0027re going to need to create another compute node record for your 2nd service I think in your test, something like that.","commit_id":"06fe2f9ebd025c55d1023b15a27b2957412c8546"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"64b9b9354aebdd23579766716fd3c724cf398447","unresolved":false,"context_lines":[{"line_number":8292,"context_line":""},{"line_number":8293,"context_line":"        db.service_destroy(self.ctxt, db_service2[\u0027id\u0027])"},{"line_number":8294,"context_line":""},{"line_number":8295,"context_line":"        db.service_create(self.ctxt, service2)"},{"line_number":8296,"context_line":""},{"line_number":8297,"context_line":"        stats \u003d db.compute_node_statistics(self.ctxt)"},{"line_number":8298,"context_line":"        data \u003d {\u0027count\u0027: 2,"}],"source_content_type":"text/x-python","patch_set":2,"id":"ff0f0b1f_e94d1a3b","line":8295,"updated":"2017-05-25 02:19:33.000000000","message":"Don\u0027t you need a unique uuid on the service record here? We have a unique constraint on the uuid I think, so you can\u0027t have two service records with the same uuid.","commit_id":"06fe2f9ebd025c55d1023b15a27b2957412c8546"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a225801ca1e5fd54ca76f8ab49692065986c514d","unresolved":false,"context_lines":[{"line_number":8291,"context_line":"        # node statistics."},{"line_number":8292,"context_line":""},{"line_number":8293,"context_line":"        service2_dict \u003d self.service_dict.copy()"},{"line_number":8294,"context_line":"        service2_dict[\u0027host\u0027] \u003d \u0027host2\u0027"},{"line_number":8295,"context_line":"        service2 \u003d db.service_create(self.ctxt, service2_dict)"},{"line_number":8296,"context_line":"        compute_node2_dict \u003d dict(vcpus\u003d2, memory_mb\u003d1024, local_gb\u003d2048,"},{"line_number":8297,"context_line":"                                  uuid\u003duuidsentinel.fake_compute_node,"},{"line_number":8298,"context_line":"                                  vcpus_used\u003d0, memory_mb_used\u003d0,"},{"line_number":8299,"context_line":"                                  local_gb_used\u003d0, free_ram_mb\u003d1024,"},{"line_number":8300,"context_line":"                                  free_disk_gb\u003d2048, hypervisor_type\u003d\"xen\","},{"line_number":8301,"context_line":"                                  hypervisor_version\u003d1, cpu_info\u003d\"\","},{"line_number":8302,"context_line":"                                  running_vms\u003d0, current_workload\u003d0,"},{"line_number":8303,"context_line":"                                  service_id\u003dservice2[\u0027id\u0027],"},{"line_number":8304,"context_line":"                                  host\u003dservice2[\u0027host\u0027],"},{"line_number":8305,"context_line":"                                  disk_available_least\u003d100,"},{"line_number":8306,"context_line":"                                  hypervisor_hostname\u003d\u0027abcde11\u0027,"},{"line_number":8307,"context_line":"                                  host_ip\u003d\u0027127.0.0.1\u0027,"},{"line_number":8308,"context_line":"                                  supported_instances\u003d\u0027\u0027,"},{"line_number":8309,"context_line":"                                  pci_stats\u003d\u0027\u0027,"},{"line_number":8310,"context_line":"                                  metrics\u003d\u0027\u0027,"},{"line_number":8311,"context_line":"                                  mapped\u003d0,"},{"line_number":8312,"context_line":"                                  extra_resources\u003d\u0027\u0027,"},{"line_number":8313,"context_line":"                                  cpu_allocation_ratio\u003d16.0,"},{"line_number":8314,"context_line":"                                  ram_allocation_ratio\u003d1.5,"},{"line_number":8315,"context_line":"                                  disk_allocation_ratio\u003d1.0,"},{"line_number":8316,"context_line":"                                  stats\u003d\u0027\u0027, numa_topology\u003d\u0027\u0027)"},{"line_number":8317,"context_line":"        db.compute_node_create(self.ctxt, compute_node2_dict)"},{"line_number":8318,"context_line":"        stats \u003d db.compute_node_statistics(self.ctxt)"},{"line_number":8319,"context_line":"        data \u003d {\u0027count\u0027: 2,"},{"line_number":8320,"context_line":"                \u0027vcpus_used\u0027: 0,"}],"source_content_type":"text/x-python","patch_set":4,"id":"ff0f0b1f_881446ea","line":8317,"range":{"start_line":8294,"start_character":8,"end_line":8317,"end_character":61},"updated":"2017-05-25 14:43:23.000000000","message":"I think this is actually problematic for the test. I think what we really have in the bug is one compute_nodes record and 2 services records with different uuids but the same host value. So the test would really be, copy self.service, delete self.service, and then create a new service record from the copy (change the id and uuid in the new service record too).","commit_id":"263e7b9f60a72c91a661de705e1f403c067e52c2"}]}
