aggregate availability_zone update deletes metadata

Bug #1200369 reported by Dean Troyer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Yuriy Zveryanskyy

Bug Description

When POST /os-aggregates/%s includes an 'availability_zone' value in the body the metadata for that aggregate is replaced with "{u'availability_zone': u'zone-name'}". All existing metadata is overwritten.

Revision history for this message
Dean Troyer (dtroyer) wrote :

Recreation using a basic devstack install:

$ nova aggregate-create agg1 zone1
+----+------+-------------------+-------+----------------------------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+------+-------------------+-------+----------------------------------+
| 8 | agg1 | zone1 | [] | {u'availability_zone': u'zone1'} |
+----+------+-------------------+-------+----------------------------------+

 $ nova aggregate-set-metadata 8 test=1 attempt=3
Aggregate 8 has been successfully updated.
+----+------+-------------------+-------+-------------------------------------------------------------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+------+-------------------+-------+-------------------------------------------------------------------+
| 8 | agg1 | zone1 | [] | {u'test': u'1', u'attempt': u'3', u'availability_zone': u'zone1'} |
+----+------+-------------------+-------+-------------------------------------------------------------------+

Ok, everything is as expected so far.

$ $ nova --debug aggregate-update 8 agg1 zone2

REQ: curl -i http://10.130.50.20:5000/v2.0/tokens -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-novaclient" -d '{"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "0penstack"}}}'

INFO (connectionpool:191) Starting new HTTP connection (1): 10.130.50.20
DEBUG (connectionpool:283) "POST /v2.0/tokens HTTP/1.1" 200 2348
RESP: [200] {'date': 'Thu, 11 Jul 2013 20:31:14 GMT', 'content-type': 'application/json', 'content-length': '2348', 'vary': 'X-Auth-Token'}
RESP BODY: {"access": ... body omitted ... }

REQ: curl -i http://10.130.50.20:8774/v2/ec2a56fa9fb54b259b89b2bfc10752fd/os-aggregates/8 -X PUT -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: a1f6a8ab98174527909c8ba55ebeba3b" -d '{"aggregate": {"name": "agg1", "availability_zone": "zone2"}}'

INFO (connectionpool:191) Starting new HTTP connection (1): 10.130.50.20
DEBUG (connectionpool:283) "PUT /v2/ec2a56fa9fb54b259b89b2bfc10752fd/os-aggregates/8 HTTP/1.1" 200 225
RESP: [200] {'date': 'Thu, 11 Jul 2013 20:31:15 GMT', 'content-length': '225', 'content-type': 'application/json', 'x-compute-request-id': 'req-d20600e2-6807-429b-acb9-e03c5ce049cb'}
RESP BODY: {"aggregate": {"name": "agg1", "availability_zone": "zone2", "deleted": 0, "created_at": "2013-07-11T20:28:38.000000", "updated_at": null, "hosts": [], "deleted_at": null, "id": 8, "metadata": {"availability_zone": "zone2"}}}

Aggregate 8 has been successfully updated.
+----+------+-------------------+-------+----------------------------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+------+-------------------+-------+----------------------------------+
| 8 | agg1 | zone2 | [] | {u'availability_zone': u'zone2'} |
+----+------+-------------------+-------+----------------------------------+

Existing metadata is gone.

Changed in nova:
assignee: nobody → Yuriy Zveryanskyy (yzveryanskyy)
importance: Undecided → Medium
status: New → In Progress
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/36828

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit d9f88f7b9e2d82ddec32d1b25ffb9e8e46c9232e
Author: Yuriy Zveryanskyy <email address hidden>
Date: Fri Jul 12 16:08:28 2013 +0300

    Fix aggregate update.

    Bug description: when update 'availability_zone'
    value existing aggregate metadata cleared.

    Method aggregate_update() in sqlalchemy api updated.

    Fix bug 1200369.

    Change-Id: Ie1dffa90b1e339b81883dc14037f7817f1cec15d

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-2 → 2013.2
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.