Merge "Add placement.concurrent_udpate to generation pre-checks"
This commit is contained in:
commit
b0570d8ddd
nova
api/openstack/placement
tests/functional/api/openstack/placement/gabbits
@ -122,7 +122,8 @@ def set_aggregates(req):
|
|||||||
if resource_provider.generation != rp_gen:
|
if resource_provider.generation != rp_gen:
|
||||||
raise webob.exc.HTTPConflict(
|
raise webob.exc.HTTPConflict(
|
||||||
_("Resource provider's generation already changed. Please "
|
_("Resource provider's generation already changed. Please "
|
||||||
"update the generation and try again."))
|
"update the generation and try again."),
|
||||||
|
comment=errors.CONCURRENT_UPDATE)
|
||||||
aggregate_uuids = data['aggregates']
|
aggregate_uuids = data['aggregates']
|
||||||
else:
|
else:
|
||||||
aggregate_uuids = data
|
aggregate_uuids = data
|
||||||
|
@ -331,7 +331,8 @@ def set_inventories(req):
|
|||||||
data = _extract_inventories(req.body, schema.PUT_INVENTORY_SCHEMA)
|
data = _extract_inventories(req.body, schema.PUT_INVENTORY_SCHEMA)
|
||||||
if data['resource_provider_generation'] != resource_provider.generation:
|
if data['resource_provider_generation'] != resource_provider.generation:
|
||||||
raise webob.exc.HTTPConflict(
|
raise webob.exc.HTTPConflict(
|
||||||
_('resource provider generation conflict'))
|
_('resource provider generation conflict'),
|
||||||
|
comment=errors.CONCURRENT_UPDATE)
|
||||||
|
|
||||||
inv_list = []
|
inv_list = []
|
||||||
for res_class, inventory_data in data['inventories'].items():
|
for res_class, inventory_data in data['inventories'].items():
|
||||||
@ -436,7 +437,8 @@ def update_inventory(req):
|
|||||||
data = _extract_inventory(req.body, schema.BASE_INVENTORY_SCHEMA)
|
data = _extract_inventory(req.body, schema.BASE_INVENTORY_SCHEMA)
|
||||||
if data['resource_provider_generation'] != resource_provider.generation:
|
if data['resource_provider_generation'] != resource_provider.generation:
|
||||||
raise webob.exc.HTTPConflict(
|
raise webob.exc.HTTPConflict(
|
||||||
_('resource provider generation conflict'))
|
_('resource provider generation conflict'),
|
||||||
|
comment=errors.CONCURRENT_UPDATE)
|
||||||
|
|
||||||
inventory = _make_inventory_object(resource_provider,
|
inventory = _make_inventory_object(resource_provider,
|
||||||
resource_class,
|
resource_class,
|
||||||
|
@ -226,7 +226,8 @@ def update_traits_for_resource_provider(req):
|
|||||||
raise webob.exc.HTTPConflict(
|
raise webob.exc.HTTPConflict(
|
||||||
_("Resource provider's generation already changed. Please update "
|
_("Resource provider's generation already changed. Please update "
|
||||||
"the generation and try again."),
|
"the generation and try again."),
|
||||||
json_formatter=util.json_error_formatter)
|
json_formatter=util.json_error_formatter,
|
||||||
|
comment=errors.CONCURRENT_UPDATE)
|
||||||
|
|
||||||
trait_objs = rp_obj.TraitList.get_all(
|
trait_objs = rp_obj.TraitList.get_all(
|
||||||
context, filters={'name_in': traits})
|
context, filters={'name_in': traits})
|
||||||
|
@ -639,7 +639,8 @@ def ensure_consumer(ctx, consumer_uuid, project_id, user_id,
|
|||||||
{
|
{
|
||||||
'expected_gen': consumer.generation,
|
'expected_gen': consumer.generation,
|
||||||
'got_gen': consumer_generation,
|
'got_gen': consumer_generation,
|
||||||
})
|
},
|
||||||
|
comment=errors.CONCURRENT_UPDATE)
|
||||||
# NOTE(jaypipes): The user may have specified a different project and
|
# NOTE(jaypipes): The user may have specified a different project and
|
||||||
# user external ID than the one that we had for the consumer. If this
|
# user external ID than the one that we had for the consumer. If this
|
||||||
# is the case, go ahead and modify the consumer record with the
|
# is the case, go ahead and modify the consumer record with the
|
||||||
@ -681,7 +682,8 @@ def ensure_consumer(ctx, consumer_uuid, project_id, user_id,
|
|||||||
if consumer_generation is not None:
|
if consumer_generation is not None:
|
||||||
raise webob.exc.HTTPConflict(
|
raise webob.exc.HTTPConflict(
|
||||||
_('consumer generation conflict - '
|
_('consumer generation conflict - '
|
||||||
'expected null but got %s') % consumer_generation)
|
'expected null but got %s') % consumer_generation,
|
||||||
|
comment=errors.CONCURRENT_UPDATE)
|
||||||
# No such consumer. This is common for new allocations. Create the
|
# No such consumer. This is common for new allocations. Create the
|
||||||
# consumer record
|
# consumer record
|
||||||
try:
|
try:
|
||||||
|
@ -116,6 +116,8 @@ tests:
|
|||||||
resource_provider_generation: 0
|
resource_provider_generation: 0
|
||||||
aggregates: []
|
aggregates: []
|
||||||
status: 409
|
status: 409
|
||||||
|
response_json_paths:
|
||||||
|
$.errors[0].code: placement.concurrent_update
|
||||||
|
|
||||||
- name: clear those aggregates
|
- name: clear those aggregates
|
||||||
PUT: $LAST_URL
|
PUT: $LAST_URL
|
||||||
|
@ -64,6 +64,8 @@ tests:
|
|||||||
response_strings:
|
response_strings:
|
||||||
- consumer generation conflict
|
- consumer generation conflict
|
||||||
- expected null but got 5
|
- expected null but got 5
|
||||||
|
response_json_paths:
|
||||||
|
$.errors[0].code: placement.concurrent_update
|
||||||
|
|
||||||
- name: new version gen is None no existing
|
- name: new version gen is None no existing
|
||||||
PUT: /allocations/22222222-2222-2222-2222-222222222222
|
PUT: /allocations/22222222-2222-2222-2222-222222222222
|
||||||
@ -147,6 +149,8 @@ tests:
|
|||||||
status: 409
|
status: 409
|
||||||
response_strings:
|
response_strings:
|
||||||
- consumer generation conflict
|
- consumer generation conflict
|
||||||
|
response_json_paths:
|
||||||
|
$.errors[0].code: placement.concurrent_update
|
||||||
|
|
||||||
- name: old version no gen existing
|
- name: old version no gen existing
|
||||||
PUT: /allocations/44444444-4444-4444-4444-444444444444
|
PUT: /allocations/44444444-4444-4444-4444-444444444444
|
||||||
|
@ -220,6 +220,7 @@ tests:
|
|||||||
PUT: $LAST_URL
|
PUT: $LAST_URL
|
||||||
request_headers:
|
request_headers:
|
||||||
content-type: application/json
|
content-type: application/json
|
||||||
|
openstack-api-version: placement 1.23
|
||||||
data:
|
data:
|
||||||
resource_provider_generation: 5
|
resource_provider_generation: 5
|
||||||
total: 2048
|
total: 2048
|
||||||
@ -228,6 +229,7 @@ tests:
|
|||||||
- resource provider generation conflict
|
- resource provider generation conflict
|
||||||
response_json_paths:
|
response_json_paths:
|
||||||
$.errors[0].title: Conflict
|
$.errors[0].title: Conflict
|
||||||
|
$.errors[0].code: placement.concurrent_update
|
||||||
|
|
||||||
- name: modify inventory no such resource class in inventory
|
- name: modify inventory no such resource class in inventory
|
||||||
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories/MEMORY_MB
|
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories/MEMORY_MB
|
||||||
@ -471,6 +473,7 @@ tests:
|
|||||||
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories
|
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories
|
||||||
request_headers:
|
request_headers:
|
||||||
content-type: application/json
|
content-type: application/json
|
||||||
|
openstack-api-version: placement 1.23
|
||||||
data:
|
data:
|
||||||
resource_provider_generation: 99
|
resource_provider_generation: 99
|
||||||
inventories:
|
inventories:
|
||||||
@ -481,6 +484,7 @@ tests:
|
|||||||
- resource provider generation conflict
|
- resource provider generation conflict
|
||||||
response_json_paths:
|
response_json_paths:
|
||||||
$.errors[0].title: Conflict
|
$.errors[0].title: Conflict
|
||||||
|
$.errors[0].code: placement.concurrent_update
|
||||||
|
|
||||||
- name: put all inventory unknown resource class
|
- name: put all inventory unknown resource class
|
||||||
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories
|
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories
|
||||||
|
@ -325,6 +325,7 @@ tests:
|
|||||||
PUT: /resource_providers/$ENVIRON['RP_UUID']/traits
|
PUT: /resource_providers/$ENVIRON['RP_UUID']/traits
|
||||||
request_headers:
|
request_headers:
|
||||||
content-type: application/json
|
content-type: application/json
|
||||||
|
openstack-api-version: placement 1.23
|
||||||
status: 409
|
status: 409
|
||||||
data:
|
data:
|
||||||
traits:
|
traits:
|
||||||
@ -332,6 +333,8 @@ tests:
|
|||||||
resource_provider_generation: 5
|
resource_provider_generation: 5
|
||||||
response_strings:
|
response_strings:
|
||||||
- Resource provider's generation already changed. Please update the generation and try again.
|
- Resource provider's generation already changed. Please update the generation and try again.
|
||||||
|
response_json_paths:
|
||||||
|
$.errors[0].code: placement.concurrent_update
|
||||||
|
|
||||||
- name: set non existed traits for resource provider
|
- name: set non existed traits for resource provider
|
||||||
PUT: /resource_providers/$ENVIRON['RP_UUID']/traits
|
PUT: /resource_providers/$ENVIRON['RP_UUID']/traits
|
||||||
|
Loading…
x
Reference in New Issue
Block a user