summaryrefslogtreecommitdiff
path: root/shade/openstackcloud.py
diff options
context:
space:
mode:
Diffstat (limited to 'shade/openstackcloud.py')
-rw-r--r--shade/openstackcloud.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/shade/openstackcloud.py b/shade/openstackcloud.py
index 651dc0d..3a0ad86 100644
--- a/shade/openstackcloud.py
+++ b/shade/openstackcloud.py
@@ -3383,7 +3383,8 @@ class OpenStackCloud(
3383 return True 3383 return True
3384 3384
3385 def create_network(self, name, shared=False, admin_state_up=True, 3385 def create_network(self, name, shared=False, admin_state_up=True,
3386 external=False, provider=None, project_id=None): 3386 external=False, provider=None, project_id=None,
3387 availability_zone_hints=None):
3387 """Create a network. 3388 """Create a network.
3388 3389
3389 :param string name: Name of the network being created. 3390 :param string name: Name of the network being created.
@@ -3395,6 +3396,7 @@ class OpenStackCloud(
3395 { 'network_type': 'vlan', 'segmentation_id': 'vlan1' } 3396 { 'network_type': 'vlan', 'segmentation_id': 'vlan1' }
3396 :param string project_id: Specify the project ID this network 3397 :param string project_id: Specify the project ID this network
3397 will be created on (admin-only). 3398 will be created on (admin-only).
3399 :param list availability_zone_hints: A list of availability zone hints.
3398 3400
3399 :returns: The network object. 3401 :returns: The network object.
3400 :raises: OpenStackCloudException on operation error. 3402 :raises: OpenStackCloudException on operation error.
@@ -3410,6 +3412,16 @@ class OpenStackCloud(
3410 if project_id is not None: 3412 if project_id is not None:
3411 network['tenant_id'] = project_id 3413 network['tenant_id'] = project_id
3412 3414
3415 if availability_zone_hints is not None:
3416 if not isinstance(availability_zone_hints, list):
3417 raise OpenStackCloudException(
3418 "Parameter 'availability_zone_hints' must be a list")
3419 if not self._has_neutron_extension('network_availability_zone'):
3420 raise OpenStackCloudUnavailableExtension(
3421 'network_availability_zone extension is not available on '
3422 'target cloud')
3423 network['availability_zone_hints'] = availability_zone_hints
3424
3413 if provider: 3425 if provider:
3414 if not isinstance(provider, dict): 3426 if not isinstance(provider, dict):
3415 raise OpenStackCloudException( 3427 raise OpenStackCloudException(
@@ -4245,7 +4257,8 @@ class OpenStackCloud(
4245 4257
4246 def create_router(self, name=None, admin_state_up=True, 4258 def create_router(self, name=None, admin_state_up=True,
4247 ext_gateway_net_id=None, enable_snat=None, 4259 ext_gateway_net_id=None, enable_snat=None,
4248 ext_fixed_ips=None, project_id=None): 4260 ext_fixed_ips=None, project_id=None,
4261 availability_zone_hints=None):
4249 """Create a logical router. 4262 """Create a logical router.
4250 4263
4251 :param string name: The router name. 4264 :param string name: The router name.
@@ -4263,6 +4276,7 @@ class OpenStackCloud(
4263 } 4276 }
4264 ] 4277 ]
4265 :param string project_id: Project ID for the router. 4278 :param string project_id: Project ID for the router.
4279 :param list availability_zone_hints: A list of availability zone hints.
4266 4280
4267 :returns: The router object. 4281 :returns: The router object.
4268 :raises: OpenStackCloudException on operation error. 4282 :raises: OpenStackCloudException on operation error.
@@ -4279,6 +4293,15 @@ class OpenStackCloud(
4279 ) 4293 )
4280 if ext_gw_info: 4294 if ext_gw_info:
4281 router['external_gateway_info'] = ext_gw_info 4295 router['external_gateway_info'] = ext_gw_info
4296 if availability_zone_hints is not None:
4297 if not isinstance(availability_zone_hints, list):
4298 raise OpenStackCloudException(
4299 "Parameter 'availability_zone_hints' must be a list")
4300 if not self._has_neutron_extension('router_availability_zone'):
4301 raise OpenStackCloudUnavailableExtension(
4302 'router_availability_zone extension is not available on '
4303 'target cloud')
4304 router['availability_zone_hints'] = availability_zone_hints
4282 4305
4283 data = self._network_client.post( 4306 data = self._network_client.post(
4284 "/routers.json", json={"router": router}, 4307 "/routers.json", json={"router": router},