In config.py the network_devices object should be returned after the 'for vifaddr in network_info:' loop to ensure the network_devices object includes all network devices.
CURRENT CODE (annotated area of interest with >>>>):
def create_network(self, instance_name, instance, network_info):
"""Create the LXD container network on the host
:param instance_name: nova instance name
:param instance: nova instance object
:param network_info: instance network configuration object :return:network configuration dictionary
""" LOG.debug('create_network called for instance', instance=instance)
try: network_devices = {}
if not network_info: return
for vifaddr in network_info:
cfg = self.vif_driver.get_config(instance, vifaddr)
key = str(cfg['bridge']) network_devices[key] = {'nictype': 'bridged', 'hwaddr': str(cfg['mac_address']), 'parent': key, 'type': 'nic'} host_device = self.vif_driver.get_vif_devname(vifaddr)
if host_device: network_devices[key]['host_name'] = host_device
>>>> return network_devices
except Exception as ex:
with excutils.save_and_reraise_exception(): LOG.error( _LE('Fail to configure network for %(instance)s: %(ex)s'), {'instance': instance_name, 'ex': ex}, instance=instance)
PROPOSED CHANGE (annotated area of interest with >>>>):
def create_network(self, instance_name, instance, network_info):
"""Create the LXD container network on the host
:param instance_name: nova instance name
:param instance: nova instance object
:param network_info: instance network configuration object :return:network configuration dictionary
""" LOG.debug('create_network called for instance', instance=instance)
try: network_devices = {}
if not network_info: return
for vifaddr in network_info:
cfg = self.vif_driver.get_config(instance, vifaddr)
key = str(cfg['bridge']) network_devices[key] = {'nictype': 'bridged', 'hwaddr': str(cfg['mac_address']), 'parent': key, 'type': 'nic'} host_device = self.vif_driver.get_vif_devname(vifaddr)
if host_device: network_devices[key]['host_name'] = host_device
except Exception as ex:
with excutils.save_and_reraise_exception(): LOG.error( _LE('Fail to configure network for %(instance)s: %(ex)s'), {'instance': instance_name, 'ex': ex}, instance=instance)
>>>> return network_devices
RELEASE: nova-compute-lxd 13.3.0-0ubuntu1
DESCRIPTION:
In config.py the network_devices object should be returned after the 'for vifaddr in network_info:' loop to ensure the network_devices object includes all network devices.
CURRENT CODE (annotated area of interest with >>>>):
def create_ network( self, instance_name, instance, network_info):
"""Create the LXD container network on the host
:param instance_name: nova instance name
:return: network configuration dictionary
LOG.debug( 'create_ network called for instance', instance=instance)
network_ devices = {}
return driver. get_config( instance, vifaddr)
network_ devices[ key] = {'nictype': 'bridged', 'hwaddr': str(cfg[ 'mac_address' ]), 'parent': key, 'type': 'nic'}
host_ device = self.vif_ driver. get_vif_ devname( vifaddr)
network_ devices[ key]['host_ name'] = host_device save_and_ reraise_ exception( ):
LOG.error(
_ LE('Fail to configure network for %(instance)s: %(ex)s'),
{ 'instance' : instance_name, 'ex': ex}, instance=instance)
:param instance: nova instance object
:param network_info: instance network configuration object
"""
try:
if not network_info:
for vifaddr in network_info:
cfg = self.vif_
key = str(cfg['bridge'])
if host_device:
>>>> return network_devices
except Exception as ex:
with excutils.
PROPOSED CHANGE (annotated area of interest with >>>>):
def create_ network( self, instance_name, instance, network_info):
"""Create the LXD container network on the host
:param instance_name: nova instance name
:return: network configuration dictionary
LOG.debug( 'create_ network called for instance', instance=instance)
network_ devices = {}
return driver. get_config( instance, vifaddr)
network_ devices[ key] = {'nictype': 'bridged', 'hwaddr': str(cfg[ 'mac_address' ]), 'parent': key, 'type': 'nic'}
host_ device = self.vif_ driver. get_vif_ devname( vifaddr)
network_ devices[ key]['host_ name'] = host_device save_and_ reraise_ exception( ):
LOG.error(
_ LE('Fail to configure network for %(instance)s: %(ex)s'),
{ 'instance' : instance_name, 'ex': ex}, instance=instance)
:param instance: nova instance object
:param network_info: instance network configuration object
"""
try:
if not network_info:
for vifaddr in network_info:
cfg = self.vif_
key = str(cfg['bridge'])
if host_device:
except Exception as ex:
with excutils.
>>>> return network_devices