mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 22:30:23 +00:00
rbd: add support for thick provisioning option
Add an option to the StorageClass to support creating fully allocated (thick provisioned) RBD images Signed-off-by: Madhu Rajanna <madhupr007@gmail.com> Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
354f395aa1
commit
c417a5d0ba
@ -63,6 +63,7 @@ make image-cephcsi
|
|||||||
| `mounter` | no | if set to `rbd-nbd`, use `rbd-nbd` on nodes that have `rbd-nbd` and `nbd` kernel modules to map rbd images |
|
| `mounter` | no | if set to `rbd-nbd`, use `rbd-nbd` on nodes that have `rbd-nbd` and `nbd` kernel modules to map rbd images |
|
||||||
| `encrypted` | no | disabled by default, use `"true"` to enable LUKS encryption on PVC and `"false"` to disable it. **Do not change for existing storageclasses** |
|
| `encrypted` | no | disabled by default, use `"true"` to enable LUKS encryption on PVC and `"false"` to disable it. **Do not change for existing storageclasses** |
|
||||||
| `encryptionKMSID` | no | required if encryption is enabled and a kms is used to store passphrases |
|
| `encryptionKMSID` | no | required if encryption is enabled and a kms is used to store passphrases |
|
||||||
|
| `thickProvision` | no | if set to `"true"`, newly created RBD images will be completely allocated by writing zeros to it |
|
||||||
|
|
||||||
**NOTE:** An accompanying CSI configuration file, needs to be provided to the
|
**NOTE:** An accompanying CSI configuration file, needs to be provided to the
|
||||||
running pods. Refer to [Creating CSI configuration](../examples/README.md#creating-csi-configuration)
|
running pods. Refer to [Creating CSI configuration](../examples/README.md#creating-csi-configuration)
|
||||||
|
@ -29,6 +29,9 @@ parameters:
|
|||||||
# eg: pool: rbdpool
|
# eg: pool: rbdpool
|
||||||
pool: <rbd-pool-name>
|
pool: <rbd-pool-name>
|
||||||
|
|
||||||
|
# Set thickProvision to true if you want RBD images to be fully allocated on
|
||||||
|
# creation (thin provisioning is the default).
|
||||||
|
thickProvision: "false"
|
||||||
# (required) RBD image features, CSI creates image with image-format 2
|
# (required) RBD image features, CSI creates image with image-format 2
|
||||||
# CSI RBD currently supports only `layering` feature.
|
# CSI RBD currently supports only `layering` feature.
|
||||||
imageFeatures: layering
|
imageFeatures: layering
|
||||||
|
@ -19,6 +19,8 @@ package rbd
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
csicommon "github.com/ceph/ceph-csi/internal/csi-common"
|
csicommon "github.com/ceph/ceph-csi/internal/csi-common"
|
||||||
"github.com/ceph/ceph-csi/internal/journal"
|
"github.com/ceph/ceph-csi/internal/journal"
|
||||||
@ -116,6 +118,14 @@ func (cs *ControllerServer) parseVolCreateRequest(ctx context.Context, req *csi.
|
|||||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tp := "thickProvision"
|
||||||
|
thick := req.GetParameters()[tp]
|
||||||
|
if thick != "" {
|
||||||
|
if rbdVol.ThickProvision, err = strconv.ParseBool(thick); err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to parse %q: %w", tp, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rbdVol.RequestName = req.GetName()
|
rbdVol.RequestName = req.GetName()
|
||||||
|
|
||||||
// Volume Size - Default is 1 GiB
|
// Volume Size - Default is 1 GiB
|
||||||
|
@ -98,6 +98,7 @@ type rbdVolume struct {
|
|||||||
Encrypted bool
|
Encrypted bool
|
||||||
readOnly bool
|
readOnly bool
|
||||||
Primary bool
|
Primary bool
|
||||||
|
ThickProvision bool
|
||||||
KMS util.EncryptionKMS
|
KMS util.EncryptionKMS
|
||||||
// Owner is the creator (tenant, Kubernetes Namespace) of the volume.
|
// Owner is the creator (tenant, Kubernetes Namespace) of the volume.
|
||||||
Owner string
|
Owner string
|
||||||
|
Loading…
Reference in New Issue
Block a user