← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1215295] Re: get_all_flavor cannot return all flavors if the deleted flavor has same name

 

** 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/1215295

Title:
  get_all_flavor cannot return all flavors if the deleted flavor has
  same name

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  Now it is allowed that the flavor with specified name was deleted, and
  later a new flavor is created with the same name, by this way, you can
  there are two records in the DB (table "instance_types") with the same
  name but different id/flavorid.

  But if you are going to retrieve all flavors via
  nova.compute.flavors:get_all_flavors(inactive=True), you would find
  that only the last flavor which has the same name can be fetched. This
  is because that all instance types retrieved from DB will be set into
  a dict and the 'name' is used as the key.

  +---------------------+---------------------+---------------------+-------------+----+-----------+-------+------+-------------+----------+-------------+---------+--------------+----------+-----------+---------+
  | created_at          | updated_at          | deleted_at          | name        | id | memory_mb | vcpus | swap | vcpu_weight | flavorid | rxtx_factor | root_gb | ephemeral_gb | disabled | is_public | deleted |
  +---------------------+---------------------+---------------------+-------------+----+-----------+-------+------+-------------+----------+-------------+---------+--------------+----------+-----------+---------+
  | NULL                | NULL                | NULL                | m1.medium   |  1 |      4096 |     2 |    0 |        NULL | 3        |           1 |      40 |            0 |        0 |         1 |       0 |
  | NULL                | NULL                | NULL                | m1.tiny     |  2 |       512 |     1 |    0 |        NULL | 1        |           1 |       1 |            0 |        0 |         1 |       0 |
  | NULL                | NULL                | NULL                | m1.large    |  3 |      8192 |     4 |    0 |        NULL | 4        |           1 |      80 |            0 |        0 |         1 |       0 |
  | NULL                | NULL                | NULL                | m1.xlarge   |  4 |     16384 |     8 |    0 |        NULL | 5        |           1 |     160 |            0 |        0 |         1 |       0 |
  | NULL                | NULL                | NULL                | m1.small    |  5 |      2048 |     1 |    0 |        NULL | 2        |           1 |      20 |            0 |        0 |         1 |       0 |
  | 2013-08-21 23:31:35 | 2013-08-21 23:31:49 | 2013-08-21 23:31:49 | test_flavor |  6 |       512 |     1 |    0 |        NULL | 20       |           1 |       0 |            0 |        0 |         1 |       6 |
  | 2013-08-21 23:36:04 | 2013-08-21 23:37:12 | 2013-08-21 23:37:12 | test_flavor |  7 |      4598 |     1 |    0 |        NULL | 22       |           1 |       0 |            0 |        0 |         1 |       7 |
  | 2013-08-21 23:37:23 | 2013-08-21 23:37:29 | 2013-08-21 23:37:29 | test_flavor |  8 |      1916 |     1 |    0 |        NULL | 22       |           1 |       0 |            0 |        0 |         1 |       8 |
  | 2013-08-21 23:37:36 | 2013-08-21 23:38:30 | 2013-08-21 23:38:30 | tmp         |  9 |       512 |     1 |    0 |        NULL | 20       |           1 |       0 |            0 |        0 |         1 |       9 |
  | 2013-08-22 01:41:48 | 2013-08-22 01:42:42 | 2013-08-22 01:42:42 | tmp         | 10 |      1024 |     8 |    0 |        NULL | 20       |           1 |       0 |            0 |        0 |         1 |      10 |
  | 2013-08-22 01:43:00 | 2013-08-22 01:45:11 | 2013-08-22 01:45:11 | tmp         | 11 |      1024 |     3 |    0 |        NULL | 6        |           1 |       0 |            0 |        0 |         1 |      11 |
  | 2013-08-22 01:45:13 | 2013-08-22 01:47:14 | 2013-08-22 01:47:14 | tmp         | 12 |      1024 |     3 |    0 |        NULL | 6        |           1 |       0 |            0 |        0 |         1 |      12 |
  | 2013-08-22 01:47:17 | 2013-08-22 01:49:18 | 2013-08-22 01:49:18 | tmp         | 13 |      1024 |     3 |    0 |        NULL | 6        |           1 |       0 |            0 |        0 |         1 |      13 |
  | 2013-08-22 01:49:20 | 2013-08-22 01:51:26 | 2013-08-22 01:51:26 | tmp         | 14 |      1024 |     9 |    0 |        NULL | 6        |           1 |       0 |            0 |        0 |         1 |      14 |
  | 2013-08-22 01:51:29 | 2013-08-22 01:53:30 | 2013-08-22 01:53:30 | tmp         | 15 |      1024 |     9 |    0 |        NULL | 6        |           1 |       0 |            0 |        0 |         1 |      15 |
  | 2013-08-22 01:53:32 | 2013-08-22 01:55:32 | 2013-08-22 01:55:32 | tmp         | 16 |      1024 |     9 |    0 |        NULL | 6        |           1 |       0 |            0 |        0 |         1 |      16 |
  | 2013-08-22 01:55:57 | 2013-08-22 01:56:28 | 2013-08-22 01:56:28 | tmp         | 17 |      1024 |     8 |    0 |        NULL | 6        |           1 |       0 |            0 |        0 |         1 |      17 |
  +---------------------+---------------------+---------------------+-------------+----+-----------+-------+------+-------------+----------+-------------+---------+-------------

  flavor_refs = flavors.get_all_flavors(self.ctxt, inactive=True)

  (Pdb) for flavor in flavor_refs.values(): flavor['id']
  1L
  17L
  5L
  3L
  2L
  4L
  8L
  (Pdb) flavor_refs.keys()
  [u'm1.medium', u'tmp', u'm1.small', u'm1.large', u'm1.tiny', u'm1.xlarge', u'test_flavor']

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