mirror of
https://github.com/lxc/incus
synced 2026-08-02 05:26:46 +00:00
incusd/storage: Prevent creating daemon volumes on shared pools
Signed-off-by: Benjamin Somers <benjamin.somers@imt-atlantique.fr>
This commit is contained in:
parent
7a931464e7
commit
94d9118a8b
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/lxc/incus/v7/internal/rsync"
|
||||
@ -183,11 +184,16 @@ func daemonStorageValidate(s *state.State, storageType string, target string) er
|
||||
|
||||
err = s.DB.Cluster.Transaction(context.Background(), func(ctx context.Context, tx *db.ClusterTx) error {
|
||||
// Validate pool exists.
|
||||
poolID, _, _, err = tx.GetStoragePool(ctx, poolName)
|
||||
var pool *api.StoragePool
|
||||
poolID, pool, _, err = tx.GetStoragePool(ctx, poolName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to load storage pool %q: %w", poolName, err)
|
||||
}
|
||||
|
||||
if slices.Contains(db.StorageRemoteDriverNames(), pool.Driver) {
|
||||
return errors.New("Daemon storage volumes cannot be located on clustered storage pools")
|
||||
}
|
||||
|
||||
// Confirm volume exists.
|
||||
dbVol, err := tx.GetStoragePoolVolume(ctx, poolID, api.ProjectDefaultName, db.StoragePoolVolumeTypeCustom, volumeName, true)
|
||||
if err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user