|
| 1 | +--- |
| 2 | +title: LVM-LocalPV RAID |
| 3 | +authors: |
| 4 | + - "@nicholascioli" |
| 5 | +owners: [] |
| 6 | +creation-date: 2023-11-04 |
| 7 | +last-updated: 2023-11-04 |
| 8 | +status: Implemented |
| 9 | +--- |
| 10 | + |
| 11 | +# LVM-LocalPV RAID |
| 12 | + |
| 13 | +## Table of Contents |
| 14 | +- [LVM-LocalPV RAID](#lvm-localpv-raid) |
| 15 | + - [Table of Contents](#table-of-contents) |
| 16 | + - [Summary](#summary) |
| 17 | + - [Motivation](#motivation) |
| 18 | + - [Goals](#goals) |
| 19 | + - [Non Goals](#non-goals) |
| 20 | + - [Proposal](#proposal) |
| 21 | + - [User Stories](#user-stories) |
| 22 | + - [Implementation Details](#implementation-details) |
| 23 | + - [Usage details](#usage-details) |
| 24 | + - [Test Plan](#test-plan) |
| 25 | + - [Graduation Criteria](#graduation-criteria) |
| 26 | + - [Drawbacks](#drawbacks) |
| 27 | + - [Alternatives](#alternatives) |
| 28 | + |
| 29 | + |
| 30 | +## Summary |
| 31 | + |
| 32 | +This proposal charts out the workflow details to support creation of RAID volumes. |
| 33 | + |
| 34 | +## Motivation |
| 35 | + |
| 36 | +### Goals |
| 37 | + |
| 38 | +- Able to provision RAID volumes in a VolumeGroup. |
| 39 | +- Able to specify VolumeGroup-specific RAID options for all sub volumes. |
| 40 | +- Able to specify extra options for all volumes in a VolumeGroup. |
| 41 | + |
| 42 | +### Non Goals |
| 43 | + |
| 44 | +- Validating combinations of RAID types / options. |
| 45 | + |
| 46 | +## Proposal |
| 47 | + |
| 48 | +### User Stories |
| 49 | + |
| 50 | +- RAIDed volumes provide data redundancy and can mitigate data loss due to individual drive failures. |
| 51 | +- Ability to specify extra arguments for VolumeGroups allow for user customizations without needing |
| 52 | + to rework k8s schemas. |
| 53 | + |
| 54 | +### Implementation Details |
| 55 | + |
| 56 | +- User/Admin has to set RAID-sepcific options under storageclass parameters which |
| 57 | + are used when creating volumes in the VolumeGroup. |
| 58 | +- During volume provisioning time external-provisioner will read all key-value pairs |
| 59 | + that are specified under referenced storageclass and pass information to CSI |
| 60 | + driver as payload for `CreateVolume` gRPC request. |
| 61 | +- After receiving the `CreateVolume` request CSI driver will pick appropriate node based |
| 62 | + on scheduling attributes(like topology information, matching VG name and available capacity) |
| 63 | + and creates LVM volume resource by setting `Spec.RaidType` to a valid type along with other properties. |
| 64 | +- Once the LVMVolume resource is created corresponding node LVM volume controller reconcile |
| 65 | + LVM volume resource in the following way: |
| 66 | + - LVM controller will check `Spec.RaidType` field, if the field is set to anything other |
| 67 | + than `linear`, then the controller will perform following operations: |
| 68 | + - Fetch information about existence of matching VolumeGroup. |
| 69 | + - If there is a VolumeGroup with <vg_name> name then controller will create a volume. |
| 70 | + Command used to create thin volume: `lvcreate --type <RAID_TYPE> --raidintegrity <INTEGRITY> --nosync ... <LVCREATEOPTIONS> -y` |
| 71 | + - If volume creation is successfull then controller will LVM volume resource as `Ready`. |
| 72 | +- After watching `Ready` status CSI driver will return success response to `CreateVolume` gRPC |
| 73 | + request. |
| 74 | + |
| 75 | +### Usage details |
| 76 | + |
| 77 | +1. User/Admin can configure the following options under the storageclass parameters. |
| 78 | + |
| 79 | +Option | Required | Valid Values | Description |
| 80 | +-------|----------|--------------|------------------- |
| 81 | +`type` | `true` | `raid0` / `stripe`, `raid` / `raid1` / `mirror`, `raid5`, `raid6`, `raid10` | The RAID type of the volume. |
| 82 | +`integrity` | `false` | `true`, `false` | Whether or not to enable DM integrity for the volume. Defaults to `false`. |
| 83 | +`mirrors` | depends | [0, ∞) | Mirror count. Certain RAID configurations require this to be set. |
| 84 | +`nosync` | `false` | `true`, `false` | Whether or not to disable the initial sync. Defaults to false. |
| 85 | +`stripecount` | depends | [0, ∞) | Stripe count. Certain RAID configurations require this to be set. |
| 86 | +`stripesize` | `false` | [0, ∞) (but must be a power of 2) | The size of each stripe. If not specified, LVM will choose a sane default. |
| 87 | +`lvcreateoptions` | `false` | String, delimited by `;` | Extra options to be passed to LVM when creating volumes. |
| 88 | + |
| 89 | +An example is shown below |
| 90 | +```yaml |
| 91 | +apiVersion: storage.k8s.io/v1 |
| 92 | +kind: StorageClass |
| 93 | +metadata: |
| 94 | + name: openebs-lvm |
| 95 | +provisioner: local.csi.openebs.io |
| 96 | +parameters: |
| 97 | + storage: "lvm" |
| 98 | + volgroup: "lvmvg" |
| 99 | + raidType: "raid1" |
| 100 | + lvcreateoptions: "--vdo;--readahead auto" |
| 101 | +``` |
| 102 | +
|
| 103 | +### Test Plan |
| 104 | +- Provision an application on various RAID configurations, verify volume accessibility from application, |
| 105 | + and verify that `lvs` reports correct RAID information. |
| 106 | + |
| 107 | +## Graduation Criteria |
| 108 | + |
| 109 | +All testcases mentioned in [Test Plan](#test-plan) section need to be automated |
| 110 | + |
| 111 | +## Drawbacks |
| 112 | + |
| 113 | +- Since the RAID options exist at the storageclass level, changes to the storage |
| 114 | + class RAID options is not possible without custom logic per RAID type or manual |
| 115 | + operator interactions. |
| 116 | +- Validation of the RAID options depend on the version of LVM2 installed as well as |
| 117 | + the type of RAID used and its options. This is outside of the scope of these changes |
| 118 | + and will cause users to have to debug issues with a finer comb to see why certain |
| 119 | + options do not work together or on their specific machine. |
| 120 | + |
| 121 | +## Alternatives |
| 122 | + |
| 123 | +RAID can be done in either software or hardware, with many off-the-shelf products |
| 124 | +including built-in hardware solutions. There are also other software RAID alternatives |
| 125 | +that can be used below LVM, such as mdadm. |
| 126 | + |
| 127 | +This unfortunately requires operators to decouple |
| 128 | +the SotrageClass from the RAID configuration, but does simplify the amount of code maintained by |
| 129 | +this project. |
0 commit comments