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

[RFE] azure-init should not attempt to provision the VM on reboot #120

Closed
anhvoms opened this issue Aug 28, 2024 · 2 comments · Fixed by #164
Closed

[RFE] azure-init should not attempt to provision the VM on reboot #120

anhvoms opened this issue Aug 28, 2024 · 2 comments · Fixed by #164
Assignees
Labels
feature New feature or request

Comments

@anhvoms
Copy link
Contributor

anhvoms commented Aug 28, 2024

azure-init pulls data from IMDS to configure the VM and reports health on every boot. This has some implications:

  1. Unnecessary communication with wireserver (goalstate and health). If there is an issue with wireserver communication, this might unnecessarily delay boot if there are components that run after azure-init. azure-init. The extra health reporting is currently harmless, but should be avoided if possible.
  2. If the user makes a change to the hostname, azure-init will update the hostname back to the value found in IMDS. This is often undesirable (however, the other side of this argument is that the customer can update the hostname in the VM, and they would like to see the VM hostname updated upon reboot). This should be addressed with a configurable option (cloud-init has has a similar option)

**Implementation options

The easiest option is to write a file (/var/lib/azure-init/cache, e.g.,) with the existing vm id. vm id is available in IMDS, it's also available by reading the uuid provided by dmidecode -- see here. Using the id from dmidecode is preferred because it avoids unnecessary communication (IMDS), it also will work in the event that IMDS is down.

Upon reboot, azure-init checks if the vm id has changed (which means that this is a new VM), and if yes, it should proceed with provision the VM.

@anhvoms anhvoms added the feature New feature or request label Aug 28, 2024
@jepio
Copy link
Member

jepio commented Dec 19, 2024

Systemd has a notion of "firstboot" services (which relies on /etc/machine-id). Would this work for azure-init? From https://www.man7.org/linux/man-pages/man5/systemd.unit.5.html:

ConditionFirstBoot=
           Takes a boolean argument. This condition may be used to
           conditionalize units on whether the system is booting up for
           the first time. This roughly means that /etc/ was unpopulated
           when the system started booting (for details, see "First Boot
           Semantics" in [machine-id(5)](https://www.man7.org/linux/man-pages/man5/machine-id.5.html)). First Boot is considered
           finished (this condition will evaluate as false) after the
           manager has finished the startup phase.

@anhvoms
Copy link
Contributor Author

anhvoms commented Dec 19, 2024

@jepio it probably work for the majority of the case, but it wouldn't cover issue where the VM gets reboot during provisioning by platform due to service healing. In that case provisioning hasn't been done, but I believe systemd will declare that the machine has gone through first boot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants