mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-01-18 10:49:30 +00:00
Merge pull request #53 from ceph/devel
Sync rhs/ceph-csi:devel with ceph/ceph-csi:devel
This commit is contained in:
commit
9ca8a7c4b5
@ -284,10 +284,11 @@ storageClass:
|
|||||||
thickProvision: false
|
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 `layering`, `journaling`, `exclusive-lock`
|
# CSI RBD currently supports `layering`, `journaling`, `exclusive-lock`,
|
||||||
# features. If `journaling` is enabled, must enable `exclusive-lock` too.
|
# `object-map`, `fast-diff` features. If `journaling` is enabled, must
|
||||||
# imageFeatures: layering,journaling,exclusive-lock
|
# enable `exclusive-lock` too.
|
||||||
imageFeatures: layering
|
# imageFeatures: layering,journaling,exclusive-lock,object-map,fast-diff
|
||||||
|
imageFeatures: "layering"
|
||||||
|
|
||||||
# (optional) Specifies whether to try other mounters in case if the current
|
# (optional) Specifies whether to try other mounters in case if the current
|
||||||
# mounter fails to mount the rbd image for any reason. True means fallback
|
# mounter fails to mount the rbd image for any reason. True means fallback
|
||||||
|
@ -55,7 +55,7 @@ make image-cephcsi
|
|||||||
| `dataPool` | no | Ceph pool used for the data of the RBD images. |
|
| `dataPool` | no | Ceph pool used for the data of the RBD images. |
|
||||||
| `volumeNamePrefix` | no | Prefix to use for naming RBD images (defaults to `csi-vol-`). |
|
| `volumeNamePrefix` | no | Prefix to use for naming RBD images (defaults to `csi-vol-`). |
|
||||||
| `snapshotNamePrefix` | no | Prefix to use for naming RBD snapshot images (defaults to `csi-snap-`). |
|
| `snapshotNamePrefix` | no | Prefix to use for naming RBD snapshot images (defaults to `csi-snap-`). |
|
||||||
| `imageFeatures` | yes | RBD image features. CSI RBD currently supports `layering`, `journaling`, `exclusive-lock` features. If `journaling` is enabled, must enable `exclusive-lock` too. See [man pages](http://docs.ceph.com/docs/master/man/8/rbd/#cmdoption-rbd-image-feature) Note that the required support for [object-map and fast-diff were added in 5.3 and journaling does not have KRBD support yet](https://docs.ceph.com/en/latest/rbd/rbd-config-ref/#image-features). deep-flatten is added for cloned images. |
|
| `imageFeatures` | yes | RBD image features. CSI RBD currently supports `layering`, `journaling`, `exclusive-lock`, `object-map`, `fast-diff` features. If `journaling` is enabled, must enable `exclusive-lock` too. See [man pages](http://docs.ceph.com/docs/master/man/8/rbd/#cmdoption-rbd-image-feature) Note that the required support for [object-map and fast-diff were added in 5.3 and journaling does not have KRBD support yet](https://docs.ceph.com/en/latest/rbd/rbd-config-ref/#image-features). deep-flatten is added for cloned images. |
|
||||||
| `tryOtherMounters` | no | Specifies whether to try other mounters in case if the current mounter fails to mount the rbd image for any reason |
|
| `tryOtherMounters` | no | Specifies whether to try other mounters in case if the current mounter fails to mount the rbd image for any reason |
|
||||||
| `mapOptions` | no | Map options to use when mapping rbd image. See [krbd](https://docs.ceph.com/docs/master/man/8/rbd/#kernel-rbd-krbd-options) and [nbd](https://docs.ceph.com/docs/master/man/8/rbd-nbd/#options) options. |
|
| `mapOptions` | no | Map options to use when mapping rbd image. See [krbd](https://docs.ceph.com/docs/master/man/8/rbd/#kernel-rbd-krbd-options) and [nbd](https://docs.ceph.com/docs/master/man/8/rbd-nbd/#options) options. |
|
||||||
| `unmapOptions` | no | Unmap options to use when unmapping rbd image. See [krbd](https://docs.ceph.com/docs/master/man/8/rbd/#kernel-rbd-krbd-options) and [nbd](https://docs.ceph.com/docs/master/man/8/rbd-nbd/#options) options. |
|
| `unmapOptions` | no | Unmap options to use when unmapping rbd image. See [krbd](https://docs.ceph.com/docs/master/man/8/rbd/#kernel-rbd-krbd-options) and [nbd](https://docs.ceph.com/docs/master/man/8/rbd-nbd/#options) options. |
|
||||||
|
@ -315,9 +315,7 @@ var _ = Describe("cephfs", func() {
|
|||||||
}
|
}
|
||||||
By("verify generic ephemeral volume support", func() {
|
By("verify generic ephemeral volume support", func() {
|
||||||
// generic ephemeral volume support is beta since v1.21.
|
// generic ephemeral volume support is beta since v1.21.
|
||||||
if !k8sVersionGreaterEquals(f.ClientSet, 1, 21) {
|
if k8sVersionGreaterEquals(f.ClientSet, 1, 21) {
|
||||||
Skip("generic ephemeral volume only supported from v1.21+")
|
|
||||||
}
|
|
||||||
err := createCephfsStorageClass(f.ClientSet, f, true, nil)
|
err := createCephfsStorageClass(f.ClientSet, f, true, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e2elog.Failf("failed to create CephFS storageclass: %v", err)
|
e2elog.Failf("failed to create CephFS storageclass: %v", err)
|
||||||
@ -343,6 +341,7 @@ var _ = Describe("cephfs", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
e2elog.Failf("failed to delete CephFS storageclass: %v", err)
|
e2elog.Failf("failed to delete CephFS storageclass: %v", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
By("check static PVC", func() {
|
By("check static PVC", func() {
|
||||||
|
@ -373,9 +373,7 @@ var _ = Describe("RBD", func() {
|
|||||||
}
|
}
|
||||||
By("verify generic ephemeral volume support", func() {
|
By("verify generic ephemeral volume support", func() {
|
||||||
// generic ephemeral volume support is supported from 1.21
|
// generic ephemeral volume support is supported from 1.21
|
||||||
if !k8sVersionGreaterEquals(f.ClientSet, 1, 21) {
|
if k8sVersionGreaterEquals(f.ClientSet, 1, 21) {
|
||||||
Skip("generic ephemeral volume only supported from v1.21+")
|
|
||||||
}
|
|
||||||
// create application
|
// create application
|
||||||
app, err := loadApp(appEphemeralPath)
|
app, err := loadApp(appEphemeralPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -399,6 +397,7 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
e2elog.Failf("failed to validate rbd images in pool %s trash: %v", defaultRBDPool, err)
|
e2elog.Failf("failed to validate rbd images in pool %s trash: %v", defaultRBDPool, err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// todo: may be remove the below deletion test later once the migration nodestage tests are adjusted
|
// todo: may be remove the below deletion test later once the migration nodestage tests are adjusted
|
||||||
|
@ -34,10 +34,11 @@ parameters:
|
|||||||
# thickProvision: "false"
|
# 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 `layering`, `journaling`, `exclusive-lock`
|
# CSI RBD currently supports `layering`, `journaling`, `exclusive-lock`,
|
||||||
# features. If `journaling` is enabled, must enable `exclusive-lock` too.
|
# `object-map`, `fast-diff` features. If `journaling` is enabled, must
|
||||||
# imageFeatures: layering,journaling,exclusive-lock
|
# enable `exclusive-lock` too.
|
||||||
imageFeatures: layering
|
# imageFeatures: layering,journaling,exclusive-lock,object-map,fast-diff
|
||||||
|
imageFeatures: "layering"
|
||||||
|
|
||||||
# (optional) Specifies whether to try other mounters in case if the current
|
# (optional) Specifies whether to try other mounters in case if the current
|
||||||
# mounter fails to mount the rbd image for any reason. True means fallback
|
# mounter fails to mount the rbd image for any reason. True means fallback
|
||||||
|
@ -206,7 +206,15 @@ var (
|
|||||||
needRbdNbd: false,
|
needRbdNbd: false,
|
||||||
},
|
},
|
||||||
librbd.FeatureNameExclusiveLock: {
|
librbd.FeatureNameExclusiveLock: {
|
||||||
needRbdNbd: true,
|
needRbdNbd: false,
|
||||||
|
},
|
||||||
|
librbd.FeatureNameObjectMap: {
|
||||||
|
needRbdNbd: false,
|
||||||
|
dependsOn: []string{librbd.FeatureNameExclusiveLock},
|
||||||
|
},
|
||||||
|
librbd.FeatureNameFastDiff: {
|
||||||
|
needRbdNbd: false,
|
||||||
|
dependsOn: []string{librbd.FeatureNameObjectMap},
|
||||||
},
|
},
|
||||||
librbd.FeatureNameJournaling: {
|
librbd.FeatureNameJournaling: {
|
||||||
needRbdNbd: true,
|
needRbdNbd: true,
|
||||||
|
@ -88,21 +88,37 @@ func TestValidateImageFeatures(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"layering,exclusive-lock,object-map,fast-diff",
|
||||||
|
&rbdVolume{
|
||||||
|
Mounter: rbdDefaultMounter,
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
"",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"layering,journaling",
|
"layering,journaling",
|
||||||
&rbdVolume{
|
&rbdVolume{
|
||||||
Mounter: rbdNbdMounter,
|
Mounter: rbdDefaultMounter,
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
"feature journaling requires exclusive-lock to be set",
|
"feature journaling requires exclusive-lock to be set",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"layering,exclusive-lock,journaling",
|
"object-map,fast-diff",
|
||||||
&rbdVolume{
|
&rbdVolume{
|
||||||
Mounter: rbdDefaultMounter,
|
Mounter: rbdDefaultMounter,
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
"feature exclusive-lock requires rbd-nbd for mounter",
|
"feature object-map requires exclusive-lock to be set",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fast-diff",
|
||||||
|
&rbdVolume{
|
||||||
|
Mounter: rbdDefaultMounter,
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
"feature fast-diff requires object-map to be set",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"layering,exclusive-lock,journaling",
|
"layering,exclusive-lock,journaling",
|
||||||
@ -110,7 +126,15 @@ func TestValidateImageFeatures(t *testing.T) {
|
|||||||
Mounter: rbdDefaultMounter,
|
Mounter: rbdDefaultMounter,
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
"feature exclusive-lock requires rbd-nbd for mounter",
|
"feature journaling requires rbd-nbd for mounter",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"layering,exclusive-lock,journaling",
|
||||||
|
&rbdVolume{
|
||||||
|
Mounter: rbdDefaultMounter,
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
"feature journaling requires rbd-nbd for mounter",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"layering,exclusive-loc,journaling",
|
"layering,exclusive-loc,journaling",
|
||||||
|
@ -300,23 +300,58 @@ func getOperationName(poolName string, optName operation) string {
|
|||||||
// createDummyImage creates a dummy image as a workaround for the rbd
|
// createDummyImage creates a dummy image as a workaround for the rbd
|
||||||
// scheduling problem.
|
// scheduling problem.
|
||||||
func createDummyImage(ctx context.Context, rbdVol *rbdVolume) error {
|
func createDummyImage(ctx context.Context, rbdVol *rbdVolume) error {
|
||||||
|
var err error
|
||||||
|
var imgName string
|
||||||
|
|
||||||
|
dummyImageOpsLock.Lock()
|
||||||
|
defer dummyImageOpsLock.Unlock()
|
||||||
optName := getOperationName(rbdVol.Pool, dummyImageCreated)
|
optName := getOperationName(rbdVol.Pool, dummyImageCreated)
|
||||||
if _, ok := operationLock.Load(optName); !ok {
|
if _, ok := operationLock.Load(optName); !ok {
|
||||||
// create a dummy image
|
// create a dummy image
|
||||||
imgName, err := getDummyImageName(rbdVol.conn)
|
imgName, err = getDummyImageName(rbdVol.conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
dummyVol := *rbdVol
|
dummyVol := *rbdVol
|
||||||
dummyVol.RbdImageName = imgName
|
dummyVol.RbdImageName = imgName
|
||||||
err = createImage(ctx, &dummyVol, dummyVol.conn.Creds)
|
f := []string{
|
||||||
if err != nil && !strings.Contains(err.Error(), "File exists") {
|
librbd.FeatureNameLayering,
|
||||||
return err
|
librbd.FeatureNameObjectMap,
|
||||||
|
librbd.FeatureNameExclusiveLock,
|
||||||
|
librbd.FeatureNameFastDiff,
|
||||||
}
|
}
|
||||||
|
features := librbd.FeatureSetFromNames(f)
|
||||||
|
dummyVol.imageFeatureSet = features
|
||||||
|
// create 1MiB dummy image. 1MiB=1048576 bytes
|
||||||
|
dummyVol.VolSize = 1048576
|
||||||
|
err = createImage(ctx, &dummyVol, dummyVol.conn.Creds)
|
||||||
|
if err != nil {
|
||||||
|
if strings.Contains(err.Error(), "File exists") {
|
||||||
|
err = repairDummyImage(ctx, &dummyVol)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
operationLock.Store(optName, true)
|
operationLock.Store(optName, true)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// repairDummyImage deletes and recreates the dummy image.
|
||||||
|
func repairDummyImage(ctx context.Context, dummyVol *rbdVolume) error {
|
||||||
|
// instead of checking the images features and than adding missing image
|
||||||
|
// features, updating the image size to 1Mib. We will delete the image
|
||||||
|
// and recreate it.
|
||||||
|
|
||||||
|
// deleting and recreating the dummy image will not impact anything as its
|
||||||
|
// a workaround to fix the scheduling problem.
|
||||||
|
err := deleteImage(ctx, dummyVol, dummyVol.conn.Creds)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return createImage(ctx, dummyVol, dummyVol.conn.Creds)
|
||||||
}
|
}
|
||||||
|
|
||||||
// tickleMirroringOnDummyImage disables and reenables mirroring on the dummy image, and sets a
|
// tickleMirroringOnDummyImage disables and reenables mirroring on the dummy image, and sets a
|
||||||
|
Loading…
Reference in New Issue
Block a user