cirruslabs / orchard

Orchestrator for running Tart Virtual Machines on a cluster of Apple Silicon devices
Other
192 stars 15 forks source link

Don't stop and delete VMs that failed to clone #125

Closed edigaryev closed 12 months ago

edigaryev commented 12 months ago

Resolves https://github.com/cirruslabs/orchard/issues/120.

fkorotkov commented 12 months ago

Should delete of non-existing VM return 0 from tart delete command? What do you think? Or return exit code 2 like tart run for an already running VM.

edigaryev commented 12 months ago

Or return exit code 2 like tart run for an already running VM.

Added in https://github.com/cirruslabs/tart/pull/597, but the thing is that we still need to avoid calling "tart stop" and "tart delete" to avoid errors in logs 🤷

ruimarinho commented 12 months ago

This is one of those cases where both approaches have merit.

If delete returns exit code 0:

Pros:

Cons:

If delete returns exit code 2:

Pros:

Cons:

Since orchard's objective is to maintain the state of VMs, maybe keeping the user always informed of the actual state sounds more reasonable.

edigaryev commented 12 months ago

@ruimarinho this is a pretty good analysis, but it's more applicable to the Tart itself rather than Orchard.

Since Orchard is supervising the Tart, it has a knowledge that some VM had never existed (in case we failed to clone it), so it's counterproductive to even try to delete that VM because this generates noise in the logs and makes users less likely to follow them.

P.S. "idempotency" issue can be easily alleviated by ignoring the exit code, e.g. in Shell scripts: tart delete <VM> || true.

ruimarinho commented 12 months ago

Indeed, my comment was more targeted at tart rather than orchard. Orchard should simply handle it gracefully, I agree.