Skip to content

Commit

Permalink
Merge pull request #657 from stgraber/main
Browse files Browse the repository at this point in the history
incus/admin/init: Use btrfs subvol in --auto
  • Loading branch information
hallyn authored Mar 25, 2024
2 parents d6280c2 + 2f22a36 commit 0116626
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions cmd/incus/admin_init_auto.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,28 @@ func (c *cmdAdminInit) RunAuto(cmd *cobra.Command, args []string, d incus.Instan
return nil, fmt.Errorf(i18n.G("Storage has already been configured"))
}

// Defaults
if c.flagStorageBackend == "" {
c.flagStorageBackend = "dir"
// Detect the backing filesystem.
backingFs, err := linux.DetectFilesystem(internalUtil.VarPath())
if err != nil {
backingFs = "dir"
}

// Get the possible local storage drivers.
storageDrivers := linux.AvailableStorageDrivers(internalUtil.VarPath(), server.Environment.StorageSupportedDrivers, internalUtil.PoolTypeLocal)

// Defaults
if c.flagNetworkPort == -1 {
c.flagNetworkPort = ports.HTTPSDefaultPort
}

if c.flagStorageBackend == "" && c.flagStoragePool == "" && backingFs == "btrfs" && slices.Contains(storageDrivers, "btrfs") {
// Use btrfs subvol if running on btrfs.
c.flagStoragePool = internalUtil.VarPath("storage-pools", "default")
c.flagStorageBackend = "btrfs"
} else if c.flagStorageBackend == "" {
c.flagStorageBackend = "dir"
}

// Fill in the node configuration
config := api.InitLocalPreseed{}
config.Config = map[string]string{}
Expand Down

0 comments on commit 0116626

Please sign in to comment.