Linode API trouble provisioning linodes manually
I'm following this guide on installing FreeBSD 12.0 on Linode. The process involves provisioning an empty instance, adding disks+configs and then booting into rescue to download the installer (and so on).
I was able to get it working (with 13.2-RELEASE) by running commands using the CLI but have been running into issues waiting for the instance to be ready after provisioning.
At first I polled for the "offline" instance status and that seemed to work okay.
Now I'm trying to retry any calls that fail with a certain error code but I'm getting an endless stream of Linode Busy
. It's definitely past how long I waited while doing this by hand.
What would you like to name your host?
testy
Creating g6-nanode-1 named testy.lb-zone.xyz
Waiting for testy to provision
provisioning...
Done provisioning
400: Linode busy.;
('400: Linode busy.; ',)
400: Linode busy.;
('400: Linode busy.; ',)
400: Linode busy.;
('400: Linode busy.; ',)
400: Linode busy.;
('400: Linode busy.; ',)
400: Linode busy.;
('400: Linode busy.; ',)
I'm aware that this is "unsupported" but I feel like someone has figured out how to wait for a Linode to be ready for further configuration after the instance is created.
Here's the relevant section of the source if anyone's interested -- I'm no Python expert so it's a little crude. I also don't love the polling but can't see many other options. Open to suggestions.
while True:
try:
self.instance.disk_create(root_mb, "root", "raw")
self.instance.disk_create(installer_mb, "installer", "raw")
self.instance.config_create(**self._boot_config)
self.instance.config_create(**self._installer_config)
break
except ApiError as apiErr:
print(str(apiErr))
print(apiErr.args)
if is_linode_busy_err(apiErr):
sleep(8)
continue
else:
raise apiErr
Side note -- is there a better way to match a specific error? The semicolon and the space at the end of that string arg seem very weird but I haven't peeked at the source.
1 Reply
✓ Best Answer
Not sure how I missed it but just found a duplicate -- my bad
Also it's a pretty obvious bug in my code but the detail that helped me was to also look at the status of the disks -- not just the instance.