1

I pass a custom startup script when I instantiate a VM. This startup script can take a while to finish and I want to be able to block (or at least poll) on the host and wait for the VM to get to the end of the startup script before proceeding to next steps.

The official documents recommends using guest attributes for this exact purpose but as far as I can see you can only instantiate them from inside VM. This is fine but ideally I'd like to be able to read a ready=FALSE value from the beginning and then see it changing to TRUE instead of starting with "ready doesnt't exist" error.

Is it possible to provide an initial value for guest attributes when starting a VM?

For normal metadata there's a ?wait_for_change=true that allows a VM to block and react to changes made to the VM from the outside but I'm looking for the opposite.

Milad
  • 4,901
  • 5
  • 32
  • 43

1 Answers1

0

We use cloud-init in the startup-script to configure some instances. Cloud-init modules run at multiple stages of the boot process, some very early such as bootcmd.

Perhaps you could put a curl command in the bootcmd module to set the desired guest attributes in the metadata?

Martijn Heemels
  • 3,529
  • 5
  • 37
  • 38