diff --git a/doc/rest_api.md b/doc/rest_api.md index b84c838..43f4a52 100644 --- a/doc/rest_api.md +++ b/doc/rest_api.md @@ -504,6 +504,7 @@ This operation does not accept a request body. | Parameter | Style | Type | Description | |-------------|-------|------------|---------------------------------------------------| +| locations | plain | xsd:list | An optional list of placement location candidates. | | plan_name | plain | xsd:string | The name of the plan. | | resources | plain | xsd:dict | A dictionary of resources to be planned. Each is keyed by an orchestration uuid. This is a UUID provided by an orchestration engine (e.g., heat-engine) prior to instantiation of a resource. The dictionary contains three keys: | | | | | **name**: resource name | diff --git a/valet/api/common/ostro_helper.py b/valet/api/common/ostro_helper.py index 807028d..2952ba5 100644 --- a/valet/api/common/ostro_helper.py +++ b/valet/api/common/ostro_helper.py @@ -245,6 +245,11 @@ class Ostro(object): "stack_id": self.args['stack_id'], } + # Only add locations if we have it (no need for an empty object) + locations = self.args.get('locations') + if locations: + self.request['locations'] = locations + if resources_update: # If we get any status in the response, it's an error. Bail. self.response = self._prepare_resources(resources_update) diff --git a/valet/api/v1/controllers/plans.py b/valet/api/v1/controllers/plans.py index db8da78..d8cbd21 100644 --- a/valet/api/v1/controllers/plans.py +++ b/valet/api/v1/controllers/plans.py @@ -27,6 +27,7 @@ from valet.api import LOG CREATE_SCHEMA = ( + (decorators.optional('locations'), types.array), ('plan_name', types.string), ('resources', types.dictionary), ('stack_id', types.string), @@ -237,7 +238,7 @@ class PlansController(object): kwargs = { 'tenant_id': request.context['tenant_id'], - 'args': args + 'args': args, } # Prepare the request. If request prep fails,