Transform IPAddress to string when creating port
If ip address is provided when running nova boot, nova compute will invoke neutron client to create a port. However, the ip address parameter is an IPAddress object so neutron client will fail to send the request to neutron server. Transform IPAddress object to string to address this issue. Change-Id: I858cca475748795aa2532f32bfe0f1443b30966f Closes-Bug: #1408529
This commit is contained in:
parent
92696f2fbd
commit
aae858a246
|
@ -257,7 +257,8 @@ class API(base_api.NetworkAPI):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if fixed_ip:
|
if fixed_ip:
|
||||||
port_req_body['port']['fixed_ips'] = [{'ip_address': fixed_ip}]
|
port_req_body['port']['fixed_ips'] = [
|
||||||
|
{'ip_address': str(fixed_ip)}]
|
||||||
port_req_body['port']['network_id'] = network_id
|
port_req_body['port']['network_id'] = network_id
|
||||||
port_req_body['port']['admin_state_up'] = True
|
port_req_body['port']['admin_state_up'] = True
|
||||||
port_req_body['port']['tenant_id'] = instance['project_id']
|
port_req_body['port']['tenant_id'] = instance['project_id']
|
||||||
|
|
|
@ -497,8 +497,8 @@ class TestNeutronv2Base(test.TestCase):
|
||||||
else:
|
else:
|
||||||
request.address = fixed_ips.get(request.network_id)
|
request.address = fixed_ips.get(request.network_id)
|
||||||
if request.address:
|
if request.address:
|
||||||
port_req_body['port']['fixed_ips'] = [{'ip_address':
|
port_req_body['port']['fixed_ips'] = [
|
||||||
request.address}]
|
{'ip_address': str(request.address)}]
|
||||||
port_req_body['port']['network_id'] = request.network_id
|
port_req_body['port']['network_id'] = request.network_id
|
||||||
port_req_body['port']['admin_state_up'] = True
|
port_req_body['port']['admin_state_up'] = True
|
||||||
port_req_body['port']['tenant_id'] = \
|
port_req_body['port']['tenant_id'] = \
|
||||||
|
|
Loading…
Reference in New Issue