cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #06471
Re: [Merge] ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master
Diff comments:
> diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
> index f3cec79..fa15b96 100644
> --- a/cloudinit/net/__init__.py
> +++ b/cloudinit/net/__init__.py
> @@ -272,25 +273,30 @@ def generate_fallback_config(blacklist_drivers=None, config_driver=None):
> config_driver = False
>
> target_name = find_fallback_nic(blacklist_drivers=blacklist_drivers)
> - if target_name:
> - target_mac = read_sys_net_safe(target_name, 'address')
> + if not target_name:
> + # can't read any interfaces addresses (or there are none); give up
> + return None
> + target_mac = read_sys_net_safe(target_name, 'address')
> + driver_params = {}
> + if config_driver:
> + driver = device_driver(target_name)
> + if driver:
> + driver_params = {'driver': driver,
> + 'device_id': device_devid(target_name)}
> + if network_version == 1:
> + # TODO(Drop network v1 once NetworkState parses v2)
You are correct here, I misinterpreted a test failure I ran into with network_state not handling v2 match:driver declarations when emitting udev rules. Got that fixed in the followup.
> nconf = {'config': [], 'version': 1}
> cfg = {'type': 'physical', 'name': target_name,
> 'mac_address': target_mac, 'subnets': [{'type': 'dhcp'}]}
> - # inject the device driver name, dev_id into config if enabled and
> - # device has a valid device driver value
> - if config_driver:
> - driver = device_driver(target_name)
> - if driver:
> - cfg['params'] = {
> - 'driver': driver,
> - 'device_id': device_devid(target_name),
> - }
> + if driver_params:
> + cfg['params'] = driver_params
> nconf['config'].append(cfg)
> return nconf
> - else:
> - # can't read any interfaces addresses (or there are none); give up
> - return None
> + cfg = {'dhcp4': True, 'set-name': target_name,
> + 'match': {'macaddress': target_mac.lower()}}
> + cfg['match'].update(driver_params)
> + nconf = {'ethernets': {target_name: cfg}, 'version': 2}
> + return nconf
>
>
> def extract_physdevs(netcfg):
--
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master.
References