Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openstack Datasource not detected in Oracle cloud #5091

Closed
palash-gandhi opened this issue Mar 22, 2024 · 4 comments
Closed

Openstack Datasource not detected in Oracle cloud #5091

palash-gandhi opened this issue Mar 22, 2024 · 4 comments
Labels
bug Something isn't working correctly new An issue that still needs triage

Comments

@palash-gandhi
Copy link

palash-gandhi commented Mar 22, 2024

Bug report

It looks like recent changes from this PR #4426 have caused an issue in cloud-init where the datasource is not detected causing cloud-init configuration to be ignored.
Here's what we see in the logs:

2024-03-19 22:51:34,786 - __init__.py[DEBUG]: Looking for data source in: ['OpenStack', 'None'], via packages ['', 'cloudinit.sources'] that matches dependencies ['FILESYSTEM']
2024-03-19 22:51:34,802 - __init__.py[DEBUG]: Searching for local data source in: ['DataSourceOpenStackLocal']
2024-03-19 22:51:34,802 - handlers.py[DEBUG]: start: init-local/search-OpenStackLocal: searching for local data from DataSourceOpenStackLocal
2024-03-19 22:51:34,802 - __init__.py[DEBUG]: Seeing if we can get any data from <class 'cloudinit.sources.DataSourceOpenStack.DataSourceOpenStackLocal'>
2024-03-19 22:51:34,802 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: boot-new-instance
2024-03-19 22:51:34,803 - dmi.py[DEBUG]: querying dmi data /sys/class/dmi/id/product_name
2024-03-19 22:51:34,803 - dmi.py[DEBUG]: querying dmi data /sys/class/dmi/id/chassis_asset_tag
2024-03-19 22:51:34,803 - util.py[DEBUG]: Reading from /proc/1/environ (quiet=False)
2024-03-19 22:51:34,803 - util.py[DEBUG]: Read 358 bytes from /proc/1/environ
2024-03-19 22:51:34,803 - __init__.py[DEBUG]: Datasource type DataSourceOpenStackLocal [net,ver=None] is not detected.
2024-03-19 22:51:34,803 - __init__.py[DEBUG]: Datasource DataSourceOpenStackLocal [net,ver=None] not updated for events: boot-new-instance
2024-03-19 22:51:34,803 - handlers.py[DEBUG]: finish: init-local/search-OpenStackLocal: SUCCESS: no local data found from DataSourceOpenStackLocal

It looks like the ds-identify script creates a list with "None":

$ cat /run/cloud-init/cloud.cfg
datasource_list: [ OpenStack, None ]

In our cloud-init configuration, the last file to be read lexicographically contains:

$ cat /etc/cloud/cloud.cfg.d/99-delphix-datasource.cfg
datasource_list: [ OpenStack ]

The PR mentions:

If users want to force a single datasource regardless of detection, they can do so by removing None from the list.

How are we supposed to do so? The cfg files we have do not have None in the list to begin with.

Steps to reproduce the problem

This should be reproducible by creating a cfg file like the one above and attempting to run cloud-init clean and then cloud-init init. Unfortunately, I do not have an easy way to spin up a vanilla Ubuntu instance in our OCI account but if the issue is not obvious to the maintainers, I can try to spend some time requesting the required access internally.

Environment details

  • Cloud-init version: 23.4.4
  • Operating System Distribution: Ubuntu 20.04 running kernel 5.15
  • Cloud provider, platform or installer type: Oracle cloud

cloud-init logs

$ cat /run/cloud-init/ds-identify.log
[up 5.35s] ds-identify
policy loaded: mode=search report=false found=all maybe=all notfound=disabled
/etc/cloud/cloud.cfg.d/99-delphix-datasource.cfg set datasource_list: [ OpenStack ]
...
DMI_CHASSIS_ASSET_TAG=OracleCloud.com
...
VIRT=kvm
UNAME_KERNEL_NAME=Linux
UNAME_KERNEL_RELEASE=5.15.0-1052-dx2024022415-109c29fe5-oracle
UNAME_KERNEL_VERSION=#58~20.04.1 SMP Sat Feb 24 15:13:29 UTC 2024
UNAME_MACHINE=x86_64
UNAME_NODENAME=localhost.localdomain
UNAME_OPERATING_SYSTEM=GNU/Linux
DSNAME=
DSLIST=OpenStack
...
...
is_container=false
single entry in datasource_list (OpenStack) use that.
[up 5.45s] returning 0
@palash-gandhi palash-gandhi added bug Something isn't working correctly new An issue that still needs triage labels Mar 22, 2024
@palash-gandhi
Copy link
Author

cc: @cjp256 could you please shed some light on this?

@blackboxsw blackboxsw changed the title Datasource not detected in Oracle cloud Datasource not detected in Openstack cloud Mar 25, 2024
@blackboxsw blackboxsw changed the title Datasource not detected in Openstack cloud Openstack Datasource not detected in Oracle cloud Mar 25, 2024
@TheRealFalcon TheRealFalcon reopened this Mar 25, 2024
@TheRealFalcon
Copy link
Member

TheRealFalcon commented Mar 25, 2024

@palash-delphix Sorry for closing earlier, I accidentally hit the "Close with comment" while in the middle of writing my comment.

