hypervisors: Optimize uptime retrieval for better performance
The /os-hypervisors/detail API endpoint was experiencing significant performance issues in environments with many compute nodes when using microversion 2.88 or higher, as it made sequential RPC calls to gather uptime information from each compute node. This change optimizes uptime retrieval by: * Adding uptime to periodic resource updates sent by nova-compute to the database, eliminating synchronous RPC calls during API requests * Restricting RPC-based uptime retrieval to hypervisor types that support it (libvirt and z/VM), avoiding unnecessary calls that would always fail * Preferring cached database uptime data over RPC calls when available Closes-Bug: #2122036 Assisted-By: Claude <noreply@anthropic.com> Change-Id: I5723320f578192f7e0beead7d5df5d7e47d54d2b Co-Authored-By: Sylvain Bauza <sbauza@redhat.com> Signed-off-by: Sean Mooney <work@seanmooney.info>
This commit is contained in:
@@ -3902,8 +3902,11 @@ hypervisor_type_body:
|
||||
type: string
|
||||
hypervisor_uptime:
|
||||
description: |
|
||||
The total uptime of the hypervisor and information about average load. Only
|
||||
reported for active hosts where the virt driver supports this feature.
|
||||
The response format of this api depends on the virt driver in use on a
|
||||
given host. The libvirt driver returns the output of the `uptime` command
|
||||
directly, the z/VM driver returns the `ILP` time. All other drivers
|
||||
always return `null`. Note this value is cached and updated periodically.
|
||||
|
||||
in: body
|
||||
required: true
|
||||
type: string
|
||||
|
||||
Reference in New Issue
Block a user