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)
| 155 | |
| 156 | // Helper around the low-level DB API, which also updates the driver names cache. |
| 157 | func 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. |
searching dependent graphs…