Merge "[API Replay] Migrate LB on external subnets first"
This commit is contained in:
commit
9062ba2f00
@ -175,12 +175,13 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
|
|||||||
self.migrate_security_groups()
|
self.migrate_security_groups()
|
||||||
self.migrate_qos_policies()
|
self.migrate_qos_policies()
|
||||||
routers_routes, routers_gw_info = self.migrate_routers()
|
routers_routes, routers_gw_info = self.migrate_routers()
|
||||||
self.migrate_networks_subnets_ports(routers_gw_info)
|
source_networks = self.source_neutron.list_networks()['networks']
|
||||||
|
self.migrate_networks_subnets_ports(routers_gw_info, source_networks)
|
||||||
self.migrate_floatingips()
|
self.migrate_floatingips()
|
||||||
self.migrate_routers_routes(routers_routes)
|
self.migrate_routers_routes(routers_routes)
|
||||||
self.migrate_fwaas()
|
self.migrate_fwaas()
|
||||||
if self.octavia:
|
if self.octavia:
|
||||||
self.migrate_octavia()
|
self.migrate_octavia(source_networks)
|
||||||
|
|
||||||
if self.n_errors:
|
if self.n_errors:
|
||||||
LOG.error("NSX migration is Done with %s errors:", self.n_errors)
|
LOG.error("NSX migration is Done with %s errors:", self.n_errors)
|
||||||
@ -651,12 +652,14 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
|
|||||||
self._log_elapsed(start, "Migrate subnet pools", debug=False)
|
self._log_elapsed(start, "Migrate subnet pools", debug=False)
|
||||||
return subnetpools_map
|
return subnetpools_map
|
||||||
|
|
||||||
def migrate_networks_subnets_ports(self, routers_gw_info):
|
def migrate_networks_subnets_ports(self, routers_gw_info,
|
||||||
|
source_networks=None):
|
||||||
"""Migrates networks/ports/router-uplinks from src to dest neutron."""
|
"""Migrates networks/ports/router-uplinks from src to dest neutron."""
|
||||||
start = datetime.now()
|
start = datetime.now()
|
||||||
source_ports = self.source_neutron.list_ports()['ports']
|
source_ports = self.source_neutron.list_ports()['ports']
|
||||||
source_subnets = self.source_neutron.list_subnets()['subnets']
|
source_subnets = self.source_neutron.list_subnets()['subnets']
|
||||||
source_networks = self.source_neutron.list_networks()['networks']
|
if not source_networks:
|
||||||
|
source_networks = self.source_neutron.list_networks()['networks']
|
||||||
dest_networks = self.dest_neutron.list_networks()['networks']
|
dest_networks = self.dest_neutron.list_networks()['networks']
|
||||||
dest_ports = self.dest_neutron.list_ports()['ports']
|
dest_ports = self.dest_neutron.list_ports()['ports']
|
||||||
dest_subnets = self.dest_neutron.list_subnets()['subnets']
|
dest_subnets = self.dest_neutron.list_subnets()['subnets']
|
||||||
@ -1225,7 +1228,7 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def migrate_octavia(self):
|
def migrate_octavia(self, source_networks):
|
||||||
"""Migrates Octavia NSX objects to the new neutron driver.
|
"""Migrates Octavia NSX objects to the new neutron driver.
|
||||||
The Octavia process & DB will remain unchanged.
|
The Octavia process & DB will remain unchanged.
|
||||||
Using RPC connection to connect directly with the new plugin driver.
|
Using RPC connection to connect directly with the new plugin driver.
|
||||||
@ -1280,10 +1283,40 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
|
|||||||
hms, l7pols)
|
hms, l7pols)
|
||||||
total_num = len(loadbalancers)
|
total_num = len(loadbalancers)
|
||||||
LOG.info("Migrating %d loadbalancer(s)", total_num)
|
LOG.info("Migrating %d loadbalancer(s)", total_num)
|
||||||
for count, lb in enumerate(loadbalancers, 1):
|
# In order to avoid failures in NSX-T, migrate the external LB first.
|
||||||
if lb['provisioning_status'] == 'ACTIVE':
|
# Otherwise neutron might create a new LBS and try to attach it to
|
||||||
self._migrate_octavia_lb(lb, orig_map, count, total_num)
|
# a T1 GW where another LBS is already attached'
|
||||||
|
network_dict = {network['id']: network for network in source_networks}
|
||||||
|
external_lb = []
|
||||||
|
internal_lb = []
|
||||||
|
for lb in loadbalancers:
|
||||||
|
network_id = lb.get('vip_network_id')
|
||||||
|
if not network_id:
|
||||||
|
LOG.warning("Load balancer %s does not have vip_network_id."
|
||||||
|
"Considering it as LB on internal network",
|
||||||
|
lb['id'])
|
||||||
|
internal_lb.append(lb)
|
||||||
|
continue
|
||||||
|
network = network_dict.get(network_id)
|
||||||
|
if not network:
|
||||||
|
self.add_error(
|
||||||
|
"Load balancer %s is configured on network %s, "
|
||||||
|
"whichs seem to not exist in neutron" %
|
||||||
|
(lb['id'], network_id))
|
||||||
|
continue
|
||||||
|
if network['router:external']:
|
||||||
|
external_lb.append(lb)
|
||||||
else:
|
else:
|
||||||
LOG.info("Skipping %s loadbalancer %s",
|
internal_lb.append(lb)
|
||||||
lb['provisioning_status'], lb['id'])
|
|
||||||
|
LOG.info("Migrating %d loadbalancers on external networks and then "
|
||||||
|
"%d loadbalancers on internal networks",
|
||||||
|
len(external_lb), len(internal_lb))
|
||||||
|
for lb_list in [external_lb, internal_lb]:
|
||||||
|
for count, lb in enumerate(lb_list, 1):
|
||||||
|
if lb['provisioning_status'] == 'ACTIVE':
|
||||||
|
self._migrate_octavia_lb(lb, orig_map, count, total_num)
|
||||||
|
else:
|
||||||
|
LOG.info("Skipping %s loadbalancer %s",
|
||||||
|
lb['provisioning_status'], lb['id'])
|
||||||
self._log_elapsed(start, "Migrate Octavia LBs", debug=False)
|
self._log_elapsed(start, "Migrate Octavia LBs", debug=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user