Skip to content

Commit

Permalink
storageclassrequest: remove use of StorageProfiles with blockpools
Browse files Browse the repository at this point in the history
Signed-off-by: Jose A. Rivera <[email protected]>
  • Loading branch information
jarrpa committed Mar 19, 2024
1 parent 38e8460 commit 765203e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (r *StorageClassRequestReconciler) initPhase(storageProfile *v1.StorageProf
listOptions := []client.ListOption{
client.InNamespace(r.OperatorNamespace),
&client.MatchingLabels{
controllers.StorageProfileSpecLabel: storageProfile.GetSpecHash(),
controllers.StorageProfileLabel: profileName,
},
}
if err := r.list(cephBlockPoolList, listOptions...); err != nil {
Expand All @@ -278,7 +278,7 @@ func (r *StorageClassRequestReconciler) initPhase(storageProfile *v1.StorageProf
r.cephBlockPool.Name = cephBlockPoolList.Items[0].GetName()
r.log.V(1).Info("valid CephBlockPool found", "CephBlockPool", r.cephBlockPool.Name)
} else {
return fmt.Errorf("invalid number of CephBlockPools for storage profile %q: found %d, expecting 1", storageProfile.Name, cbpItemsLen)
return fmt.Errorf("invalid number of CephBlockPools for storage profile %q: found %d, expecting 1", profileName, cbpItemsLen)
}

r.cephRadosNamespace.Spec.BlockPoolName = r.cephBlockPool.Name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ func TestCephBlockPool(t *testing.T) {
Name: "test-blockpool",
Namespace: "test-ns",
Labels: map[string]string{
controllers.StorageProfileSpecLabel: fakeStorageProfile.GetSpecHash(),
controllers.StorageProfileLabel: fakeStorageProfile.Name,
},
},
},
Expand All @@ -444,7 +444,7 @@ func TestCephBlockPool(t *testing.T) {
Name: "test-blockpool2",
Namespace: "test-ns",
Labels: map[string]string{
controllers.StorageProfileSpecLabel: fakeStorageProfile.GetSpecHash(),
controllers.StorageProfileLabel: fakeStorageProfile.Name,
},
},
},
Expand Down Expand Up @@ -512,7 +512,7 @@ func TestCephBlockPool(t *testing.T) {
Name: "test-blockpool",
Namespace: "test-ns",
Labels: map[string]string{
controllers.StorageProfileSpecLabel: fakeStorageProfile.GetSpecHash(),
controllers.StorageProfileLabel: fakeStorageProfile.Name,
},
},
},
Expand Down Expand Up @@ -608,22 +608,6 @@ func TestCephBlockPool(t *testing.T) {
err = r.get(expectedRadosNamespace)
assert.NoError(t, err, caseLabel)
}

caseCounter++
caseLabel := fmt.Sprintf("Case %d: StorageProfile has invalid DeviceClass", caseCounter)
fmt.Println(caseLabel)

badStorageProfile := fakeStorageProfile.DeepCopy()
badStorageProfile.Spec.DeviceClass = "nope"

r := createFakeReconciler(t)
r.StorageClassRequest.Spec.Type = "blockpool"
r.StorageClassRequest.Spec.StorageProfile = badStorageProfile.Name
fakeClient := newFakeClientBuilder(r.Scheme)
r.Client = fakeClient.WithRuntimeObjects(badStorageProfile, fakeStorageConsumer).Build()

_, err = r.reconcilePhases()
assert.Error(t, err, caseLabel)
}

func TestCephFsSubVolGroup(t *testing.T) {
Expand Down

0 comments on commit 765203e

Please sign in to comment.