Wrong option is used in test_availability.py

Bug #1270811 reported by Haiwei Xu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Haiwei Xu

Bug Description

I found a testcase bug in nova/tests/api/openstack/compute/plugins/v3/test_availability_zone.py

     def test_create_instance_with_availability_zone(self):
         def create(*args, **kwargs):
             self.assertIn('availability_zone', kwargs)
             return old_create(*args, **kwargs)

         old_create = compute_api.API.create
         self.stubs.Set(compute_api.API, 'create', create)
         image_href = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
         flavor_ref = 'http://localhost/v3/flavors/3'
         body = {
             'server': {
                 'name': 'config_drive_test',
                 'image_ref': image_href,
                 'flavor_ref': flavor_ref,
                 'metadata': {
                     'hello': 'world',
                     'open': 'stack',
                 },
               ★ 'availability_zone': "nova",★
             },
         }

         req = fakes.HTTPRequestV3.blank('/v3/servers')
         req.method = 'POST'
         req.body = jsonutils.dumps(body)
         req.headers["content-type"] = "application/json"
         admin_context = context.get_admin_context()
         service1 = db.service_create(admin_context, {'host': 'host1_zones',
                                          'binary': "nova-compute",
                                          'topic': 'compute',
                                          'report_count': 0})
         agg = db.aggregate_create(admin_context,
                 {'name': 'agg1'}, {'availability_zone': 'nova'})★
         db.aggregate_host_add(admin_context, agg['id'], 'host1_zones')

The correct request for availability-zone option is 'os-availability-zone:availability_zone'.

Haiwei Xu (xu-haiwei)
Changed in nova:
assignee: nobody → Haiwei Xu (xu-haiwei)
Haiwei Xu (xu-haiwei)
description: updated
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/67825

Changed in nova:
status: New → In Progress
Haiwei Xu (xu-haiwei)
description: updated
Changed in nova:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/67825
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=861d67120227f7a52ff3f9ef7225b84a9ac26647
Submitter: Jenkins
Branch: master

commit 861d67120227f7a52ff3f9ef7225b84a9ac26647
Author: Haiwei Xu <email address hidden>
Date: Tue Jan 21 06:43:20 2014 +0900

    Fix availability-zone option miss when creates an instance

    In test_availability_zone.py the availability-zone option is
    used as 'availability_zone' which should be modified to
    'os-availability-zone:availability_zone'.

    Change-Id: I765d07b699ecb425dadccb22af834b11f52ff5b0
    Closes-Bug: #1270811

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