Set Azure to only update metadata on BOOT_NEW_INSTANCE (SC-386)#1006
Merged
TheRealFalcon merged 2 commits intoSep 3, 2021
Conversation
561891e to
17bcb81
Compare
Contributor
|
LGTM |
Contributor
Author
|
@blackboxsw , if you approve, don't merge right away. Looking at an integration test issue. |
In canonical#834, we refactored the handling of events for fetching new metadata. Previously, in Azure's __init__, the BOOT event was added to the update_events, so it was assumed that Azure required the standard BOOT behavior, which is to apply metadata twice every boot: once during local-init, then again during standard init phase. https://github.com/canonical/cloud-init/blob/21.2/cloudinit/sources/DataSourceAzure.py#L356 However, this line was effectively meaningless. After the metadata was fetched in local-init, it was then pickled out to disk. Because "update_events" was a class variable, the EventType.BOOT was not persisted into the pickle. When the pickle was then unpickled in the init phase, metadata did not get re-fetched because EventType.BOOT was not present, so Azure is effectely only BOOT_NEW_INSTANCE. Fetching metadata twice during boot causes some issue for pre-provisioning on Azure because updating metadata during re-provisioning will cause cloud-init to poll for reprovisiondata again in DataSourceAzure, which will infinitely return 404(reprovisiondata is deleted from IMDS after health signal was sent by cloud-init during init-local). This makes cloud-init stuck in 'init'
17bcb81 to
75dd7ac
Compare
Contributor
Author
|
I removed the integration test update. It conflicts with what I've done in #1001 so any necessary changes will go there. I posted my manual test steps, and that should be sufficient here. |
blackboxsw
reviewed
Sep 3, 2021
Collaborator
blackboxsw
left a comment
There was a problem hiding this comment.
generally looks good. Want some manual test time on this thought tomorrow. base class update events look good at just EventType.BOOT_NEW_INSTANCE.
blackboxsw
approved these changes
Sep 3, 2021
Collaborator
blackboxsw
left a comment
There was a problem hiding this comment.
Manual testing upgrade clean and existing systems looking good and re-applying network only when expected on 21.3-11-g843eb94b-1~bddeb
TheRealFalcon
added a commit
to TheRealFalcon/cloud-init
that referenced
this pull request
Sep 17, 2021
In canonical#1006, we set Azure to apply networking config every BOOT_NEW_INSTANCE because the BOOT_LEGACY option was causing problems applying networking the second time per boot. However, BOOT_NEW_INSTANCE is also wrong as Azure needs to apply networking once per boot, during init-local phase.
TheRealFalcon
added a commit
to TheRealFalcon/cloud-init
that referenced
this pull request
Sep 17, 2021
In canonical#1006, we set Azure to apply networking config every BOOT_NEW_INSTANCE because the BOOT_LEGACY option was causing problems applying networking the second time per boot. However, BOOT_NEW_INSTANCE is also wrong as Azure needs to apply networking once per boot, during init-local phase.
TheRealFalcon
added a commit
that referenced
this pull request
Sep 17, 2021
In #1006, we set Azure to apply networking config every BOOT_NEW_INSTANCE because the BOOT_LEGACY option was causing problems applying networking the second time per boot. However, BOOT_NEW_INSTANCE is also wrong as Azure needs to apply networking once per boot, during init-local phase.
3 tasks
This was referenced May 12, 2023
Closed
Closed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed Commit Message
Additional Context
Note that the default update events are defined in the base class, so Azure doesn't need a separate definition here.
Found by Azure during SRU testing.
Test Steps
Run the updated integration test.
Additionally, manually verified with:
Examine
/var/log/cloud-init.logand verifyApplying network configurationappears exactly once, then later we see:Checklist: