-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thin pool creation #131
Thin pool creation #131
Conversation
67ebf50
to
be11c69
Compare
8ac50ec
to
3051678
Compare
a75ed2c
to
063de1c
Compare
18790fc
to
530a9c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- in general, we don't have any validation of CR yet, better we start adding validation code with this CR or mark mandatory fields as required in CRD via kubebuilder?
053d951
to
4634436
Compare
added CRD validation for the required fields for the new ThinPoolConfig. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does anything extra need to be done for the cleanup?
api/v1alpha1/lvmcluster_types.go
Outdated
// OverProvisionRatio is the factor by which additional storage can be provisioned compared to | ||
// the available storage in the thin pool. | ||
// +kubebuilder:validation:Minimum=2 | ||
OverprovisionRatio int `json:"overprovisionRatio,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Marked it as required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thin pool needs to be deleted before the VG is deleted:
{"level":"error","ts":1650198338.4370134,"logger":"controller.lvmcluster","msg":"Reconciler error","reconciler group":"lvm.topolvm.io","reconciler kind":"LVMCluster","name":"lvmcluster-sample","namespace":"lvm-operator-system","error":"failed cleaning up: lvmvg-manager waiting for all VGs to be deleted","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:227"}
- Also update LVMVolumeGroup CR to use thinPoolConfig - Update suite test to include the required thinPoolConfig Signed-off-by: Santosh Pillai <[email protected]>
args := []string{"-f", fmt.Sprintf("%s/%s", volumeGroup.Name, volumeGroup.Spec.ThinPoolConfig.Name)} | ||
_, err = r.executor.ExecuteCommandWithOutputAsHost(lvRemoveCmd, args...) | ||
if err != nil { | ||
return fmt.Errorf("failed to delete thin pool %q. %v", volumeGroup.Spec.ThinPoolConfig.Name, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not cover the case when the thin pool is already deleted by the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated. Checking if the thin pool exists before deleting it.
4e778e6
to
a710e84
Compare
Signed-off-by: Santosh Pillai <[email protected]>
Signed-off-by: Santosh Pillai <[email protected]>
c053dfa
to
03afe07
Compare
@@ -249,6 +294,25 @@ func (r *VGReconciler) processDelete(ctx context.Context, volumeGroup *lvmv1alph | |||
return nil | |||
} | |||
|
|||
// Delete thin pool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done after checking if the volumegroup exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. Fixed.
Signed-off-by: Santosh Pillai <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: leelavg, nbalacha, sp98 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Create thin pool via VG Manager.
Testing:
CR:
Apps using thin volumes: