AdminUtils NSX|V: Fix rotuer recreate utility
The router-recreate utility failed because: 1) getting the router availability zone was done incorrectly 2) L3 code for setting the gateway needed a core-plugin Change-Id: I03e4f782e467ce0e5d31a2b5f55d602642934c94
This commit is contained in:
parent
9511de3c46
commit
ad03066423
@ -28,6 +28,7 @@ from vmware_nsx._i18n import _LE, _LI, _LW
|
|||||||
from vmware_nsx.common import locking
|
from vmware_nsx.common import locking
|
||||||
from vmware_nsx.db import nsxv_db
|
from vmware_nsx.db import nsxv_db
|
||||||
from vmware_nsx.extensions import routersize
|
from vmware_nsx.extensions import routersize
|
||||||
|
from vmware_nsx.plugins.nsx_v import availability_zones as nsx_az
|
||||||
from vmware_nsx.plugins.nsx_v.vshield import edge_utils
|
from vmware_nsx.plugins.nsx_v.vshield import edge_utils
|
||||||
from vmware_nsx.plugins.nsx_v.vshield import vcns_driver
|
from vmware_nsx.plugins.nsx_v.vshield import vcns_driver
|
||||||
|
|
||||||
@ -57,6 +58,19 @@ def delete_old_edge(context, old_edge_id):
|
|||||||
# The edge may have been already deleted at the backend
|
# The edge may have been already deleted at the backend
|
||||||
|
|
||||||
|
|
||||||
|
def _get_router_az_from_plugin_router(router):
|
||||||
|
# If the router edge was already deployed the availability_zones will
|
||||||
|
# return the az
|
||||||
|
az_name = router['availability_zones'][0]
|
||||||
|
if not az_name:
|
||||||
|
# If it was not deployed - it may be in the creation hints
|
||||||
|
az_name = router['availability_zones_hints'][0]
|
||||||
|
if not az_name:
|
||||||
|
# If not - the default az was used.
|
||||||
|
az_name = nsx_az.DEFAULT_NAME
|
||||||
|
return az_name
|
||||||
|
|
||||||
|
|
||||||
@admin_utils.output_header
|
@admin_utils.output_header
|
||||||
def nsx_recreate_router_edge(resource, event, trigger, **kwargs):
|
def nsx_recreate_router_edge(resource, event, trigger, **kwargs):
|
||||||
"""Recreate a router edge with all the data on a new NSXv edge"""
|
"""Recreate a router edge with all the data on a new NSXv edge"""
|
||||||
@ -110,7 +124,7 @@ def nsx_recreate_router_edge(resource, event, trigger, **kwargs):
|
|||||||
# Go over all the relevant routers
|
# Go over all the relevant routers
|
||||||
for router in routers:
|
for router in routers:
|
||||||
router_id = router['id']
|
router_id = router['id']
|
||||||
az_name = router['availability_zone']
|
az_name = _get_router_az_from_plugin_router(router)
|
||||||
# clean up other objects related to this router
|
# clean up other objects related to this router
|
||||||
if plugin.metadata_proxy_handler:
|
if plugin.metadata_proxy_handler:
|
||||||
md_proxy = plugin.get_metadata_proxy_handler(az_name)
|
md_proxy = plugin.get_metadata_proxy_handler(az_name)
|
||||||
|
@ -19,6 +19,7 @@ from oslo_log import log as logging
|
|||||||
|
|
||||||
from neutron import context as neutron_context
|
from neutron import context as neutron_context
|
||||||
from neutron.db import common_db_mixin as common_db
|
from neutron.db import common_db_mixin as common_db
|
||||||
|
from neutron_lib.plugins import directory
|
||||||
|
|
||||||
from vmware_nsx._i18n import _LW
|
from vmware_nsx._i18n import _LW
|
||||||
from vmware_nsx.common import config
|
from vmware_nsx.common import config
|
||||||
@ -48,6 +49,8 @@ class NsxVPluginWrapper(plugin.NsxVPlugin):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
config.register_nsxv_azs(cfg.CONF, cfg.CONF.nsxv.availability_zones)
|
config.register_nsxv_azs(cfg.CONF, cfg.CONF.nsxv.availability_zones)
|
||||||
super(NsxVPluginWrapper, self).__init__()
|
super(NsxVPluginWrapper, self).__init__()
|
||||||
|
# Make this the core plugin
|
||||||
|
directory.add_plugin('CORE', self)
|
||||||
|
|
||||||
def _start_rpc_listeners(self):
|
def _start_rpc_listeners(self):
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user