Openwrt mgmt driver support to exec cmd on multi vdu instances
When vnf supporting scale, there are multi mgmt_ip_address to
be configured via openwrt mgmt_driver.
Closes-Bug:
@@ -58,13 +58,18 @@ class DeviceMgmtOpenWRT(abstract_driver.DeviceMGMTAbstractDriver):
password = cfg.CONF.openwrt.password
try:
cmd = "uci import %s; /etc/init.d/%s restart" % (service, service)
- LOG.debug(_('execute command: %s'), (cmd))
- commander = cmd_executer.RemoteCommandExecutor(user,
- password,
- mgmt_ip_address)
+ LOG.debug(_('execute command: %(cmd)s on mgmt_ip_address '
+ '%(mgmt_ip)s'),
+ {'cmd': cmd,
+ 'mgmt_ip': mgmt_ip_address})
+ commander = cmd_executer.RemoteCommandExecutor(
+ user, password, mgmt_ip_address)
commander.execute_command(cmd, input_data=config)
except Exception as ex:
- LOG.error(_("While executing command on remote: %s"), ex)
+ LOG.error(_("While executing command on remote "
+ "%(mgmt_ip)s: %(exception)s"),
+ {'mgmt_ip': mgmt_ip_address,
+ 'exception': ex})
raise exceptions.MgmtDriverException()
@log.log
@@ -92,7 +97,13 @@ class DeviceMgmtOpenWRT(abstract_driver.DeviceMGMTAbstractDriver):
mgmt_ip_address = mgmt_url.get(vdu, '')
if not mgmt_ip_address:
LOG.warning(_('tried to configure unknown mgmt '
- 'address %s'),
- vdu)
+ 'address on VNF %(vnf)s VDU %(vdu)s'),
+ {'vnf': vnf.get('name'),
+ 'vdu': vdu})
continue
+
+ if isinstance(mgmt_ip_address, list):
+ for ip_address in mgmt_ip_address:
+ self._config_service(ip_address, key, conf_value)
+ else:
self._config_service(mgmt_ip_address, key, conf_value)
