summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2021-08-02 13:15:56 +1200
committerLingxian Kong <anlin.kong@gmail.com>2021-08-02 14:25:54 +1200
commit5590ecdce036f7a2b11ff440dfd4eb637180abcc (patch)
tree5b778f8d093d92dd7e94c224a83e23deb294023b
parent036948c516672e55c4a2c932c74bcdec80319108 (diff)
downloadtrove-5590ecdce036f7a2b11ff440dfd4eb637180abcc.tar.gz
Show user network ID for getting instance
Change-Id: Ia1e9112ae69e04f8c3e9e9d1b4a0189c743d7448
-rwxr-xr-xapi-ref/source/parameters.yaml4
-rw-r--r--api-ref/source/samples/instance-list-detail-response.json3
-rw-r--r--api-ref/source/samples/instance-mgmt-list-response.json3
-rw-r--r--api-ref/source/samples/instance-mgmt-show-response.json3
-rw-r--r--api-ref/source/samples/instance-show-response.json3
-rw-r--r--devstack/plugin.sh3
-rw-r--r--doc/source/user/create-db.rst44
-rw-r--r--doc/source/user/set-up-replication.rst46
-rw-r--r--doc/source/user/upgrade-datastore.rst36
-rw-r--r--releasenotes/notes/xena-show-network.yaml3
-rw-r--r--requirements.txt1
-rw-r--r--tools/trove-config-generator.conf1
-rw-r--r--trove/common/cache.py57
-rw-r--r--trove/common/neutron.py21
-rw-r--r--trove/instance/models.py17
15 files changed, 171 insertions, 74 deletions
diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml
index a2c6c910..9709a199 100755
--- a/api-ref/source/parameters.yaml
+++ b/api-ref/source/parameters.yaml
@@ -516,7 +516,9 @@ instance_ip_address:
type: string
instance_ip_addresses:
description: |
- The IP addresses of an instance, including the address type and IP.
+ The IP addresses of an instance, including the address type("private" or
+ "public") and IP. "network" field is added since Xena when the address type
+ is "private".
in: body
require: false
type: array
diff --git a/api-ref/source/samples/instance-list-detail-response.json b/api-ref/source/samples/instance-list-detail-response.json
index b938de88..4f924697 100644
--- a/api-ref/source/samples/instance-list-detail-response.json
+++ b/api-ref/source/samples/instance-list-detail-response.json
@@ -4,7 +4,8 @@
"addresses": [
{
"address": "10.1.0.62",
- "type": "private"
+ "type": "private",
+ "network": "3dc8f3c2-f335-11eb-878c-00224d6b7bc1"
},
{
"address": "172.24.5.114",
diff --git a/api-ref/source/samples/instance-mgmt-list-response.json b/api-ref/source/samples/instance-mgmt-list-response.json
index 071e610c..c412df28 100644
--- a/api-ref/source/samples/instance-mgmt-list-response.json
+++ b/api-ref/source/samples/instance-mgmt-list-response.json
@@ -4,7 +4,8 @@
"addresses": [
{
"address": "10.1.0.62",
- "type": "private"
+ "type": "private",
+ "network": "3dc8f3c2-f335-11eb-878c-00224d6b7bc1"
},
{
"address": "172.24.5.114",
diff --git a/api-ref/source/samples/instance-mgmt-show-response.json b/api-ref/source/samples/instance-mgmt-show-response.json
index 23ce592c..5a6f908f 100644
--- a/api-ref/source/samples/instance-mgmt-show-response.json
+++ b/api-ref/source/samples/instance-mgmt-show-response.json
@@ -3,7 +3,8 @@
"addresses": [
{
"address": "10.1.0.62",
- "type": "private"
+ "type": "private",
+ "network": "3dc8f3c2-f335-11eb-878c-00224d6b7bc1"
},
{
"address": "172.24.5.114",
diff --git a/api-ref/source/samples/instance-show-response.json b/api-ref/source/samples/instance-show-response.json
index 49579242..aac49d8f 100644
--- a/api-ref/source/samples/instance-show-response.json
+++ b/api-ref/source/samples/instance-show-response.json
@@ -3,7 +3,8 @@
"addresses": [
{
"address": "10.1.0.62",
- "type": "private"
+ "type": "private",
+ "network": "3dc8f3c2-f335-11eb-878c-00224d6b7bc1"
},
{
"address": "172.24.5.114",
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index 7603261e..2c8b3b7a 100644
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -236,6 +236,9 @@ function configure_trove {
iniset $TROVE_CONF DEFAULT taskmanager_manager trove.taskmanager.manager.Manager
iniset $TROVE_CONF DEFAULT default_datastore $TROVE_DATASTORE_TYPE
+ iniset $TROVE_CONF cache enabled true
+ iniset $TROVE_CONF cache backend dogpile.cache.memory
+
iniset $TROVE_CONF cassandra tcp_ports 7000,7001,7199,9042,9160
iniset $TROVE_CONF couchbase tcp_ports 8091,8092,4369,11209-11211,21100-21199
iniset $TROVE_CONF couchdb tcp_ports 5984
diff --git a/doc/source/user/create-db.rst b/doc/source/user/create-db.rst
index a8a111e1..01065446 100644
--- a/doc/source/user/create-db.rst
+++ b/doc/source/user/create-db.rst
@@ -91,28 +91,28 @@ Create and access a database instance
.. code-block:: console
$ openstack database instance show ad40cf6c-6532-4a22-a3f3-7364f0f04a0f
- +--------------------------+----------------------------------------------------------------------------------------------+
- | Field | Value |
- +--------------------------+----------------------------------------------------------------------------------------------+
- | addresses | [{'address': '10.0.0.59', 'type': 'private'}, {'address': '172.24.4.242', 'type': 'public'}] |
- | allowed_cidrs | [] |
- | created | 2020-12-08T21:00:20 |
- | datastore | mysql |
- | datastore_version | 5.7.29 |
- | datastore_version_number | 5.7.29 |
- | flavor | 1fb05bb0-4605-48b6-81e6-3d4622e4a330 |
- | id | ad40cf6c-6532-4a22-a3f3-7364f0f04a0f |
- | ip | 10.0.0.59, 172.24.4.242 |
- | name | mysql_instance_1 |
- | operating_status | HEALTHY |
- | public | True |
- | region | RegionOne |
- | service_status_updated | 2020-12-08T21:05:51 |
- | status | ACTIVE |
- | updated | 2020-12-08T21:04:39 |
- | volume | 5 |
- | volume_used | 0.2 |
- +--------------------------+----------------------------------------------------------------------------------------------+
+ +--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
+ | Field | Value |
+ +--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
+ | addresses | [{'address': '10.0.0.59', 'type': 'private', 'network': '09f6aadc-f92d-41d4-8cad-2eb1876054dd'}, {'address': '172.24.4.242', 'type': 'public'}] |
+ | allowed_cidrs | [] |
+ | created | 2020-12-08T21:00:20 |
+ | datastore | mysql |
+ | datastore_version | 5.7.29 |
+ | datastore_version_number | 5.7.29 |
+ | flavor | 1fb05bb0-4605-48b6-81e6-3d4622e4a330 |
+ | id | ad40cf6c-6532-4a22-a3f3-7364f0f04a0f |
+ | ip | 10.0.0.59, 172.24.4.242 |
+ | name | mysql_instance_1 |
+ | operating_status | HEALTHY |
+ | public | True |
+ | region | RegionOne |
+ | service_status_updated | 2020-12-08T21:05:51 |
+ | status | ACTIVE |
+ | updated | 2020-12-08T21:04:39 |
+ | volume | 5 |
+ | volume_used | 0.2 |
+ +--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
#. **Access the new database**
diff --git a/doc/source/user/set-up-replication.rst b/doc/source/user/set-up-replication.rst
index ae0b3675..7ecb2f08 100644
--- a/doc/source/user/set-up-replication.rst
+++ b/doc/source/user/set-up-replication.rst
@@ -47,13 +47,13 @@ Set up replication
.. code-block:: console
- $ openstack database instance list
- +--------------------------------------+----------------------+-----------+-------------------+---------+------------------+------------------------------------------------+-----------+------+-----------+---------+
- | ID | Name | Datastore | Datastore Version | Status | Operating Status | Addresses | Flavor ID | Size | Region | Role |
- +--------------------------------------+----------------------+-----------+-------------------+---------+------------------+------------------------------------------------+-----------+------+-----------+---------+
- | 71f30a72-4e47-4505-9e7f-ffd8933a331c | test-mysql-replica-1 | mysql | 5.7.29 | ACTIVE | HEALTHY | [{'address': '10.1.0.155', 'type': 'private'}] | d2 | 2 | RegionOne | replica |
- | cebbf187-e223-46dd-8802-6dc04e895d0a | test-mysql | mysql | 5.7.29 | ACTIVE | HEALTHY | [{'address': '10.1.0.43', 'type': 'private'}] | d2 | 2 | RegionOne | primary |
- +--------------------------------------+----------------------+-----------+-------------------+---------+------------------+-----------------------------+-----------+------+-----------+---------+
+ $ openstack database instance list -c ID -c Name -c Status -c "Operating Status" -c Role
+ +--------------------------------------+----------------------+---------+------------------+---------+
+ | ID | Name | Status | Operating Status | Role |
+ +--------------------------------------+----------------------+---------+------------------+---------+
+ | 71f30a72-4e47-4505-9e7f-ffd8933a331c | test-mysql-replica-1 | ACTIVE | HEALTHY | replica |
+ | cebbf187-e223-46dd-8802-6dc04e895d0a | test-mysql | ACTIVE | HEALTHY | primary |
+ +--------------------------------------+----------------------+---------+------------------+---------+
#. Verify replication status.
@@ -119,14 +119,14 @@ couple minutes.
.. code-block:: console
- $ openstack database instance list
- +--------------------------------------+----------------------+-----------+-------------------+--------+------------------+------------------------------------------------+-----------+------+-----------+---------+
- | ID | Name | Datastore | Datastore Version | Status | Operating Status | Addresses | Flavor ID | Size | Region | Role |
- +--------------------------------------+----------------------+-----------+-------------------+--------+------------------+------------------------------------------------+-----------+------+-----------+---------+
- | 71f30a72-4e47-4505-9e7f-ffd8933a331c | test-mysql-replica-1 | mysql | 5.7.29 | ACTIVE | HEALTHY | [{'address': '10.1.0.155', 'type': 'private'}] | d2 | 2 | RegionOne | replica |
- | a85ece86-9f62-4aa8-bb15-eba604cd2a01 | test-mysql-replica-2 | mysql | 5.7.29 | ACTIVE | HEALTHY | [{'address': '10.1.0.243', 'type': 'private'}] | d2 | 2 | RegionOne | replica |
- | cebbf187-e223-46dd-8802-6dc04e895d0a | test-mysql | mysql | 5.7.29 | ACTIVE | HEALTHY | [{'address': '10.1.0.43', 'type': 'private'}] | d2 | 2 | RegionOne | primary |
- +--------------------------------------+----------------------+-----------+-------------------+--------+------------------+-----------------------------+-----------+------+-----------+---------+
+ $ openstack database instance list -c ID -c Name -c Status -c "Operating Status" -c Role
+ +--------------------------------------+----------------------+--------+------------------+---------+
+ | ID | Name | Status | Operating Status | Role |
+ +--------------------------------------+----------------------+--------+------------------+---------+
+ | 71f30a72-4e47-4505-9e7f-ffd8933a331c | test-mysql-replica-1 | ACTIVE | HEALTHY | replica |
+ | a85ece86-9f62-4aa8-bb15-eba604cd2a01 | test-mysql-replica-2 | ACTIVE | HEALTHY | replica |
+ | cebbf187-e223-46dd-8802-6dc04e895d0a | test-mysql | ACTIVE | HEALTHY | primary |
+ +--------------------------------------+----------------------+--------+------------------+---------+
#. Failover(promote) "test-mysql-replica-1" to primary.
@@ -138,14 +138,14 @@ couple minutes.
.. code-block:: console
- $ openstack database instance list
- +--------------------------------------+----------------------+-----------+-------------------+--------+------------------+------------------------------------------------+-----------+------+-----------+---------+
- | ID | Name | Datastore | Datastore Version | Status | Operating Status | Addresses | Flavor ID | Size | Region | Role |
- +--------------------------------------+----------------------+-----------+-------------------+--------+------------------+------------------------------------------------+-----------+------+-----------+---------+
- | 71f30a72-4e47-4505-9e7f-ffd8933a331c | test-mysql-replica-1 | mysql | 5.7.29 | ACTIVE | HEALTHY | [{'address': '10.1.0.155', 'type': 'private'}] | d2 | 2 | RegionOne | primary |
- | a85ece86-9f62-4aa8-bb15-eba604cd2a01 | test-mysql-replica-2 | mysql | 5.7.29 | ACTIVE | HEALTHY | [{'address': '10.1.0.243', 'type': 'private'}] | d2 | 2 | RegionOne | replica |
- | cebbf187-e223-46dd-8802-6dc04e895d0a | test-mysql | mysql | 5.7.29 | ACTIVE | HEALTHY | [{'address': '10.1.0.43', 'type': 'private'}] | d2 | 2 | RegionOne | replica |
- +--------------------------------------+----------------------+-----------+-------------------+--------+------------------+------------------------------------------------+-----------+------+-----------+---------+
+ $ openstack database instance list -c ID -c Name -c Status -c "Operating Status" -c Role
+ +--------------------------------------+----------------------+--------+------------------+---------+
+ | ID | Name | Status | Operating Status | Role |
+ +--------------------------------------+----------------------+--------+------------------+---------+
+ | 71f30a72-4e47-4505-9e7f-ffd8933a331c | test-mysql-replica-1 | ACTIVE | HEALTHY | primary |
+ | a85ece86-9f62-4aa8-bb15-eba604cd2a01 | test-mysql-replica-2 | ACTIVE | HEALTHY | replica |
+ | cebbf187-e223-46dd-8802-6dc04e895d0a | test-mysql | ACTIVE | HEALTHY | replica |
+ +--------------------------------------+----------------------+--------+------------------+---------+
#. Point your application to the (former) replica.
diff --git a/doc/source/user/upgrade-datastore.rst b/doc/source/user/upgrade-datastore.rst
index cceff6d2..6478fac9 100644
--- a/doc/source/user/upgrade-datastore.rst
+++ b/doc/source/user/upgrade-datastore.rst
@@ -54,12 +54,12 @@ Upgrading datastore
--nic net-id=$netid \
--datastore mysql --datastore-version 5.7.29 \
--databases testdb --users user:password
- $ openstack database instance list
- +--------------------------------------+--------------------+-----------+-------------------+--------+------------------+-----------------------------------------------+-----------+------+-----------+---------+
- | ID | Name | Datastore | Datastore Version | Status | Operating Status | Addresses | Flavor ID | Size | Region | Role |
- +--------------------------------------+--------------------+-----------+-------------------+--------+------------------+-----------------------------------------------+-----------+------+-----------+---------+
- | 32eb56b0-d10d-43e9-b59e-1e4b0979e5dd | test-mysql-upgrade | mysql | 5.7.29 | ACTIVE | HEALTHY | [{'address': '10.0.0.54', 'type': 'private'}] | d2 | 1 | RegionOne | |
- +--------------------------------------+--------------------+-----------+-------------------+--------+------------------+-----------------------------------------------+-----------+------+-----------+---------+
+ $ openstack database instance list -c ID -c Name -c Status -c "Operating Status" -c Addresses
+ +--------------------------------------+--------------------+--------+------------------+--------------------------------------------------------------------------------------------------+
+ | ID | Name | Status | Operating Status | Addresses |
+ +--------------------------------------+--------------------+--------+------------------+--------------------------------------------------------------------------------------------------+
+ | 32eb56b0-d10d-43e9-b59e-1e4b0979e5dd | test-mysql-upgrade | ACTIVE | HEALTHY | [{'address': '10.0.0.54', 'type': 'private', 'network': '3dc8f3c2-f335-11eb-878c-00224d6b7bc1'}] |
+ +--------------------------------------+--------------------+--------+------------------+--------------------------------------------------------------------------------------------------+
Check the MySQL version by connecting with the database:
@@ -90,18 +90,18 @@ Upgrading datastore
.. code-block:: console
- $ openstack database instance list
- +--------------------------------------+--------------------+-----------+-------------------+---------+------------------+-----------------------------------------------+-----------+------+-----------+---------+
- | ID | Name | Datastore | Datastore Version | Status | Operating Status | Addresses | Flavor ID | Size | Region | Role |
- +--------------------------------------+--------------------+-----------+-------------------+---------+------------------+-----------------------------------------------+-----------+------+-----------+---------+
- | 32eb56b0-d10d-43e9-b59e-1e4b0979e5dd | test-mysql-upgrade | mysql | 5.7.30 | UPGRADE | | [{'address': '10.0.0.54', 'type': 'private'}] | d2 | 1 | RegionOne | |
- +--------------------------------------+--------------------+-----------+-------------------+---------+------------------+-----------------------------------------------+-----------+------+-----------+---------+
- $ openstack database instance list
- +--------------------------------------+--------------------+-----------+-------------------+--------+------------------+-----------------------------------------------+-----------+------+-----------+---------+
- | ID | Name | Datastore | Datastore Version | Status | Operating Status | Addresses | Flavor ID | Size | Region | Role |
- +--------------------------------------+--------------------+-----------+-------------------+--------+------------------+-----------------------------------------------+-----------+------+-----------+---------+
- | 32eb56b0-d10d-43e9-b59e-1e4b0979e5dd | test-mysql-upgrade | mysql | 5.7.30 | ACTIVE | HEALTHY | [{'address': '10.0.0.54', 'type': 'private'}] | d2 | 1 | RegionOne | |
- +--------------------------------------+--------------------+-----------+-------------------+--------+------------------+-----------------------------------------------+-----------+------+-----------+---------+
+ $ openstack database instance list -c ID -c Name -c Status -c "Operating Status"
+ +--------------------------------------+--------------------+---------+------------------+
+ | ID | Name | Status | Operating Status |
+ +--------------------------------------+--------------------+---------+------------------+
+ | 32eb56b0-d10d-43e9-b59e-1e4b0979e5dd | test-mysql-upgrade | UPGRADE | |
+ +--------------------------------------+--------------------+---------+------------------+
+ $ openstack database instance list -c ID -c Name -c Status -c "Operating Status"
+ +--------------------------------------+--------------------+--------+------------------+
+ | ID | Name | Status | Operating Status |
+ +--------------------------------------+--------------------+--------+------------------+
+ | 32eb56b0-d10d-43e9-b59e-1e4b0979e5dd | test-mysql-upgrade | ACTIVE | HEALTHY |
+ +--------------------------------------+--------------------+--------+------------------+
Check the MySQL version again:
diff --git a/releasenotes/notes/xena-show-network.yaml b/releasenotes/notes/xena-show-network.yaml
new file mode 100644
index 00000000..21364f4f
--- /dev/null
+++ b/releasenotes/notes/xena-show-network.yaml
@@ -0,0 +1,3 @@
+---
+features:
+ - Show network ID for the instance private address.
diff --git a/requirements.txt b/requirements.txt
index 33bd3e83..668c0f99 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -49,3 +49,4 @@ diskimage-builder!=1.6.0,!=1.7.0,!=1.7.1,>=1.1.2 # Apache-2.0
docker>=4.2.0 # Apache-2.0
psycopg2-binary>=2.6.2 # LGPL/ZPL
semantic-version>=2.7.0 # BSD
+oslo.cache>=1.26.0 # Apache-2.0
diff --git a/tools/trove-config-generator.conf b/tools/trove-config-generator.conf
index 79fc7f28..4f094f24 100644
--- a/tools/trove-config-generator.conf
+++ b/tools/trove-config-generator.conf
@@ -7,3 +7,4 @@ namespace = oslo.middleware
namespace = oslo.log
namespace = oslo.policy
namespace = osprofiler
+namespace = oslo.cache
diff --git a/trove/common/cache.py b/trove/common/cache.py
new file mode 100644
index 00000000..7c259e44
--- /dev/null
+++ b/trove/common/cache.py
@@ -0,0 +1,57 @@
+# Copyright 2021 Catalyst Cloud
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""The code related to integration between oslo.cache module and trove."""
+
+from oslo_cache import core
+from oslo_config import cfg
+
+
+def register_cache_configurations(conf):
+ """Register all configurations required for oslo.cache.
+
+ The procedure registers all configurations required for oslo.cache.
+ It should be called before configuring of cache region
+ """
+ core.configure(conf)
+
+ ports_cache_group = cfg.OptGroup('instance_ports_cache')
+ ports_cache_opts = [
+ cfg.IntOpt('expiration_time', default=86400,
+ help='TTL, in seconds, for any cached item in the '
+ 'dogpile.cache region used for caching of the '
+ 'instance ports.'),
+ cfg.BoolOpt("caching", default=True,
+ help='Toggle to enable/disable caching when getting trove '
+ 'instance ports. Please note that the global toggle '
+ 'for oslo.cache(enabled=True in [cache] group) '
+ 'must be enabled to use this feature.')
+ ]
+ conf.register_group(ports_cache_group)
+ conf.register_opts(ports_cache_opts, group=ports_cache_group)
+
+ return conf
+
+
+# variable that stores an initialized cache region for trove
+_REGION = None
+
+
+def get_cache_region():
+ global _REGION
+ if not _REGION:
+ _REGION = core.configure_cache_region(
+ conf=register_cache_configurations(cfg.CONF),
+ region=core.create_region())
+ return _REGION
diff --git a/trove/common/neutron.py b/trove/common/neutron.py
index 9f82eb16..d60eda57 100644
--- a/trove/common/neutron.py
+++ b/trove/common/neutron.py
@@ -12,9 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import netaddr
+from oslo_cache import core
from oslo_log import log as logging
from neutronclient.common import exceptions as neutron_exceptions
+from trove.common import cache
from trove.common import cfg
from trove.common import clients
from trove.common import exception
@@ -26,6 +28,11 @@ MGMT_CIDRS = None
NEUTRON_EXTENSION_CACHE = {}
PROJECT_ID_EXT_ALIAS = 'project-id'
+MEMOIZE_PORTS = core.get_memoization_decorator(
+ conf=CONF,
+ region=cache.get_cache_region(),
+ group="instance_ports_cache")
+
def check_extension_enabled(client, extension_alias):
"""Check if an extension is enabled in Neutron."""
@@ -93,6 +100,20 @@ def check_subnet_router(client, subnet_id):
f"associated with router.")
+@MEMOIZE_PORTS
+def get_instance_ports(client, instance_id):
+ """Get ports attached to the trove instance.
+
+ After the trove instance is created, the attached ports are not changed.
+ """
+ LOG.info(f'Getting ports for instance {instance_id}')
+ return client.list_ports(device_id=instance_id)['ports']
+
+
+def get_port_fips(client, port_id):
+ return client.list_floatingips(port_id=port_id)['floatingips']
+
+
def create_port(client, name, description, network_id, security_groups,
is_public=False, subnet_id=None, ip=None, is_mgmt=False,
project_id=None):
diff --git a/trove/instance/models.py b/trove/instance/models.py
index e00bff0c..b2659d08 100644
--- a/trove/instance/models.py
+++ b/trove/instance/models.py
@@ -146,7 +146,7 @@ def load_simple_instance_addresses(context, db_info):
addresses = []
user_ports = []
client = clients.create_neutron_client(context, db_info.region_id)
- ports = client.list_ports(device_id=db_info.compute_instance_id)['ports']
+ ports = neutron.get_instance_ports(client, db_info.compute_instance_id)
for port in ports:
if port['network_id'] not in CONF.management_networks:
LOG.debug('Found user port %s for instance %s', port['id'],
@@ -157,12 +157,17 @@ def load_simple_instance_addresses(context, db_info):
# TODO(lxkong): IPv6 is not supported
if netutils.is_valid_ipv4(ip.get('ip_address')):
addresses.append(
- {'address': ip['ip_address'], 'type': 'private'})
-
- fips = client.list_floatingips(port_id=port['id'])
- if len(fips['floatingips']) == 0:
+ {
+ 'address': ip['ip_address'],
+ 'type': 'private',
+ 'network': port['network_id']
+ }
+ )
+
+ fips = neutron.get_port_fips(client, port['id'])
+ if len(fips) == 0:
continue
- fip = fips['floatingips'][0]
+ fip = fips[0]
addresses.append(
{'address': fip['floating_ip_address'], 'type': 'public'})