← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1224712] Re: Cannot get ComputeNodeStat by DB utility of compute_node_get_all()

 

** Changed in: nova
       Status: Fix Committed => 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/1224712

Title:
  Cannot get ComputeNodeStat by DB utility of compute_node_get_all()

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  When there is hypervisor gets removed, the compute_node_get_all() will
  not return stat for new added hypervisors.

  In the following codes of compute_node_get_all() of
  nova/db/sqlalchemy, it assume all the record in compute_node_stats
  should have a matched compute node. However in current implementation
  of nova conductor API of compute_node_delete(), the records in
  compute_node_stats is not deleted. Therefore when a hypervisor gets
  removed, there is no node matching the record of compute_node_stats
  which belongs to the removed hypervisor in following codes. As a
  result, all the nodes will be set with 'stats' of [].

      # Join ComputeNode & ComputeNodeStat manually.
      # NOTE(msdubov): ComputeNode and ComputeNodeStat map 1-to-Many.
      #                Running time is (asymptotically) optimal due to the use
      #                of iterators (itertools.groupby() for ComputeNodeStat and
      #                iter() for ComputeNode) - we handle each record only once.
      compute_nodes.sort(key=lambda node: node['id'])
      compute_nodes_iter = iter(compute_nodes)
      for nid, nsts in itertools.groupby(stats, lambda s: s['compute_node_id']):
          for node in compute_nodes_iter:
              if node['id'] == nid:
                  node['stats'] = list(nsts)
                  break
              else:
                  node['stats'] = []

      return compute_nodes

  We need enhance either nova conductor API to clean up all the record
  related with instance.

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