Skip to content
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

OCPVE-600: Implement the ability to wipe the devices #423

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

suleymanakbas91
Copy link
Contributor

No description provided.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Sep 14, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Sep 14, 2023

@suleymanakbas91: This pull request references OCPVE-600 which is a valid jira issue.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 14, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 14, 2023
@openshift-ci openshift-ci bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 14, 2023
@suleymanakbas91 suleymanakbas91 force-pushed the wipefs branch 3 times, most recently from 18fcf17 to b05a2a6 Compare September 14, 2023 14:11
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 14, 2023
api/v1alpha1/lvmcluster_types.go Outdated Show resolved Hide resolved
pkg/wipefs/wipefs.go Outdated Show resolved Hide resolved
pkg/wipefs/wipefs.go Show resolved Hide resolved
allPaths := append(volumeGroup.Spec.DeviceSelector.Paths, volumeGroup.Spec.DeviceSelector.OptionalPaths...)
wiped := false
for _, path := range allPaths {
if isDeviceAlreadyPartOfVG(vgs, path, volumeGroup) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe if the device is part of the vg and the vg was already creatd once and is discoverable in the node status, we can just skip this path. However, if the device is part of a vg that is not in the node status, we have to decide if we should risk killing the existing vg that is not managed by us by wiping the disk, or even erroring. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed the implementation to check isDeviceAlreadyPartOfVG by verifying the existence from the LVMVolumeGroupNodeStatus instead of from vgs call. This will prevent a case where the name of a user-created volume group is the same as the one created in LVMS, and we assume that it is created by LVMS, and skip these devices.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we force wipe devices, shouldn't we also force wipe the devices that were created by LVMS and leftover?

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 23, 2023
@openshift-ci openshift-ci bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 26, 2023
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 26, 2023
@openshift-ci openshift-ci bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 26, 2023
@suleymanakbas91 suleymanakbas91 force-pushed the wipefs branch 5 times, most recently from 7d3abc8 to bfebc93 Compare September 28, 2023 10:05
@suleymanakbas91 suleymanakbas91 marked this pull request as ready for review September 28, 2023 10:16
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 28, 2023
@openshift-ci openshift-ci bot requested review from brandisher and qJkee September 28, 2023 10:16
Copy link
Contributor

@jakobmoellerdev jakobmoellerdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nits, however I think we should make the new field immutable.

pkg/dmsetup/dmsetup.go Show resolved Hide resolved
pkg/vgmanager/devices.go Show resolved Hide resolved
volumeGroup := &v1alpha1.LVMVolumeGroup{
ObjectMeta: metav1.ObjectMeta{Name: "vg1"},
Spec: v1alpha1.LVMVolumeGroupSpec{DeviceSelector: &v1alpha1.DeviceSelector{
Paths: tt.devicePaths,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are missing optionalDevicePath cases I think. Did we test what happens when you pass a non existing devicePath to wipefs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the implementation, I just append optionalDevicePaths to devicePaths: https://github.com/openshift/lvm-operator/pull/423/files#diff-df5f27c889c2546de41e7ad40a6dbad4e9c7933a22593c529fd23977c25b9e54R19 So, I didn't think it'd make a difference to add optionalDevicePath cases to the test.

If the devicePath is non-existing, wipefs returns a failure like "No such file or directory". We just fail the reconciliation at that point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the devicePath is non-existing, wipefs returns a failure like "No such file or directory". We just fail the reconciliation at that point.

In a multi-node scenario, it is normal to have certain optionalDevices that are present on one node but not on another (imagine 2 devices with 2 nodes where each node has one of the devices, but not the other). In this case, it would always fail to wipe the devices on all nodes because at least one device would not be present.

@@ -56,6 +56,12 @@ spec:
description: DeviceSelector is a set of rules that should
match for a device to be included in the LVMCluster
properties:
forceWipeDevicesAndDestroyAllData:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should make this property immutable after creation, see https://kubernetes.io/blog/2022/09/29/enforce-immutability-using-cel/#immutability-upon-object-creation or we can use the webhook, whatever you like more

pkg/wipefs/wipefs.go Show resolved Hide resolved
@suleymanakbas91 suleymanakbas91 force-pushed the wipefs branch 2 times, most recently from 5f3b9e1 to 0c926a6 Compare September 28, 2023 14:45
@jakobmoellerdev
Copy link
Contributor

/retest-required

Signed-off-by: Suleyman Akbas <sakbas@redhat.com>
@codecov-commenter
Copy link

Codecov Report

Merging #423 (56f7077) into main (bd11b2a) will increase coverage by 0.31%.
The diff coverage is 77.58%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #423      +/-   ##
==========================================
+ Coverage   65.80%   66.11%   +0.31%     
==========================================
  Files          28       31       +3     
  Lines        2404     2497      +93     
==========================================
+ Hits         1582     1651      +69     
- Misses        677      694      +17     
- Partials      145      152       +7     
Files Coverage Δ
api/v1alpha1/lvmcluster_types.go 100.00% <ø> (ø)
api/v1alpha1/lvmcluster_webhook.go 82.41% <100.00%> (+0.73%) ⬆️
pkg/vgmanager/devices.go 80.17% <83.33%> (-1.41%) ⬇️
pkg/wipefs/wipefs.go 86.66% <86.66%> (ø)
pkg/dmsetup/dmsetup.go 82.35% <82.35%> (ø)
pkg/vgmanager/vgmanager_controller.go 34.21% <55.55%> (-0.43%) ⬇️
pkg/vgmanager/wipe_devices.go 75.00% <75.00%> (ø)

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 2, 2023

@suleymanakbas91: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

@jakobmoellerdev jakobmoellerdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 2, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Oct 2, 2023

@suleymanakbas91: This pull request references OCPVE-600 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 2, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jakobmoellerdev, suleymanakbas91

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit e7498c2 into openshift:main Oct 2, 2023
suleymanakbas91 pushed a commit to suleymanakbas91/lvm-operator that referenced this pull request Oct 2, 2023
OCPVE-600: Implement the ability to wipe the devices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants