Comment 3 for bug 1692397

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/467220
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=3d3e9cdd774efe96f468f2bcba6c09a40f5e71d3
Submitter: Jenkins
Branch: master

commit 3d3e9cdd774efe96f468f2bcba6c09a40f5e71d3
Author: Kevin_Zheng <email address hidden>
Date: Tue May 23 20:28:28 2017 +0800

    Exclude deleted service records when calling hypervisor statistics

    Hypervisor statistics could be incorrect if not
    exclude deleted service records from DB.

    User may stop 'nova-compute' service on some
    compute nodes and delete the service from nova.
    When delete 'nova-compute' service, it performs
    'soft-delete' to the corresponding db records in
    both 'service' table and 'compute_nodes' table if
    the compute_nodes record is old, i.e. it is linked
    to the service record. For modern compute_nodes
    records, they aren't linked to the services table
    so deleting the services record will not delete
    the compute_nodes record, and the ResourceTracker
    won't recreate the compute_nodes record if the host
    and hypervisor_hostname still match the existing
    record, but restarting the process after deleting
    the service will create a new services table record
    with the same host/binary/topic.

    If the 'nova-compute' service on that server
    re-starts, it will automatically add a record
    in 'compute_nodes' table (assuming it was deleted
    because it was an old-style record) and also a correspoding
    record in 'service' table, and if the host name
    of the compute node did not change, the newly
    created records in 'service' and 'compute_nodes'
    table will be identical to the priously soft-deleted
    records except the deleted row.

    When calling Hypervisor-statistics, the DB layer
    joined records across the whole deployment by
    comparing records' host field selected from
    serivce table and records' host field selected
    from compute_nodes table, and the calculated
    results could be multiplied if multiple records
    from service table have the same host field,
    and this scenario could happen if user perform
    the above actions.

    Co-Authored-By: Matt Riedemann <email address hidden>

    Change-Id: I9dfa15f69f8ef9c6cb36b2734a8601bd73e9d6b3
    Closes-Bug: #1692397