Cell type is overwritten when update a cell without cell-type specified

Bug #1224461 reported by wingwj
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
wingwj

Bug Description

I create a 'parent' cell through API, and update its 'name' only.

And I found, the type of my cell is changed to 'child'.

-----------

I check the code, if you not specified the 'cell-type' in UPDATE request,
  the value will be overwritten by the default value, 'child'.

That's not correct, you need to reserve the existing cell-type.

-----------

Here's the code segment in cells.py. The 'cell' is transformed from request:

def _normalize_cell(self, cell, existing=None):

        # Start with the cell type conversion
        if 'type' in cell:
            self._validate_cell_type(cell['type'])
            cell['is_parent'] = cell['type'] == 'parent'
            del cell['type']
        else:
            cell['is_parent'] = False
        ...

The issue is also involved in the new V3-api.

Thanks~

wingwj (wingwj)
Changed in nova:
assignee: nobody → wingwj (wingwj)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/46272

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/46272
Committed: http://github.com/openstack/nova/commit/ff1606072f9fa168d9c549fb661fee19ca145e56
Submitter: Jenkins
Branch: master

commit ff1606072f9fa168d9c549fb661fee19ca145e56
Author: wingwj <email address hidden>
Date: Thu Sep 12 21:17:08 2013 +0800

    Fix type is overwritten when UPDATE cell without type specified

    If you not specified the 'cell-type' in UPDATE request,
      the value will be overwritten by the default value, 'child'.
    That's not correct, you need to reserve the existing cell-type.

    The issue is also involved in the new V3-api.

    Fixes bug: 1224461

    Change-Id: I5c5043b9e5e0c33995422094284c3f19aac78593

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Bhuvan Arumugam (bhuvan) wrote :

This commit broke the unittests. The type for cell1 seem to be "child".

======================================================================
FAIL: nova.tests.api.openstack.compute.contrib.test_cells.CellsTest.test_cell_update_without_type_specified
tags: worker-0
----------------------------------------------------------------------
Empty attachments:
  pythonlogging:''
  stderr
  stdout

Traceback (most recent call last):
  File "nova/tests/api/openstack/compute/contrib/test_cells.py", line 290, in test_cell_update_without_type_specified
    self.assertEqual(cell['type'], 'parent')
  File "/home/jenkins/workspace/csi-nova-upstream/.tox/py26/lib/python2.6/site-packages/testtools/testcase.py", line 322, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/home/jenkins/workspace/csi-nova-upstream/.tox/py26/lib/python2.6/site-packages/testtools/testcase.py", line 417, in assertThat
    raise MismatchError(matchee, matcher, mismatch, verbose)
MismatchError: 'child' != 'parent'

Bhuvan Arumugam (bhuvan)
Changed in nova:
status: Fix Committed → In Progress
Revision history for this message
Bhuvan Arumugam (bhuvan) wrote :

looks like it's fixed as per https://bugs.launchpad.net/nova/+bug/1235399

I'll verify and mark it as such.

Revision history for this message
Bhuvan Arumugam (bhuvan) wrote :

it doesn't happen anymore.

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.