Skip to content

Ensure system_cfg read before ds net config on Oracle (SC-720)#1174

Merged
blackboxsw merged 4 commits into
canonical:mainfrom
TheRealFalcon:oracle-systemcfg
Jan 15, 2022
Merged

Ensure system_cfg read before ds net config on Oracle (SC-720)#1174
blackboxsw merged 4 commits into
canonical:mainfrom
TheRealFalcon:oracle-systemcfg

Conversation

@TheRealFalcon
Copy link
Copy Markdown
Contributor

Proposed Commit Message

Ensure system_cfg read before ds net config on Oracle

In 2c52e6e88b19f5db8d55eb7280ee27703e05d75f, the order of
reading network config was changed for Oracle due to initramfs
needing to take lower precedence than the datasource. However,
this also bumped system_cfg to a lower precedence than ds, which
means that any network configuration specified in /etc/cloud will not
be applied. system_cfg should instead be moved above ds so network
configuration in /etc/cloud takes precedence.

LP: #1956788

Additional Context

2c52e6e

Test Steps

Boot an Oracle instance using the Oracle datasource.
Create /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with contents network: {config: disabled}
rm /etc/netplan/50-cloud-init.yaml (or rename it if you need it)
cloud-init clean --logs && cloud-init init --local
Without patch, /etc/netplan/50-cloud-init.yaml should get written. With patch, it won't be written and logs should show no network written.

I can also include an Oracle-specific integration test, but wanted to get the PR up sooner rather than later.

Checklist:

  • My code follows the process laid out in the documentation
  • I have updated or added any unit tests accordingly
  • I have updated or added any documentation accordingly

In 2c52e6e, the order of
reading network config was changed for Oracle due to initramfs
needing to take lower precedence than the datasource. However,
this also bumped system_cfg to a lower precedence than ds, which
means that any network configuration specified in /etc/cloud will not
be applied. system_cfg should instead be moved above ds so network
configuration in /etc/cloud takes precedence.

LP: #1956788
@TheRealFalcon TheRealFalcon changed the title Ensure system_cfg read before ds net config on Oracle Ensure system_cfg read before ds net config on Oracle (SC-720) Jan 10, 2022
Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to run through an Oracle test now to confirm expected behavior.

Comment thread tests/unittests/sources/test_oracle.py Outdated
Comment thread tests/integration_tests/network/test_net_config_load.py Outdated
TheRealFalcon and others added 2 commits January 13, 2022 16:35
Co-authored-by: Chad Smith <chad.smith@canonical.com>
Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
confirmed upgrade behavior without restart via sudo cloud-init init --local; sudo cloud-init init allows OracleDatasource to see the disabled config. Same across system reboot network is no longer rendered and instance remains accessible via ssh.

ubuntu@instance-20220115-0946:~$ grep 'disabled by' /var/log/cloud-init.log 
2022-01-15 17:44:55,657 - stages.py[DEBUG]: network config disabled by system_cfg
2022-01-15 17:44:55,657 - stages.py[INFO]: network config is disabled by system_cfg
2022-01-15 17:44:56,102 - stages.py[DEBUG]: network config disabled by system_cfg
2022-01-15 17:44:56,102 - stages.py[INFO]: network config is disabled by system_cfg
...
ubuntu@instance-20220115-0946:~$ ls /etc/netplan/
ubuntu@instance-20220115-0946:~$
ubuntu@instance-20220115-0946:~$ cloud-init status --long
status: done
time: Sat, 15 Jan 2022 17:52:25 +0000
detail:
DataSourceOracle
ubuntu@instance-20220115-0946:~$ grep Trace /var/log/cloud-init.log 
ubuntu@instance-20220115-0946:~$

cloud-init can be re-enabled for networking on oracle by sudo rm /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

@blackboxsw blackboxsw merged commit b306633 into canonical:main Jan 15, 2022
@TheRealFalcon TheRealFalcon deleted the oracle-systemcfg branch March 10, 2022 21:51
TheRealFalcon added a commit to TheRealFalcon/cloud-init that referenced this pull request Mar 10, 2022
…cal#1174)"

This reverts commit b306633.

While this ultimately seems like a better solution, currently the
file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg exists on
all Oracle launched instances which will prevent networking from
being properly initialized.
blackboxsw pushed a commit that referenced this pull request Mar 11, 2022
#1326)

This reverts commit b306633.

While this ultimately seems like a better solution, currently the
file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg exists on
all Oracle launched instances which will prevent networking from
being properly initialized.
TheRealFalcon added a commit that referenced this pull request Mar 11, 2022
#1326)

This reverts commit b306633.

While this ultimately seems like a better solution, currently the
file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg exists on
all Oracle launched instances which will prevent networking from
being properly initialized.
TheRealFalcon added a commit that referenced this pull request Mar 11, 2022
#1326)

This reverts commit b306633.

While this ultimately seems like a better solution, currently the
file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg exists on
all Oracle launched instances which will prevent networking from
being properly initialized.
TheRealFalcon added a commit that referenced this pull request Mar 11, 2022
#1326)

This reverts commit b306633.

While this ultimately seems like a better solution, currently the
file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg exists on
all Oracle launched instances which will prevent networking from
being properly initialized.
TheRealFalcon added a commit that referenced this pull request Mar 11, 2022
#1326)

This reverts commit b306633.

While this ultimately seems like a better solution, currently the
file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg exists on
all Oracle launched instances which will prevent networking from
being properly initialized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants