Skip to content

integration: do not LXD bind mount /etc/cloud/cloud.cfg.d#1234

Merged
blackboxsw merged 3 commits into
canonical:mainfrom
blackboxsw:integration-tests-lxd-mounts-cfg-d
Feb 3, 2022
Merged

integration: do not LXD bind mount /etc/cloud/cloud.cfg.d#1234
blackboxsw merged 3 commits into
canonical:mainfrom
blackboxsw:integration-tests-lxd-mounts-cfg-d

Conversation

@blackboxsw
Copy link
Copy Markdown
Collaborator

Proposed Commit Message

integration: do not LXD bind mount /etc/cloud/cloud.cfg.d
    
Since lxc bind mounts will be read-only as nobody:nogroup
we don't want to bind mount /etc/cloud/cloud.cfg.d into the
instance because some tests add artifacts to /etc/cloud/cloud.cfg.d.

Also make LXD push_file pull_file methods assert that the
file transfer was a success, otherwise we miss the root-cause
for test failures.

This resulted in failed Jenkins runs in test_lxd_discovery with a
symptom of NoCloud being detected instead of LXD datasource.
The root-case was that instance.file_push failed due to permission
errors for root on the bind mounted /etc/cloud/cloud.cfg.d.

Also bump pycloudlib commitish to get Azure Jammy image support.

Additional Context

Test Steps

cat >/tmp/pycloudlib-lxd.toml <<EOF
[lxd]
EOF
CLOUD_INIT_PLATFORM=lxd_container CLOUD_INIT_OS_IMAGE=focal CLOUD_INIT_COLLECT_LOGS=ON_ERROR PYCLOUDLIB_CONFIG=/tmp/pycloudlib-lxd.toml CLOUD_INIT_LOCAL_LOG_PATH=/tmp/ci-logs CLOUD_INIT_CLOUD_INIT_SOURCE=IN_PLACE tox -e integration-tests tests/integration_tests/datasources/test_lxd_discovery.py

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

@blackboxsw blackboxsw force-pushed the integration-tests-lxd-mounts-cfg-d branch from c691889 to b4eead3 Compare February 3, 2022 00:17
Copy link
Copy Markdown
Contributor

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

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

Good find! One question inline, but +1 since it shouldn't be a problem either way.

You also have a conflict you'll need to fix first because of my merge 😬

Comment thread tests/integration_tests/clouds.py Outdated
(
os.path.join(cloudinit_path, "..", "config", "cloud.cfg.d"),
"/etc/cloud/cloud.cfg.d",
"/var/tmp/etc/cloud/cloud.cfg.d",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we're pushing these files directly, there's no reason to mount this directory anymore, correct?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

d'oh, leftover attempt to avoid the nobody/nogroup bin mount. I was originally trying to bind mount then copy the full directory from the bind-mount over to /etc/cloud/cloud.cfg.d, but I realized that I should just copy the files in the first place without the bind-mount anyway. So I'm dropping that mount defitinitions as it's unused now.

Since lxc bind mounts will be read-only as nobody:nogroup
we don't want to bind mount /etc/cloud/cloud.cfg.d into the
instance because some tests add artifacts to /etc/cloud/cloud.cfg.d.

Also make LXD push_file pull_file methods assert that the
file transfer was a success, otherwise we miss the root-cause
for test failures.
@blackboxsw blackboxsw force-pushed the integration-tests-lxd-mounts-cfg-d branch from b4eead3 to a62ef18 Compare February 3, 2022 03:51
@blackboxsw blackboxsw merged commit 6ed3c5d into canonical:main Feb 3, 2022
@cpaelzer cpaelzer mentioned this pull request Jul 24, 2024
7 tasks
@holmanb holmanb mentioned this pull request Jul 9, 2025
8 tasks
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