kvm2: apply the milestone review
Shorter start wait with immediate verdicts for dead or paused domains, ListByTag without state or address RPCs, Timeout for an expired check round, no adoption of unmarked domains, reference-counted keyed locks, dead options removed, HEAD fallback on any non-2xx. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -10,10 +10,13 @@ import (
|
||||
)
|
||||
|
||||
// ListByTag is spec entry 12: every domain on every configured host, in
|
||||
// config order, filtered client-side on the kvm2 mark. A host that cannot
|
||||
// be reached or listed fails the whole call (fail-whole); a single domain
|
||||
// that cannot be read is skipped, unless ctx ended, which fails the call
|
||||
// rather than pass off an empty view as the truth.
|
||||
// config order, filtered client-side on the kvm2 mark. GC uses only ID, UID
|
||||
// and CreatedAt (contract §2.4), all of which the name and the metadata
|
||||
// element give, so no state or address RPC is made and State and IP stay
|
||||
// empty. A host that cannot be reached or listed fails the whole call
|
||||
// (fail-whole); a single domain whose metadata cannot be read is skipped,
|
||||
// unless ctx ended, which fails the call rather than pass off an empty view
|
||||
// as the truth.
|
||||
func (p *Provider) ListByTag(ctx context.Context) ([]provider.Instance, error) {
|
||||
log := p.logger(ctx)
|
||||
var out []provider.Instance
|
||||
@@ -43,15 +46,8 @@ func (p *Provider) ListByTag(ctx context.Context) ([]provider.Instance, error) {
|
||||
if !meta.managed() {
|
||||
continue
|
||||
}
|
||||
inst, err := inspect(ctx, dlog, be, host.Name, dom, meta)
|
||||
if err != nil {
|
||||
if ctx.Err() != nil {
|
||||
return nil, p.wrapErr("list", "", err)
|
||||
}
|
||||
dlog.V(1).Info("skipping domain that could not be inspected", "error", err.Error())
|
||||
continue
|
||||
}
|
||||
dlog.V(2).Info("kvm2 listed instance", "id", inst.ID, "state", inst.State, "uid", inst.UID, "createdAt", inst.CreatedAt)
|
||||
inst := provider.Instance{ID: formatProviderID(host.Name, dom.Name), UID: meta.UID, CreatedAt: meta.createdAt()}
|
||||
dlog.V(2).Info("kvm2 listed instance", "id", inst.ID, "uid", inst.UID, "createdAt", inst.CreatedAt)
|
||||
out = append(out, inst)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user