Browse Source

Merge "Remove deprecated default_vim config item"

changes/88/386388/4
Jenkins 5 years ago
committed by Gerrit Code Review
parent
commit
ad1997684b
  1. 2
      devstack/lib/tacker
  2. 2
      doc/source/devref/multisite_vim_usage_guide.rst
  3. 1
      etc/config-generator.conf
  4. 1
      setup.cfg
  5. 7
      tacker/db/nfvo/nfvo_db.py
  6. 12
      tacker/extensions/nfvo.py
  7. 29
      tacker/tests/unit/vm/test_vim_client.py
  8. 33
      tacker/vnfm/vim_client.py

2
devstack/lib/tacker

@ -274,8 +274,6 @@ function configure_tacker {
iniset $TACKER_CONF tacker_heat stack_retries 60
iniset $TACKER_CONF tacker_heat stack_retry_wait 5
iniset $TACKER_CONF nfvo_vim default_vim VIM0
_tacker_setup_rootwrap
echo "Creating bridge"
sudo ovs-vsctl --may-exist add-br ${BR_MGMT}

2
doc/source/devref/multisite_vim_usage_guide.rst

@ -149,8 +149,6 @@ Limitations
~~~~~~~~~~~
* VNFs of all users currently land in the 'nfv' project that is specified
during VIM registration.
* Default VIM needs to be supplied in tacker.conf which requires a tacker
server restart if and when default VIM option changes.
* Fernet keys for password encryption and decryption is stored on file systems.
This is a limitation when multiple servers are serving behind a load balancer
server and the keys need to be synced across tacker server systems.

1
etc/config-generator.conf

@ -8,7 +8,6 @@ namespace = tacker.nfvo.nfvo_plugin
namespace = tacker.nfvo.drivers.vim.openstack_driver
namespace = tacker.vnfm.monitor
namespace = tacker.vnfm.plugin
namespace = tacker.vnfm.vim_client
namespace = tacker.vnfm.infra_drivers.heat.heat
namespace = tacker.vnfm.infra_drivers.openstack.openstack
namespace = tacker.vnfm.mgmt_drivers.openwrt.openwrt

1
setup.cfg

@ -70,7 +70,6 @@ oslo.config.opts =
tacker.nfvo.drivers.vim.openstack_driver = tacker.nfvo.drivers.vim.openstack_driver:config_opts
tacker.vnfm.monitor = tacker.vnfm.monitor:config_opts
tacker.vnfm.plugin = tacker.vnfm.plugin:config_opts
tacker.vnfm.vim_client = tacker.vnfm.vim_client:config_opts
tacker.vnfm.infra_drivers.heat.heat= tacker.vnfm.infra_drivers.heat.heat:config_opts
tacker.vnfm.infra_drivers.openstack.openstack= tacker.vnfm.infra_drivers.openstack.openstack:config_opts
tacker.vnfm.mgmt_drivers.openwrt.openwrt = tacker.vnfm.mgmt_drivers.openwrt.openwrt:config_opts

7
tacker/db/nfvo/nfvo_db.py

@ -219,13 +219,6 @@ class NfvoPluginDb(nfvo.NFVOPluginBase, db_base.CommonDbMixin):
'updated_at': timeutils.utcnow()})
return self._make_vim_dict(vim_db)
# Deprecated. Will be removed in Ocata release
def get_vim_by_name(self, context, vim_name, fields=None,
mask_password=True):
vim_db = self._get_by_name(context, Vim, vim_name)
return self._make_vim_dict(vim_db, mask_password=mask_password
)if vim_db else None
def _validate_default_vim(self, context, vim, vim_id=None):
if not vim.get('is_default'):
return True

12
tacker/extensions/nfvo.py

@ -38,16 +38,8 @@ class VimInUseException(exceptions.TackerException):
message = _("VIM %(vim_id)s is still in use by VNF")
# Deprecated. Will be removed in Ocata release
class VimDefaultNameNotDefined(exceptions.TackerException):
message = _("Default VIM is not set. Either specify a"
" valid VIM during the VNF creation or set default VIM"
" in tacker.conf")
class VimDefaultNameNotFound(exceptions.TackerException):
message = _("Default VIM name %(vim_name)s is invalid. Please specify a "
"valid default VIM name in tacker.conf")
class VimDefaultNotDefined(exceptions.TackerException):
message = _("Default VIM is not defined.")
class VimDefaultDuplicateException(exceptions.TackerException):

