Unify the driver config opts

mgmt_driver, monitor_driver and infra_driver are configuration
items. Some of them are multistropt, some are listopt.
This patch uses the listopt for all of them.

In addition, rename drivers dir into infra_drivers.

Change-Id: I5bbc7b6a52d97dae8bbca7dd2e804b7c50c8f7a4
Closes-bug: 1524255
This commit is contained in:
gong yong sheng 2016-01-29 14:36:43 +08:00
parent 6d80abadd3
commit a3c44eb089
12 changed files with 26 additions and 28 deletions

View File

@ -387,18 +387,13 @@ auth_uri = http://127.0.0.1:5000
[tacker]
# Specify drivers for hosting device
# exmpale: infra_driver = noop
# exmpale: infra_driver = nova
# exmpale: infra_driver = heat
infra_driver = heat
# infra_driver = heat,nova,noop
# Specify drivers for mgmt
mgmt_driver = noop
mgmt_driver = openwrt
# mgmt_driver = noop,openwrt
# Specify drivers for monitoring
monitor_driver = ping
monitor_driver = http_ping
# monitor_driver = ping, http_ping
[tacker_nova]
# parameters for novaclient to talk to nova

View File

@ -46,9 +46,9 @@ tacker.service_plugins =
tacker.openstack.common.cache.backends =
memory = tacker.openstack.common.cache._backends.memory:MemoryBackend
tacker.tacker.device.drivers =
noop = tacker.vm.drivers.noop:DeviceNoop
nova = tacker.vm.drivers.nova.nova:DeviceNova
heat = tacker.vm.drivers.heat.heat:DeviceHeat
noop = tacker.vm.infra_drivers.noop:DeviceNoop
nova = tacker.vm.infra_drivers.nova.nova:DeviceNova
heat = tacker.vm.infra_drivers.heat.heat:DeviceHeat
tacker.tacker.mgmt.drivers =
noop = tacker.vm.mgmt_drivers.noop:DeviceMgmtNoop
openwrt = tacker.vm.mgmt_drivers.openwrt.openwrt:DeviceMgmtOpenWRT

View File

@ -18,7 +18,7 @@ import testtools
from tacker import context
from tacker.tests.unit.db import utils
from tacker.vm.drivers.heat import heat
from tacker.vm.infra_drivers.heat import heat
class FakeHeatClient(mock.Mock):
@ -48,15 +48,16 @@ class TestDeviceHeat(testtools.TestCase):
fake_heat_client = mock.Mock()
fake_heat_client.return_value = self.heat_client
self._mock(
'tacker.vm.drivers.heat.heat.HeatClient', fake_heat_client)
'tacker.vm.infra_drivers.heat.heat.HeatClient', fake_heat_client)
def _mock(self, target, new=mock.DEFAULT):
patcher = mock.patch(target, new)
return patcher.start()
def _get_expected_fields(self):
return {'stack_name': 'tacker.vm.drivers.heat.heat_DeviceHeat-eb84260e'
'-5ff7-4332-b032-50a14d6c1123', 'template':
return {'stack_name':
'tacker.vm.infra_drivers.heat.heat_DeviceHeat-eb84260e'
'-5ff7-4332-b032-50a14d6c1123', 'template':
'description: OpenWRT with services\nheat_template_version: '
'2013-05-23\noutputs:\n mgmt_ip-vdu1:\n description: '
'management ip address\n value:\n get_attr: [vdu1-net_mgmt'
@ -71,8 +72,9 @@ class TestDeviceHeat(testtools.TestCase):
' type: OS::Neutron::Port\n'}
def _get_expected_fields_user_data(self):
return {'stack_name': 'tacker.vm.drivers.heat.heat_DeviceHeat-18685f68'
'-2b2a-4185-8566-74f54e548811', 'template':
return {'stack_name':
'tacker.vm.infra_drivers.heat.heat_DeviceHeat-18685f68'
'-2b2a-4185-8566-74f54e548811', 'template':
'description: Parameterized VNF descriptor\nheat_template_version:'
' 2013-05-23\noutputs:\n mgmt_ip-vdu1:\n description: '
'management ip address\n value:\n get_attr: '
@ -91,8 +93,9 @@ class TestDeviceHeat(testtools.TestCase):
'type: OS::Neutron::Port\n'}
def _get_expected_fields_ipaddr_data(self):
return {'stack_name': 'tacker.vm.drivers.heat.heat_DeviceHeat-d1337add'
'-d5a1-4fd4-9447-bb9243c8460b', 'template':
return {'stack_name':
'tacker.vm.infra_drivers.heat.heat_DeviceHeat-d1337add'
'-d5a1-4fd4-9447-bb9243c8460b', 'template':
'description: Parameterized VNF descriptor for IP addresses\n'
'heat_template_version: 2013-05-23\noutputs:\n mgmt_ip-vdu1:\n '
' description: management ip address\n value:\n '

View File

@ -29,7 +29,7 @@ from tacker.common import log
from tacker.extensions import vnfm
from tacker.openstack.common import jsonutils
from tacker.openstack.common import log as logging
from tacker.vm.drivers import abstract_driver
from tacker.vm.infra_drivers import abstract_driver
LOG = logging.getLogger(__name__)

View File

@ -23,7 +23,7 @@ import uuid
from tacker.common import log
from tacker.openstack.common import log as logging
from tacker.vm.drivers import abstract_driver
from tacker.vm.infra_drivers import abstract_driver
LOG = logging.getLogger(__name__)

View File

@ -28,7 +28,7 @@ from oslo_config import cfg
from tacker.api.v1 import attributes
from tacker.i18n import _LE, _LW
from tacker.openstack.common import log as logging
from tacker.vm.drivers import abstract_driver
from tacker.vm.infra_drivers import abstract_driver
LOG = logging.getLogger(__name__)
CONF = cfg.CONF

View File

@ -30,7 +30,7 @@ from tacker.common import driver_manager
from tacker import context as t_context
from tacker.openstack.common import jsonutils
from tacker.openstack.common import log as logging
from tacker.vm.drivers.heat import heat
from tacker.vm.infra_drivers.heat import heat
LOG = logging.getLogger(__name__)
@ -52,8 +52,8 @@ class VNFMonitor(object):
_lock = threading.RLock()
OPTS = [
cfg.MultiStrOpt(
'monitor_driver', default=[],
cfg.ListOpt(
'monitor_driver', default=['ping', 'http_ping'],
help=_('Monitor driver to communicate with '
'Hosting VNF/logical service '
'instance tacker plugin will use')),

View File

@ -41,8 +41,8 @@ LOG = logging.getLogger(__name__)
class VNFMMgmtMixin(object):
OPTS = [
cfg.MultiStrOpt(
'mgmt_driver', default=[],
cfg.ListOpt(
'mgmt_driver', default=['noop', 'openwrt'],
help=_('MGMT driver to communicate with '
'Hosting Device/logical service '
'instance tacker plugin will use')),
@ -106,7 +106,7 @@ class VNFMPlugin(vm_db.VNFMPluginDb, VNFMMgmtMixin):
"""
OPTS = [
cfg.ListOpt(
'infra_driver', default=['heat'],
'infra_driver', default=['nova', 'heat', 'noop'],
help=_('Hosting device drivers tacker plugin will use')),
]
cfg.CONF.register_opts(OPTS, 'tacker')