Register boot_wait option at VNFM plugin level

Remove boot_wait conf from monitor and register
at plugin level

Change-Id: Iee6be94b5579fd1f96751315d4a35384c6dc9ebb
Partial-Bug: #1501079
This commit is contained in:
Bharath Thiruveedula 2015-10-14 17:07:31 +05:30
parent 0773f4e1a1
commit 09070c6af3
2 changed files with 9 additions and 8 deletions

View File

@ -41,9 +41,6 @@ OPTS = [
cfg.IntOpt('check_intvl',
default=10,
help=_("check interval for monitor")),
cfg.IntOpt('boot_wait',
default=30,
help=_("boot wait for monitor")),
]
CONF.register_opts(OPTS, group='monitor')
@ -65,16 +62,17 @@ class VNFMonitor(object):
]
cfg.CONF.register_opts(OPTS, 'servicevm')
def __new__(cls, check_intvl=None):
def __new__(cls, boot_wait, check_intvl=None):
if not cls._instance:
cls._instance = super(VNFMonitor, cls).__new__(cls)
return cls._instance
def __init__(self, check_intvl=None):
def __init__(self, boot_wait, check_intvl=None):
self._monitor_manager = driver_manager.DriverManager(
'tacker.servicevm.monitor.drivers',
cfg.CONF.servicevm.monitor_driver)
self.boot_wait = boot_wait
if check_intvl is None:
check_intvl = cfg.CONF.monitor.check_intvl
self._status_check_intvl = check_intvl
@ -126,7 +124,7 @@ class VNFMonitor(object):
vdupolicies = hosting_vnf['monitoring_policy']['vdus']
vnf_delay = hosting_vnf['monitoring_policy'].get(
'monitoring_delay', cfg.CONF.monitor.boot_wait)
'monitoring_delay', self.boot_wait)
for vdu in vdupolicies.keys():
if hosting_vnf.get('dead'):

View File

@ -48,6 +48,8 @@ class VNFMMgmtMixin(object):
help=_('MGMT driver to communicate with '
'Hosting Device/logical service '
'instance servicevm plugin will use')),
cfg.IntOpt('boot_wait', default=30,
help=_('Time interval to wait for VM to boot')),
]
cfg.CONF.register_opts(OPTS, 'servicevm')
@ -166,10 +168,11 @@ class VNFMPlugin(vm_db.VNFMPluginDb, VNFMMgmtMixin):
def __init__(self):
super(VNFMPlugin, self).__init__()
self._pool = eventlet.GreenPool()
self.boot_wait = cfg.CONF.servicevm.boot_wait
self._device_manager = driver_manager.DriverManager(
'tacker.servicevm.device.drivers',
cfg.CONF.servicevm.infra_driver)
self._vnf_monitor = monitor.VNFMonitor()
self._vnf_monitor = monitor.VNFMonitor(self.boot_wait)
def spawn_n(self, function, *args, **kwargs):
self._pool.spawn_n(function, *args, **kwargs)
@ -230,7 +233,7 @@ class VNFMPlugin(vm_db.VNFMPluginDb, VNFMMgmtMixin):
config = device_dict['attributes'].get('config')
if not config:
return
eventlet.sleep(30) # wait for vm to be ready
eventlet.sleep(self.boot_wait) # wait for vm to be ready
device_id = device_dict['id']
update = {
'device': {