mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
remove support for create image with image-format 1
tried to create an image with image-format=1 ``` sh-4.2# rbd create --size=1024 replicapool/test --image-format=1 rbd: image format 1 is deprecated rbd: create error: (22) Invalid argument 2019-09-11 07:00:54.531 7fb0e40bfb00 -1 librbd: Format 1 image creation unsupported. ``` Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
e395080cdc
commit
6da96c6327
@ -51,8 +51,7 @@ make image-cephcsi
|
||||
| `clusterID` | yes | String representing a Ceph cluster, must be unique across all Ceph clusters in use for provisioning, cannot be greater than 36 bytes in length, and should remain immutable for the lifetime of the Ceph cluster in use |
|
||||
| `pool` | yes | Ceph pool into which the RBD image shall be created |
|
||||
| `dataPool` | no | Ceph pool used for the data of the RBD images. |
|
||||
| `imageFormat` | no | RBD image format. Defaults to `2`. See [man pages](http://docs.ceph.com/docs/mimic/man/8/rbd/#cmdoption-rbd-image-format) |
|
||||
| `imageFeatures` | no | RBD image features. Available for `imageFormat=2`. CSI RBD currently supports only `layering` feature. See [man pages](http://docs.ceph.com/docs/mimic/man/8/rbd/#cmdoption-rbd-image-feature) |
|
||||
| `imageFeatures` | no | RBD image features. CSI RBD currently supports only `layering` feature. See [man pages](http://docs.ceph.com/docs/mimic/man/8/rbd/#cmdoption-rbd-image-feature) |
|
||||
| `csi.storage.k8s.io/provisioner-secret-name`, `csi.storage.k8s.io/node-stage-secret-name` | yes (for Kubernetes) | name of the Kubernetes Secret object containing Ceph client credentials. Both parameters should have the same value |
|
||||
| `csi.storage.k8s.io/provisioner-secret-namespace`, `csi.storage.k8s.io/node-stage-secret-namespace` | yes (for Kubernetes) | namespaces of the above Secret objects |
|
||||
| `mounter` | no | if set to `rbd-nbd`, use `rbd-nbd` on nodes that have `rbd-nbd` and `nbd` kernel modules to map rbd images |
|
||||
|
@ -21,10 +21,7 @@ parameters:
|
||||
# dataPool: ec-data-pool
|
||||
pool: rbd
|
||||
|
||||
# RBD image format. Defaults to "2".
|
||||
imageFormat: "2"
|
||||
|
||||
# RBD image features. Available for imageFormat: "2"
|
||||
# RBD image features, CSI creates image with image-format 2
|
||||
# CSI RBD currently supports only `layering` feature.
|
||||
imageFeatures: layering
|
||||
|
||||
|
@ -122,25 +122,15 @@ func createImage(ctx context.Context, pOpts *rbdVolume, volSz int64, cr *util.Cr
|
||||
image := pOpts.RbdImageName
|
||||
volSzMiB := fmt.Sprintf("%dM", volSz)
|
||||
|
||||
if pOpts.ImageFormat == rbdImageFormat2 {
|
||||
logMsg := "rbd: create %s size %s format %s (features: %s) using mon %s, pool %s "
|
||||
if pOpts.DataPool != "" {
|
||||
logMsg += fmt.Sprintf("data pool %s", pOpts.DataPool)
|
||||
}
|
||||
klog.V(4).Infof(util.Log(ctx, logMsg),
|
||||
image, volSzMiB, pOpts.ImageFormat, pOpts.ImageFeatures, pOpts.Monitors, pOpts.Pool)
|
||||
} else {
|
||||
logMsg := "rbd: create %s size %s format %s using mon %s, pool %s "
|
||||
if pOpts.DataPool != "" {
|
||||
logMsg += fmt.Sprintf("data pool %s", pOpts.DataPool)
|
||||
}
|
||||
klog.V(4).Infof(util.Log(ctx, logMsg), image, volSzMiB, pOpts.ImageFormat, pOpts.Monitors, pOpts.Pool)
|
||||
logMsg := "rbd: create %s size %s format 2 (features: %s) using mon %s, pool %s "
|
||||
if pOpts.DataPool != "" {
|
||||
logMsg += fmt.Sprintf("data pool %s", pOpts.DataPool)
|
||||
}
|
||||
klog.V(4).Infof(util.Log(ctx, logMsg),
|
||||
image, volSzMiB, pOpts.ImageFeatures, pOpts.Monitors, pOpts.Pool)
|
||||
|
||||
args := []string{"create", image, "--size", volSzMiB, "--pool", pOpts.Pool, "--id", cr.ID, "-m", pOpts.Monitors, "--keyfile=" + cr.KeyFile, "--image-feature", pOpts.ImageFeatures}
|
||||
|
||||
args := []string{"create", image, "--size", volSzMiB, "--pool", pOpts.Pool, "--id", cr.ID, "-m", pOpts.Monitors, "--keyfile=" + cr.KeyFile, "--image-format", pOpts.ImageFormat}
|
||||
if pOpts.ImageFormat == rbdImageFormat2 {
|
||||
args = append(args, "--image-feature", pOpts.ImageFeatures)
|
||||
}
|
||||
if pOpts.DataPool != "" {
|
||||
args = append(args, "--data-pool", pOpts.DataPool)
|
||||
}
|
||||
@ -479,25 +469,19 @@ func genVolFromVolumeOptions(ctx context.Context, volOptions, credentials map[st
|
||||
}
|
||||
}
|
||||
|
||||
rbdVol.ImageFormat, ok = volOptions["imageFormat"]
|
||||
if !ok {
|
||||
rbdVol.ImageFormat = rbdImageFormat2
|
||||
}
|
||||
// if no image features is provided, it results in empty string
|
||||
// which disable all RBD image format 2 features as we expected
|
||||
|
||||
if rbdVol.ImageFormat == rbdImageFormat2 {
|
||||
// if no image features is provided, it results in empty string
|
||||
// which disable all RBD image format 2 features as we expected
|
||||
imageFeatures, found := volOptions["imageFeatures"]
|
||||
if found {
|
||||
arr := strings.Split(imageFeatures, ",")
|
||||
for _, f := range arr {
|
||||
if !supportedFeatures.Has(f) {
|
||||
return nil, fmt.Errorf("invalid feature %q for volume csi-rbdplugin, supported"+
|
||||
" features are: %v", f, supportedFeatures)
|
||||
}
|
||||
imageFeatures, found := volOptions["imageFeatures"]
|
||||
if found {
|
||||
arr := strings.Split(imageFeatures, ",")
|
||||
for _, f := range arr {
|
||||
if !supportedFeatures.Has(f) {
|
||||
return nil, fmt.Errorf("invalid feature %q for volume csi-rbdplugin, supported"+
|
||||
" features are: %v", f, supportedFeatures)
|
||||
}
|
||||
rbdVol.ImageFeatures = imageFeatures
|
||||
}
|
||||
rbdVol.ImageFeatures = imageFeatures
|
||||
}
|
||||
|
||||
klog.V(3).Infof(util.Log(ctx, "setting disableInUseChecks on rbd volume to: %v"), disableInUseChecks)
|
||||
|
Loading…
Reference in New Issue
Block a user