← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~chad.smith/cloud-init:aws-local-dhcp into cloud-init:master

 

All comments addressed, and we now handle backward compatibility for old metadata versions.

Diff comments:

> diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
> index 46cb9c8..d38ea8b 100644
> --- a/cloudinit/net/__init__.py
> +++ b/cloudinit/net/__init__.py
> @@ -175,12 +175,10 @@ def is_disabled_cfg(cfg):
>      return cfg.get('config') == "disabled"
>  
>  
> -def generate_fallback_config(blacklist_drivers=None, config_driver=None):
> -    """Determine which attached net dev is most likely to have a connection and
> -       generate network state to run dhcp on that interface"""
> -
> -    if not config_driver:
> -        config_driver = False
> +def find_fallback_nic(blacklist_drivers=None):
> +    """Return the name of the 'fallback' network device."""
> +    if not blacklist_drivers:
> +        blacklist_drivers = []
>  
>      if not blacklist_drivers:
>          blacklist_drivers = []

you are. dropped.

> diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
> index 4ec9592..ae0fe26 100644
> --- a/cloudinit/sources/DataSourceEc2.py
> +++ b/cloudinit/sources/DataSourceEc2.py
> @@ -21,7 +23,7 @@ from cloudinit import warnings
>  LOG = logging.getLogger(__name__)
>  
>  # Which version we are requesting of the ec2 metadata apis
> -DEF_MD_VERSION = '2009-04-04'
> +DEF_MD_VERSION = '2016-09-02'

Pushed changes addresses backward compatibility. We will attempt newer metadata versions fallback to the old version on 404s if they new version isn't supported. This is a less than 10th of a second cost on AWS to hit a missing metadata url once the metadata service root url is accessible.

Logs from AWS failure test:
2017-08-04 01:40:54,041 - url_helper.py[DEBUG]: [0/1] open 'http://169.254.169.254/2022-09-02/meta-data/instance-id' with {'allow_redirects': True, 'url': 'http://169.254.169.254/2022-09-02/meta-data/instance-id', 'headers': {'User-Agent': 'Cloud-Init/0.7.9'}, 'method': 'GET', 'timeout': 50.0} configuration
2017-08-04 01:40:54,050 - url_helper.py[DEBUG]: Read from http://169.254.169.254/2022-09-02/meta-data/instance-id (404, 345b) after 1 attempts
2017-08-04 01:40:54,050 - url_helper.py[WARNING]: Calling 'http://169.254.169.254/2022-09-02/meta-data/instance-id' failed [0/120s]: bad status code [404]
2017-08-04 01:40:54,051 - DataSourceEc2.py[DEBUG]: Skipping unsupported metadata version.
2017-08-04 01:40:54,051 - url_helper.py[DEBUG]: [0/1] open 'http://169.254.169.254/2009-04-04/meta-data/instance-id' with {'allow_redirects': True, 'url': 'http://169.254.169.254/2009-04-04/meta-data/instance-id', 'headers': {'User-Agent': 'Cloud-Init/0.7.9'}, 'method': 'GET', 'timeout': 50.0} configuration
2017-08-04 01:40:54,060 - url_helper.py[DEBUG]: Read from http://169.254.169.254/2009-04-04/meta-data/instance-id (200, 19b) after 1 attempts
2017-08-04 01:40:54,060 - DataSourceEc2.py[DEBUG]: Using metadata source: 'http://169.254.169.254'

>  
>  STRICT_ID_PATH = ("datasource", "Ec2", "strict_id")
>  STRICT_ID_DEFAULT = "warn"


-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/328241
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:aws-local-dhcp into cloud-init:master.