Initial Cloud Status

Headline:
After creating a new cloud, the initial status is set to “ok”.


Description:
After creating a cloud via the API (or GUI), the initial status is set to “ok” and then eventually “syncing” and then back to “ok”. The issue is when doing this programmatically via the API, determining when the sync has truly been completed. The workaround has been to put a sleep timer of some seconds prior, then check if the cloud is in a “syncing” state and then keep checking for it to return to “ok”. However, it has been noticed in some cases the initial sync can take up to two minutes to start and it remains in “ok”, so the sleep timer method may be inaccurate or needs to be adjusted to be much greater.

When a cloud is created, if it could be placed into the status of either “syncing” or “queued”, just not “ok”, this would allow the checking of the status immediately and wait for an “ok” status to know it has completed.

The workaround in code is to wait for the zone.lastUpdated field to change to something other than NULL. If it is ever NULL, then it is before the first sync.

Thanks for the idea! Unfortunately, the lastUpdated is set at the same time as created. Here is a snippet for doing a GET on the API just after submitting a cloud:

{
    "id": 27,
    "uuid": "5de30e53-d554-4e14-961f-f605630ca2e4",
    "name": "AWS-US-EAST-2",
    "code": "amazon",
    ...
    "status": "ok",
    ...
    "dateCreated": "2022-04-28T13:41:44Z",
    "lastUpdated": "2022-04-28T13:41:45Z",
    ...
    "stats": {
                "serverCounts": {
                    "all": 0,
                    "host": 0,
                    "hypervisor": 0,
                    "containerHost": 0,
                    "vm": 0,
                    "baremetal": 0,
                    "unmanaged": 0
                }
            },
    ...
}

No items were sync’d yet but should have been at least 3 VMs but the status was “ok”.

is the lastSync field available? that would be null until the first sync works.

@brian it is not.

At that point, I’d say to save lastUpdated, possibly trigger a sync and then wait for lastUpdated to change.

That being said, a new status of initializing or something like that would be a welcome change.