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 create request for availability option is 'os-availability-zone:availability_zone'.
I found a testcase bug in nova/tests/ api/openstack/ compute/ plugins/ v3/test_ availability_ zone.py
def test_create_ instance_ with_availabili ty_zone( self):
self. assertIn( 'availability_ zone', kwargs)
def create(*args, **kwargs):
return old_create(*args, **kwargs)
old_create = compute_ api.API. create
self. stubs.Set( compute_ api.API, 'create', create) c930-4bf3- 8c8a-ea2a2420de b6' localhost/ v3/flavors/ 3'
' server' : {
'name' : 'config_ drive_test' ,
'image_ ref': image_href,
'flavor_ ref': flavor_ref,
'metadata' : {
'hello' : 'world',
'open': 'stack', zone': "nova",★
image_href = '76fa36fc-
flavor_ref = 'http://
body = {
},
★ 'availability_
},
}
req = fakes.HTTPReque stV3.blank( '/v3/servers' ) dumps(body)
req.headers[ "content- type"] = "application/json"
admin_ context = context. get_admin_ context( ) create( admin_context, {'host': 'host1_zones',
'binary' : "nova-compute",
'topic' : 'compute',
'report_ count': 0}) create( admin_context,
{'name' : 'agg1'}, {'availability_ zone': 'nova'})★
db.aggregate_ host_add( admin_context, agg['id'], 'host1_zones')
req.method = 'POST'
req.body = jsonutils.
service1 = db.service_
agg = db.aggregate_
The create request for availability option is 'os-availabilit y-zone: availability_ zone'.