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

Function dbStoragePoolCreateAndUpdateCache

cmd/incusd/storage_pools_utils.go:157–175  ·  view source on GitHub ↗

Helper around the low-level DB API, which also updates the driver names cache.

(ctx context.Context, s *state.State, poolName string, poolDescription string, poolDriver string, poolConfig map[string]string)

Source from the content-addressed store, hash-verified

155
156// Helper around the low-level DB API, which also updates the driver names cache.
157func dbStoragePoolCreateAndUpdateCache(ctx context.Context, s *state.State, poolName string, poolDescription string, poolDriver string, poolConfig map[string]string) (int64, error) {
158 var id int64
159
160 err := s.DB.Cluster.Transaction(ctx, func(ctx context.Context, tx *db.ClusterTx) error {
161 var err error
162
163 id, err = tx.CreateStoragePool(ctx, poolName, poolDescription, poolDriver, poolConfig)
164
165 return err
166 })
167 if err != nil {
168 return id, err
169 }
170
171 // Update the storage drivers cache in api_1.0.go.
172 storagePoolDriversCacheUpdate(ctx, s)
173
174 return id, nil
175}
176
177// Helper around the low-level DB API, which also updates the driver names
178// cache.

Callers 3

storagePoolDBCreateFunction · 0.85
internalRecoverScanFunction · 0.85
SetupTestMethod · 0.85

Calls 3

CreateStoragePoolMethod · 0.65
TransactionMethod · 0.45

Tested by 1

SetupTestMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…