Skip to content

Commit

Permalink
linstor: set user and group for mkfs
Browse files Browse the repository at this point in the history
LINSTOR has specific properties for the root directory owner (user and
group) when creating a file system.

So, instead of passing the mkfs flags manually, use these properties.
This should now also work with XFS file systems.
  • Loading branch information
chrboe committed Jun 28, 2024
1 parent df2ee5e commit 01161bf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/linstorcontrol/linstorcontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"sort"
"strconv"

"github.com/icza/gog"

Expand Down Expand Up @@ -217,8 +218,9 @@ func (l *Linstor) EnsureResource(ctx context.Context, res Resource, mayExist boo

volProps := map[string]string{}
if vol.FileSystem != "" {
volProps[apiconsts.NamespcFilesystem+"/Type"] = vol.FileSystem
volProps[apiconsts.NamespcFilesystem+"/MkfsParams"] = "-E nodiscard -E root_owner=" + vol.FileSystemRootOwner.String()
volProps[apiconsts.NamespcFilesystem+"/"+apiconsts.KeyFsType] = vol.FileSystem
volProps[apiconsts.NamespcFilesystem+"/"+apiconsts.KeyFsUser] = strconv.Itoa(vol.FileSystemRootOwner.Uid)
volProps[apiconsts.NamespcFilesystem+"/"+apiconsts.KeyFsGroup] = strconv.Itoa(vol.FileSystemRootOwner.Gid)
}
var volFlags []string
if res.GrossSize {
Expand Down

0 comments on commit 01161bf

Please sign in to comment.