Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPVE-300: OCPVE-301: feat: ext4 support #344

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions bundle/manifests/lvms-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ metadata:
"deviceClasses": [
{
"default": true,
"fstype": "xfs",
"name": "vg1",
"thinPoolConfig": {
"name": "thin-pool-1",
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
13 changes: 13 additions & 0 deletions ext4steps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeff-roche could you please remove this file?

- push
- deploy
- `oc project openshift-storage`
- create the cluster which specifies ext4 (config/samples/lvm_v1alpha1_lvmcluster.yaml)
- `oc get pods -w` until all are ready
- `oc get lvmclusters.lvm.topolvm.io my-lvmcluster -w` until ready
- `oc describe storageclass/lvms-vg1` to validate the Parameter "csi.storage.k8s.io/fstype=ext4"
- Create the pvc and pod (README)
- `oc debug pod/{pod name}`
- `chroot /host`
- `lvdisplay` to get the lv path
- `file -L -s {lv_path}` should have xfs or ext4 in the output