← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1632247] Re: nova list --all-tenants fetches all instance faults but uses only latest

 

Reviewed:  https://review.openstack.org/409943
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=176c5c8a65efbde01020bc69a97bb7d05720589e
Submitter: Jenkins
Branch:    master

commit 176c5c8a65efbde01020bc69a97bb7d05720589e
Author: Jay Pipes <jaypipes@xxxxxxxxx>
Date:   Mon Dec 12 16:39:23 2016 -0500

    Only return latest instance fault for instances
    
    This patch addresses slowness that can occur when doing a list servers
    API operation when there are many thousands of records in the
    instance_faults table.
    
    Previously, in the Instance.fill_faults() method, we were getting all
    instance fault records for a set of instances having one of a set of
    supplied instance UUIDs and then iterating over those faults and
    returning a dict of instance UUID to the first fault returned (which
    happened to be the latest fault because of ordering the SQL query by
    created_at).
    
    This patch adds a new InstanceFaultList.get_latest_by_instance_uuids()
    method that does some SQL-fu to only return the latest fault records for
    each instance being inspected.
    
    Closes-Bug: #1632247
    
    Co-Authored-By: Roman Podoliaka <rpodolyaka@xxxxxxxxxxxx>
    Change-Id: I8f2227b3969791ebb2d04d74a316b9d97a4b1571


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1632247

Title:
  nova list --all-tenants fetches all instance faults but uses only
  latest

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  Description
  ===========
  There are 15 instances. I excute the command: nova --debug list --all-tenants,
  But it took more than 40 seconds. I read the nova api code, it sends a Get request
  and read the instance_faults table for detail information. The instance_faults table has
   more than tens of thousands of records. Each instance has many records.

         GET /v2/433288e1244046a9bd306658b732dded/servers/detail

  I think instance_faults table needs to be optimized. A large number of records in the instance_faults
  table are useless, only leaving the last three records should be on it, others can be deleted.

  There are any other optimization program?

  Steps to reproduce
  ==================
  A chronological list of steps which will bring off the
  issue you noticed:
  * I excute the command: nova --debug list --all-tenants

  A list of openstack client commands (with correct argument value)
      $ nova --debug list --all-tenants

  
  Expected result
  ===============
  I expect to be back soon within 10 seconds

  Actual result
  =============
  But the query took more than 40 seconds.

  Environment
  ===========
  1. version 
      Mitaka

  2. Which hypervisor did you use?
      Libvirt + KVM

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1632247/+subscriptions


References