From 15bb30a98a2f2319456418d60b975216bb81f9c6 Mon Sep 17 00:00:00 2001 From: sai chaithanya Date: Sat, 8 Jun 2019 22:50:31 +0530 Subject: [PATCH] [cherry-pick] fix(blockdeviceclaims): fix openebs version type in blockdeviceclaim (#1270) * refact(cstor-pool,sparse): Update SPC type to blockdevice (#1264) With latest changes, to create StoragePoolClaim we have to use spc type blockdevice as common type instead of sparse/disk for creating sparse or disk based cstor pools ``` apiVersion: openebs.io/v1alpha1 kind: StoragePoolClaim metadata: name: sparse-claim-auto spec: name: sparse-claim-auto type: blockdevice maxPools: 1 minPools: 1 poolSpec: poolType: striped cacheFile: /var/openebs/sparse/sparse-claim-auto.cache overProvisioning: false ``` Signed-off-by: prateekpandey14 * feat(cstor-operator): add a support to create pools on unclaimed BD in manual mode (#1255) Signed-off-by: mittachaitu * fix(blockdeviceclaims): fix openebs version type in blockdeviceclaim (#1269) Signed-off-by: mittachaitu --- pkg/algorithm/nodeselect/v1alpha1/select_node.go | 6 +++--- pkg/blockdeviceclaim/v1alpha1/build.go | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/algorithm/nodeselect/v1alpha1/select_node.go b/pkg/algorithm/nodeselect/v1alpha1/select_node.go index abba273448..b78f318d1d 100644 --- a/pkg/algorithm/nodeselect/v1alpha1/select_node.go +++ b/pkg/algorithm/nodeselect/v1alpha1/select_node.go @@ -233,7 +233,7 @@ func (ac *Config) ClaimBlockDevice(nodeBDs *nodeBlockDevice, spc *apis.StoragePo bdcObjList, err := bdcKubeclient.List(metav1.ListOptions{LabelSelector: lselector}) if err != nil { - return nil, errors.Wrapf(err, "failed to list block device claim for {%s}", spc.Name) + return nil, errors.Wrapf(err, "failed to list block device claims for {%s}", spc.Name) } customBDCObjList := bdc.ListBuilderFromAPIList(bdcObjList) @@ -272,7 +272,7 @@ func (ac *Config) ClaimBlockDevice(nodeBDs *nodeBlockDevice, spc *apis.StoragePo WithOwnerReference(spc). Build() if err != nil { - return nil, errors.Wrapf(err, "failed to build blockd device claim for bd {%s}", bdName) + return nil, errors.Wrapf(err, "failed to build block device claim for bd {%s}", bdName) } _, err = bdcKubeclient.Create(newBDCObj.Object) @@ -289,7 +289,7 @@ func (ac *Config) ClaimBlockDevice(nodeBDs *nodeBlockDevice, spc *apis.StoragePo nodeClaimedBDs.BlockDeviceList = append(nodeClaimedBDs.BlockDeviceList, claimedBD) } if pendingBDCCount != 0 { - return nil, errors.Errorf("failed to claim block devcies on node: {%s}", nodeClaimedBDs.NodeName) + return nil, errors.Errorf("failed to claim block devices on node {%s}", nodeClaimedBDs.NodeName) } return nodeClaimedBDs, nil } diff --git a/pkg/blockdeviceclaim/v1alpha1/build.go b/pkg/blockdeviceclaim/v1alpha1/build.go index 81beab26f1..903bf44127 100644 --- a/pkg/blockdeviceclaim/v1alpha1/build.go +++ b/pkg/blockdeviceclaim/v1alpha1/build.go @@ -28,6 +28,8 @@ import ( const ( // StoragePoolKind holds the value of StoragePoolClaim StoragePoolKind = "StoragePoolClaim" + // APIVersion holds the value of OpenEBS version + APIVersion = "openebs.io/v1alpha1" ) // Builder is the builder object for BlockDeviceClaim @@ -237,7 +239,7 @@ func (b *Builder) WithOwnerReference(spc *apis.StoragePoolClaim) *Builder { } trueVal := true reference := metav1.OwnerReference{ - APIVersion: string(apis.OpenEBSVersionKey), + APIVersion: APIVersion, Kind: StoragePoolKind, UID: spc.ObjectMeta.UID, Name: spc.ObjectMeta.Name,