This repository was archived by the owner on Jul 13, 2023. It is now read-only.
fix path for configdrive and metadata file names - #13
Open
miker-git wants to merge 1 commit into
Open
Conversation
Author
|
Do we have an update on this, it is blocking some work we are trying to implement. Thanks |
Contributor
|
Can you share a link to the API docs that? The upstream project has the same values as the Flatcar fork: https://github.com/coreos/afterburn/blob/main/src/providers/cloudstack/configdrive.rs#L117 |
Author
|
I'm not a developer or someone with much rust knowledge, I just found the bug on our cloudstack installs and provided a fix. I guess I'll try and upstream it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: Fix for configdrive on cloudstack, not working currently.
Running afterburn on a flatcar instance in cloudstack with configdrive enabled results in metadata not been parsed, I checked the code and figured out it was a path issue and a metadata file name issue. This should fix those issues.
How to use
Compile the code copy over to a flatcar instance with cloudstack configdrive enabled and run it with
--provider cloudstack-configdrive --attributes /tmp/test
/tmp/test should contain the following attributes
AFTERBURN_CLOUDSTACK_SERVICE_OFFERING=1 CPUs / 1 GB RAM
AFTERBURN_CLOUDSTACK_VM_ID=040970cd-302b-42ab-9c94-b040dac71033
AFTERBURN_CLOUDSTACK_CLOUD_IDENTIFIER=CloudStack-{b2c59cf3-2d51-43ee-ae83-dbdc6b20e345}
AFTERBURN_CLOUDSTACK_INSTANCE_ID=040970cd-302b-42ab-9c94-b040dac71033
AFTERBURN_CLOUDSTACK_LOCAL_HOSTNAME=hostname-of-this-box
Testing done
Note the path difference for the configdrive, all lowercase not ConfigDrive
localhost metadata # df -k
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 475956 0 475956 0% /dev
tmpfs 500936 0 500936 0% /dev/shm
tmpfs 200376 412 199964 1% /run
tmpfs 4096 0 4096 0% /sys/fs/cgroup
/dev/sda9 2078944 111368 1840500 6% /
/dev/mapper/usr 1007760 888432 67312 93% /usr
none 460800 341524 119276 75% /run/torcx/unpack
tmpfs 500936 0 500936 0% /media
tmpfs 500936 8 500928 1% /tmp
/dev/sr1 410 410 0 100% /media/configdrive
And filenames are - rather than _
localhost metadata # cd /media/configdrive/cloudstack/metadata/
localhost metadata # ls
availability-zone.txt cloud-identifier.txt instance-id.txt local-hostname.txt local-ipv4.txt public-ipv4.txt public-keys.txt service-offering.txt vm-id.txt
Running /usr/bin/coreos-metadata on a configdrive enabled VM results in a rust backtrace
localhost metadata # /usr/bin/coreos-metadata --provider cloudstack-configdrive --attributes /tmp/test
thread 'main' panicked at 'called
Result::unwrap()on anErrvalue: Error(Msg("failed to unmount target '"/tmp/afterburn.75degzGcMNzH/cloudstack/metadata"'"), State { next_error: Some(Sys(EINVAL)), backtrace: InternalBacktrace })', src/providers/cloudstack/configdrive.rs:159:46note: run with
RUST_BACKTRACE=1environment variable to display a backtracelocalhost metadata # echo $?
101
Running the updated code which I've copied to /root for testing results in a correct run and update
localhost metadata # /root/coreos-metadata --provider cloudstack-configdrive --attributes /tmp/test
localhost metadata # cat /tmp/test
AFTERBURN_CLOUDSTACK_SERVICE_OFFERING=1 CPUs / 1 GB RAM
AFTERBURN_CLOUDSTACK_VM_ID=040970cd-302b-42ab-9c94-b040dac71033
AFTERBURN_CLOUDSTACK_CLOUD_IDENTIFIER=CloudStack-{b2c59cf3-2d51-43ee-ae83-dbdc6b20e345}
AFTERBURN_CLOUDSTACK_LOCAL_HOSTNAME=hostname-of-this-box
AFTERBURN_CLOUDSTACK_INSTANCE_ID=040970cd-302b-42ab-9c94-b040dac71033