← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~chad.smith/cloud-init:bug/1776701-openstack-local-no-probe-on-ec2 into cloud-init:master

 


Diff comments:

> diff --git a/cloudinit/sources/DataSourceOpenStack.py b/cloudinit/sources/DataSourceOpenStack.py
> index 1a12a3f..1c803f4 100644
> --- a/cloudinit/sources/DataSourceOpenStack.py
> +++ b/cloudinit/sources/DataSourceOpenStack.py
> @@ -205,6 +212,20 @@ def read_metadata_service(base_url, ssl_details=None,
>      return reader.read_v2()
>  
>  
> +def detect_openstack():
> +    """Return True when a potential OpenStack platform is detected."""
> +    if not util.is_x86():
> +        return True  # Non-Intel cpus don't properly report dmi product names
> +    product_name = util.read_dmi_data('system-product-name')
> +    if product_name in (DMI_PRODUCT_NOVA, DMI_PRODUCT_COMPUTE):

done.

> +        return True
> +    elif util.read_dmi_data('chassis-asset-tag') == DMI_ASSET_TAG_OPENTELEKOM:
> +        return True
> +    elif util.get_proc_env(1).get('product_name') == DMI_PRODUCT_NOVA:
> +        return True
> +    return False
> +
> +
>  # Used to match classes to dependencies
>  datasources = [
>      (DataSourceOpenStackLocal, (sources.DEP_FILESYSTEM,)),
> diff --git a/cloudinit/util.py b/cloudinit/util.py
> index 26a4112..40a3959 100644
> --- a/cloudinit/util.py
> +++ b/cloudinit/util.py
> @@ -2629,6 +2629,15 @@ def _call_dmidecode(key, dmidecode_path):
>          return None
>  
>  
> +def is_x86():

was trying to avoid the additional function call cost in this case for all our read_dmi_data calls, but let's move it in to avoid duplication.

> +    """Return True if platform is x86-based"""
> +    uname_arch = os.uname()[4]
> +    x86_arch_match = (
> +        uname_arch == 'x86_64' or
> +        (uname_arch[0] == 'i' and uname_arch[2:] == '86'))
> +    return x86_arch_match
> +
> +
>  def read_dmi_data(key):
>      """
>      Wrapper for reading DMI data.


-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/347937
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:bug/1776701-openstack-local-no-probe-on-ec2 into cloud-init:master.


References