29
tacker/tests/unit/vm/test_vim_client.py

@ -11,8 +11,6 @@
# under the License.
import mock
from oslo_config import cfg
from sqlalchemy.orm import exc as orm_exc
from tacker.extensions import nfvo
@ -29,8 +27,6 @@ class TestVIMClient(base.TestCase):
'auth_cred': {'password': '****'}, 'type': 'test_vim'}
def test_get_vim_without_defined_default_vim(self):
cfg.CONF.set_override(
'default_vim', '', 'nfvo_vim', enforce_type=True)
vimclient = vim_client.VimClient()
service_plugins = mock.Mock()
nfvo_plugin = mock.Mock()
@ -39,28 +35,5 @@ class TestVIMClient(base.TestCase):
service_plugins.get.return_value = nfvo_plugin
with mock.patch.object(manager.TackerManager, 'get_service_plugins',
return_value=service_plugins):
self.assertRaises(nfvo.VimDefaultNameNotDefined,
self.assertRaises(nfvo.VimDefaultNotDefined,
vimclient.get_vim, None)
def test_get_vim_without_defined_default_vim_in_db(self):
cfg.CONF.set_override(
'default_vim', 'VIM0', 'nfvo_vim', enforce_type=True)
vimclient = vim_client.VimClient()
service_plugins = mock.Mock()
nfvo_plugin = mock.Mock()
nfvo_plugin.get_default_vim.side_effect = \
orm_exc.NoResultFound()
service_plugins.get.return_value = nfvo_plugin
with mock.patch.object(manager.TackerManager, 'get_service_plugins',
return_value=service_plugins):
get_vim_by_name = \
mock.patch.object(vimclient,
'_get_default_vim_by_name').start()
get_vim_by_name.return_value = self.vim_info
build_vim_auth = \
mock.patch.object(vimclient,
'_build_vim_auth').start()
build_vim_auth.return_value = mock.Mock()
vimclient.get_vim(None)
vimclient._get_default_vim_by_name.\
assert_called_once_with(mock.ANY, mock.ANY, 'VIM0')

33
tacker/vnfm/vim_client.py

@ -18,7 +18,6 @@ import os
from cryptography import fernet
from oslo_config import cfg
from oslo_log import log as logging
from oslo_log import versionutils
from tacker.extensions import nfvo
from tacker import manager
@ -28,19 +27,6 @@ LOG = logging.getLogger(__name__)
CONF = cfg.CONF
OPTS = [
cfg.StrOpt(
'default_vim', help=_('Default VIM for launching VNFs. '
'This option is deprecated and will be removed in Ocata release.'),
deprecated_for_removal=True)
]
cfg.CONF.register_opts(OPTS, 'nfvo_vim')
def config_opts():
return [('nfvo_vim', OPTS)]
class VimClient(object):
def get_vim(self, context, vim_id=None, region_name=None):
"""Get Vim information for provided VIM id
@ -57,16 +43,7 @@ class VimClient(object):
try:
vim_info = nfvo_plugin.get_default_vim(context)
except Exception:
LOG.debug(_('Default vim not set in db.'
'Attempting to find default vim from tacker.conf'))
vim_name = cfg.CONF.nfvo_vim.default_vim
if not vim_name:
raise nfvo.VimDefaultNameNotDefined()
versionutils.report_deprecated_feature(LOG, 'Configuration of '
'default-vim in tacker.conf is deprecated and will be '
'removed in Newton cycle')
vim_info = self._get_default_vim_by_name(context,
nfvo_plugin, vim_name)
raise nfvo.VimDefaultNotDefined()
else:
try:
vim_info = nfvo_plugin.get_vim(context, vim_id,
@ -88,14 +65,6 @@ class VimClient(object):
def region_valid(vim_regions, region_name):
return region_name in vim_regions
# Deprecated. Will be removed in Ocata release
def _get_default_vim_by_name(self, context, plugin, vim_name):
vim_info = plugin.get_vim_by_name(context, vim_name,
mask_password=False)
if not vim_info:
raise nfvo.VimDefaultNameNotFound(vim_name=vim_name)
return vim_info
def _build_vim_auth(self, vim_info):
LOG.debug('VIM id is %s', vim_info['id'])
vim_auth = vim_info['auth_cred']

Loading…
Cancel
Save