MCPcopy
hub / github.com/lxc/incus / LoadNodeAll

Function LoadNodeAll

internal/server/instance/instance_utils.go:363–389  ·  view source on GitHub ↗

LoadNodeAll loads all instances on this server.

(s *state.State, instanceType instancetype.Type)

Source from the content-addressed store, hash-verified

361
362// LoadNodeAll loads all instances on this server.
363func LoadNodeAll(s *state.State, instanceType instancetype.Type) ([]Instance, error) {
364 var err error
365 var instances []Instance
366
367 filter := cluster.InstanceFilter{Type: instanceType.Filter()}
368 if s.ServerName != "" {
369 filter.Node = &s.ServerName
370 }
371
372 err = s.DB.Cluster.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {
373 return tx.InstanceList(ctx, func(dbInst db.InstanceArgs, p api.Project) error {
374 inst, err := Load(s, dbInst, p)
375 if err != nil {
376 return fmt.Errorf("Failed loading instance %q in project %q: %w", dbInst.Name, dbInst.Project, err)
377 }
378
379 instances = append(instances, inst)
380
381 return nil
382 }, filter)
383 })
384 if err != nil {
385 return nil, err
386 }
387
388 return instances, nil
389}
390
391// LoadFromBackup loads from a mounted instance's backup file.
392// If applyProfiles is false, then the profiles property will be cleared to prevent profile enrichment from DB.

Callers 15

UpdateDNSMasqStaticFunction · 0.92
balanceNUMANodesMethod · 0.92
findIdmapMethod · 0.92
instancesPutFunction · 0.92
initMethod · 0.92
StopMethod · 0.92
storageStartupFunction · 0.92
expireLogsFunction · 0.92
runMethod · 0.92

Calls 5

FilterMethod · 0.80
InstanceListMethod · 0.80
ErrorfMethod · 0.80
LoadFunction · 0.50
TransactionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…