Skip to content

Commit

Permalink
feat: ext4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-roche committed May 24, 2023
1 parent e6814c5 commit ea1866e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
11 changes: 11 additions & 0 deletions api/v1alpha1/lvmcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ type ThinPoolConfig struct {
OverprovisionRatio int `json:"overprovisionRatio"`
}

type DeviceFilesystemType string

const (
FilesystemTypeExt4 DeviceFilesystemType = "ext4"
FilesystemTypeXFS DeviceFilesystemType = "xfs"
)

type DeviceClass struct {
// Name of the class, the VG and possibly the storageclass.
// Validations to confirm that this field can be used as metadata.name field in storageclass
Expand Down Expand Up @@ -88,6 +95,10 @@ type DeviceClass struct {
// Default is a flag to indicate whether the device-class is the default
// +optional
Default bool `json:"default,omitempty"`

// FilesystemType sets the filesystem the device should use
// +optional
FilesystemType DeviceFilesystemType `json:"fstype,omitempty"`
}

// DeviceSelector specifies the list of criteria that have to match before a device is assigned
Expand Down
4 changes: 4 additions & 0 deletions bundle/manifests/lvm.topolvm.io_lvmclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ spec:
type: string
type: array
type: object
fstype:
description: FilesystemType sets the filesystem the device
should use
type: string
name:
description: 'Name of the class, the VG and possibly the
storageclass. Validations to confirm that this field can
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/lvm.topolvm.io_lvmclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ spec:
type: string
type: array
type: object
fstype:
description: FilesystemType sets the filesystem the device
should use
type: string
name:
description: 'Name of the class, the VG and possibly the
storageclass. Validations to confirm that this field can
Expand Down
1 change: 1 addition & 0 deletions config/samples/lvm_v1alpha1_lvmcluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ spec:
name: thin-pool-1
sizePercent: 90
overprovisionRatio: 10
fstype: xfs
3 changes: 0 additions & 3 deletions controllers/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ const (
DefaultLVMdSocket = "/run/lvmd/lvmd.sock"
DeviceClassKey = "topolvm.io/device-class"

// default fstype for topolvm storage classes
TopolvmFilesystemType = "xfs"

// name of the lvm-operator container
LVMOperatorContainerName = "manager"

Expand Down
3 changes: 2 additions & 1 deletion controllers/topolvm_storageclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func getTopolvmStorageClasses(r *LVMClusterReconciler, ctx context.Context, lvmC
sc := []*storagev1.StorageClass{}
for _, deviceClass := range lvmCluster.Spec.Storage.DeviceClasses {
scName := getStorageClassName(deviceClass.Name)

storageClass := &storagev1.StorageClass{
ObjectMeta: metav1.ObjectMeta{
Name: scName,
Expand All @@ -135,7 +136,7 @@ func getTopolvmStorageClasses(r *LVMClusterReconciler, ctx context.Context, lvmC
AllowVolumeExpansion: &allowVolumeExpansion,
Parameters: map[string]string{
DeviceClassKey: deviceClass.Name,
"csi.storage.k8s.io/fstype": TopolvmFilesystemType,
"csi.storage.k8s.io/fstype": string(deviceClass.FilesystemType),
},
}
// reconcile will pick up any existing LVMO storage classes as well
Expand Down

0 comments on commit ea1866e

Please sign in to comment.