Minor Shared IP infrastructure updates

- Adding the RAX_PUBLIC_IP_ZONE constant
- Adding the ip_zone_hint param to the create_servers_in_same_cell behavior method
- Adding data to the server persona portv4 and portv6 attributes by the update_server_persona method

Change-Id: I879483584bb0145dd79be0de2bd1102a5dacd9c3
This commit is contained in:
Leonardo Maycotte 2016-06-06 11:11:59 -05:00
parent 7715bfe7f6
commit c2b148b4c0
3 changed files with 11 additions and 2 deletions

View File

@ -448,7 +448,8 @@ class NetworkingBehaviors(NetworkingBaseBehaviors):
raise TimeoutException(msg)
def create_servers_in_same_cell(self, n_servers, name='same_cell_server',
network_ids=None, port_ids=None):
network_ids=None, port_ids=None,
ip_zone_hint=None):
"""
@summary: Creates n servers in same cell using the first server ID with
scheduler hints
@ -476,7 +477,7 @@ class NetworkingBehaviors(NetworkingBaseBehaviors):
server = resp.entity
# Setting up the scheduler hints for creating other servers
pz = IPAddressesServerZone.PUBLIC_IP_ZONE_NEAR
pz = ip_zone_hint or IPAddressesServerZone.PUBLIC_IP_ZONE_NEAR
scheduler_hints = {pz: server.id}
else:
resp = self.create_networking_server(

View File

@ -52,6 +52,7 @@ class IPAddressesServerZone(object):
server builds
"""
RAX_PUBLIC_IP_ZONE = 'RAX-PUBLIC-IP-ZONE-ID:publicIPZoneId'
PUBLIC_IP_ZONE_NEAR = 'public_ip_zone:near'
PUBLIC_IP_ZONE_FAR = 'public_ip_zone:far'
DIFFERENT_HOST = 'different_host'

View File

@ -296,6 +296,13 @@ class ServerPersona(BaseModel, NetworkingBaseBehaviors):
self.server = self.behaviors.get_networking_server(server=self.server)
self.isolated_network_id = getattr(self.network, 'id', None)
# Updating the isolated network port attribute
isolated_ports = self.inet_ports
if self.subnetv4 and isolated_ports:
self.portv4 = isolated_ports[0]
if self.subnetv6 and isolated_ports:
self.portv6 = isolated_ports[0]
if clear_errors:
self.errors = []