I'm working on reproducing this, but in the mean time, can you explain what you're trying to achieve with this configuration? Why does /etc/cloud/cloud.cfg.d/99-delphix-datasource.cfg contain datasource_list: [ OpenStack ]? Without any configuration, cloud-init should identify the Oracle datasource and use that. Years ago, the Oracle cloud used the OpenStack datasource, but that generally shouldn't be used anymore. Are you trying to keep some functionality that the new datasource doesn't have, and if so, what? Is this old configuration that has been brought forward that may no longer be necessary? If so, does it work for you to remove /etc/cloud/cloud.cfg.d/99-delphix-datasource.cfg?

@blackboxsw
Copy link
Collaborator

Also, if you determine that, for some reason your images/platform needs require OpenStack datasource to be used. This could be resolved without any changes to cloud-init or ds-identify given a simple config file change if you have reasons to retain OpenStack datasource instead of Oracle platform.

From the looks of the DataSourceOpenStack.ds_detect. If Oracle exists in the datasource_list, the OpenStack datasource can be detected and preferred above Oracle DataSource if both OpenStack and Oracle as in datasource_list.

It looks like the following config could be provided in /etc/cloud/cloud.cfg.d/99-delphix-datasource.cfg

datasource_list: [ OpenStack, Oracle ]

This will tell the unique DataSourceOpenStack.ds_detect logic to prefer OpenStack datasource detection on any system which exposes chassis asset tag=OracleCloud.com.

TheRealFalcon added a commit to TheRealFalcon/cloud-init that referenced this issue Mar 26, 2024
ds-identify would automatically append "None" to the datasource_list
if a single entry was provided in /etc/cloud/cloud.cfg[.d].
This wasn't a problem in the past as the python code would detect
a single datasource along with None as an indication to automatically
use that datasource. Since the python code no longer does that,
we should ensure that one specified datasource results in one specified
datasource after ds-identify has run.

Fixes canonicalGH-5091
@palash-gandhi
Copy link
Author

@TheRealFalcon and @blackboxsw Thank you for the quick response and fix. Much appreciated.

blackboxsw pushed a commit to blackboxsw/cloud-init that referenced this issue Mar 26, 2024
This change may require a user to add `None` to the `datasource_list`
defined in `/etc/cloud/cloud.cfg[.d]` if they have a customized
datasource_list and want the DataSourceNone fallback behavior.

ds-identify would automatically append "None" to the datasource_list
if a single entry was provided in /etc/cloud/cloud.cfg[.d].
This wasn't a problem in the past as the python code would detect
a single datasource along with None as an indication to automatically
use that datasource. Since the python code no longer does that,
we should ensure that one specified datasource results in one specified
datasource after ds-identify has run.

Fixes canonicalGH-5091
TheRealFalcon added a commit that referenced this issue Mar 27, 2024
This change may require a user to add `None` to the `datasource_list`
defined in `/etc/cloud/cloud.cfg[.d]` if they have a customized
datasource_list and want the DataSourceNone fallback behavior.

ds-identify would automatically append "None" to the datasource_list
if a single entry was provided in /etc/cloud/cloud.cfg[.d].
This wasn't a problem in the past as the python code would detect
a single datasource along with None as an indication to automatically
use that datasource. Since the python code no longer does that,
we should ensure that one specified datasource results in one specified
datasource after ds-identify has run.

Fixes GH-5091
holmanb pushed a commit that referenced this issue Apr 3, 2024
This change may require a user to add `None` to the `datasource_list`
defined in `/etc/cloud/cloud.cfg[.d]` if they have a customized
datasource_list and want the DataSourceNone fallback behavior.

ds-identify would automatically append "None" to the datasource_list
if a single entry was provided in /etc/cloud/cloud.cfg[.d].
This wasn't a problem in the past as the python code would detect
a single datasource along with None as an indication to automatically
use that datasource. Since the python code no longer does that,
we should ensure that one specified datasource results in one specified
datasource after ds-identify has run.

Fixes GH-5091
holmanb pushed a commit that referenced this issue Apr 3, 2024
This change may require a user to add `None` to the `datasource_list`
defined in `/etc/cloud/cloud.cfg[.d]` if they have a customized
datasource_list and want the DataSourceNone fallback behavior.

ds-identify would automatically append "None" to the datasource_list
if a single entry was provided in /etc/cloud/cloud.cfg[.d].
This wasn't a problem in the past as the python code would detect
a single datasource along with None as an indication to automatically
use that datasource. Since the python code no longer does that,
we should ensure that one specified datasource results in one specified
datasource after ds-identify has run.

Fixes GH-5091
holmanb pushed a commit that referenced this issue Apr 3, 2024
This change may require a user to add `None` to the `datasource_list`
defined in `/etc/cloud/cloud.cfg[.d]` if they have a customized
datasource_list and want the DataSourceNone fallback behavior.

ds-identify would automatically append "None" to the datasource_list
if a single entry was provided in /etc/cloud/cloud.cfg[.d].
This wasn't a problem in the past as the python code would detect
a single datasource along with None as an indication to automatically
use that datasource. Since the python code no longer does that,
we should ensure that one specified datasource results in one specified
datasource after ds-identify has run.

Fixes GH-5091
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly new An issue that still needs triage
Projects
None yet
Development

No branches or pull requests

3 participants