← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1187708] Re: CE:havana: aggregate_get_by_host return all aggregates

 

** Changed in: nova
       Status: Fix Committed => Fix Released

** Changed in: nova
    Milestone: None => havana-2

-- 
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/1187708

Title:
  CE:havana: aggregate_get_by_host return all aggregates

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  Nova version: CE, havana
  Description:
  nova.db.aggregate_get_by_host() return all aggregates, it should return the aggregates which contain the host.

  Test environment:
  1. cmd line:
  allengao@allengao-OptiPlex-790:/opt/stack/nova$ nova aggregate-list
  +----+------+-------------------+
  | Id | Name | Availability Zone |
  +----+------+-------------------+
  | 1  | agg1 | None              |
  | 2  | agg2 | None              |
  | 3  | agg3 | None              |
  +----+------+-------------------+

  allengao@allengao-OptiPlex-790:/opt/stack/nova$ nova aggregate-details 1
  +----+------+-------------------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  | Id | Name | Availability Zone | Hosts | Metadata                                                                                                                                                                                                                                                                                                      |
  +----+------+-------------------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  | 1  | agg1 | None              | []    | {u'ongoingpolicy::max_parallel': u'10', u'initialpolicy::id': u'3', u'ongoingpolicy::threshold': u'80', u'ongoing-policy::threshold': u'70', u'test': u'2', u'ongoingpolicy::stabilization': u'3', u'ongoingpolicy::id': u'1', u'ongoingpolicy::action': u'migrate_vm', u'ongoingpolicy::run_interval': u'1'} |
  +----+------+-------------------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

  allengao@allengao-OptiPlex-790:/opt/stack/nova$ nova aggregate-details 2
  +----+------+-------------------+----------------------------+----------+
  | Id | Name | Availability Zone | Hosts                      | Metadata |
  +----+------+-------------------+----------------------------+----------+
  | 2  | agg2 | None              | [u'allengao-OptiPlex-790'] | {}       |
  +----+------+-------------------+----------------------------+----------+

  allengao@allengao-OptiPlex-790:/opt/stack/nova$ nova aggregate-create agg3
  +----+------+-------------------+-------+----------+
  | Id | Name | Availability Zone | Hosts | Metadata |
  +----+------+-------------------+-------+----------+
  | 3  | agg3 | None              |       |          |
  +----+------+-------------------+-------+----------+

  2. DB
  mysql> select * from aggregates;
  +---------------------+------------+------------+----+------+---------+
  | created_at          | updated_at | deleted_at | id | name | deleted |
  +---------------------+------------+------------+----+------+---------+
  | 2013-06-03 09:46:08 | NULL       | NULL       |  1 | agg1 |       0 |
  | 2013-06-05 07:51:09 | NULL       | NULL       |  2 | agg2 |       0 |
  | 2013-06-05 09:17:42 | NULL       | NULL       |  3 | agg3 |       0 |
  +---------------------+------------+------------+----+------+---------+

  mysql> select * from aggregate_hosts;
  +---------------------+------------+------------+----+-----------------------+--------------+---------+
  | created_at          | updated_at | deleted_at | id | host                  | aggregate_id | deleted |
  +---------------------+------------+------------+----+-----------------------+--------------+---------+
  | 2013-06-05 08:50:42 | NULL       | NULL       |  3 | allengao-OptiPlex-790 |            2 |       0 |
  +---------------------+------------+------------+----+-----------------------+--------------+---------+

  3. Debug message
  137                 host = service['host']
  138  ->             aggregates = db.aggregate_get_by_host(self.context, host)
  139                 agg_name = []
  140                 for agg in aggregates:
  141                     agg_name.append(agg.name)
  142                 host_aggregate_map[host] = agg_name
  143             self.host_aggregate_map = host_aggregate_map
  (Pdb) p host
  u'allengao-OptiPlex-790'

  
  (Pdb) l
  138                 aggregates = db.aggregate_get_by_host(self.context, host)
  139                 agg_name = []
  140                 for agg in aggregates:
  141                     agg_name.append(agg.name)
  142                 host_aggregate_map[host] = agg_name
  143  ->         self.host_aggregate_map = host_aggregate_map
  [EOF]
  (Pdb) p agg_name
  [u'agg1', u'agg2', u'agg3']

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