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

clean cephFS omap details #237

Merged
merged 1 commit into from
Mar 20, 2024
Merged

clean cephFS omap details #237

merged 1 commit into from
Mar 20, 2024

Conversation

yati1998
Copy link
Contributor

@yati1998 yati1998 commented Feb 6, 2024

Remove the omap object for the given subvolume.

@yati1998
Copy link
Contributor Author

yati1998 commented Feb 6, 2024

https://github.com/rook/kubectl-rook-ceph/actions/runs/7799941151/job/21272736952?pr=237#step:12:20

did not load config file, using default settings.
2024-02-06T10:08:53.016+0000 7fa11474ae00 -1 Errors while parsing config file!
2024-02-06T10:08:53.016+0000 7fa11474ae00 -1 can't open ceph.conf: (2) No such file or directory
unable to get monitor info from DNS SRV with service name: ceph-mon
2024-02-06T10:08:53.018+0000 7fa11474ae00 -1 failed for service _ceph-mon._tcp
2024-02-06T10:08:53.018+0000 7fa11474ae00 -1 monclient: get_monmap_and_config cannot identify monitors to contact
failed to fetch mon config (--no-mon-config to skip)```

@yati1998
Copy link
Contributor Author

yati1998 commented Feb 6, 2024

cc: @travisn @Madhu-1

@travisn
Copy link
Member

travisn commented Feb 6, 2024

https://github.com/rook/kubectl-rook-ceph/actions/runs/7799941151/job/21272736952?pr=237#step:12:20

did not load config file, using default settings.
2024-02-06T10:08:53.016+0000 7fa11474ae00 -1 Errors while parsing config file!
2024-02-06T10:08:53.016+0000 7fa11474ae00 -1 can't open ceph.conf: (2) No such file or directory
unable to get monitor info from DNS SRV with service name: ceph-mon
2024-02-06T10:08:53.018+0000 7fa11474ae00 -1 failed for service _ceph-mon._tcp
2024-02-06T10:08:53.018+0000 7fa11474ae00 -1 monclient: get_monmap_and_config cannot identify monitors to contact
failed to fetch mon config (--no-mon-config to skip)```

The plugin may not understand that it needs to append the mon and cluster commands to the rados command. Looks like you need to add the rados command here.

@yati1998
Copy link
Contributor Author

yati1998 commented Feb 7, 2024

https://github.com/rook/kubectl-rook-ceph/actions/runs/7799941151/job/21272736952?pr=237#step:12:20

did not load config file, using default settings.
2024-02-06T10:08:53.016+0000 7fa11474ae00 -1 Errors while parsing config file!
2024-02-06T10:08:53.016+0000 7fa11474ae00 -1 can't open ceph.conf: (2) No such file or directory
unable to get monitor info from DNS SRV with service name: ceph-mon
2024-02-06T10:08:53.018+0000 7fa11474ae00 -1 failed for service _ceph-mon._tcp
2024-02-06T10:08:53.018+0000 7fa11474ae00 -1 monclient: get_monmap_and_config cannot identify monitors to contact
failed to fetch mon config (--no-mon-config to skip)```

The plugin may not understand that it needs to append the mon and cluster commands to the rados command. Looks like you need to add the rados command here.

That works @travisn . Thanks.

@yati1998 yati1998 marked this pull request as ready for review February 9, 2024 05:03
@yati1998 yati1998 force-pushed the omapcleanup branch 4 times, most recently from 63b1880 to 013ee98 Compare February 12, 2024 08:17
Copy link
Collaborator

@subhamkrai subhamkrai left a comment

Choose a reason for hiding this comment

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

Also, please update commit/PR title

.github/workflows/go-test.yaml Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
@yati1998 yati1998 force-pushed the omapcleanup branch 3 times, most recently from c52d3b6 to d881f18 Compare February 15, 2024 07:45
@travisn
Copy link
Member

travisn commented Feb 15, 2024

The CI is failing:

+ kubectl rook-ceph --operator-namespace test-operator -n test-cluster subvolume delete myfs test-subvol group-a
Info: subvolume "test-subvol" deleted
Error: error getting omap keys myfs-metadata/test.subvolume: (2) No such file or directory
. failed to run command. command terminated with exit code 1%!(EXTRA string=failed to list omapval)
Error: failed to get omap details: "error getting omap keys myfs-metadata/test.subvolume: (2) No such file or directory\n. failed to run command. command terminated with exit code 1"

@yati1998
Copy link
Contributor Author

The CI is failing:

+ kubectl rook-ceph --operator-namespace test-operator -n test-cluster subvolume delete myfs test-subvol group-a
Info: subvolume "test-subvol" deleted
Error: error getting omap keys myfs-metadata/test.subvolume: (2) No such file or directory
. failed to run command. command terminated with exit code 1%!(EXTRA string=failed to list omapval)
Error: failed to get omap details: "error getting omap keys myfs-metadata/test.subvolume: (2) No such file or directory\n. failed to run command. command terminated with exit code 1"

Yes, this error is expected. Updated the test to include error in output.

Copy link
Member

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

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

i think we should start testing all these functionalities in the CI to ensure it works, Please add test cases for it

Comment on lines 55 to 56
# Error: error getting omap keys ocs-storagecluster-cephfilesystem-metadata/test.subvolume:
# (2) No such file or directory
# . failed to run command. command terminated with exit code 1%!(EXTRA string=failed to list omapval)
Copy link
Member

Choose a reason for hiding this comment

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

why do we have this error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Incase the subvolume is created from backend and it's stale, there will be no omap created for it. In that case if we try to delete the omap, it will through this error.

Copy link
Collaborator

Choose a reason for hiding this comment

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

let's document the happy case output.

pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
@yati1998 yati1998 force-pushed the omapcleanup branch 2 times, most recently from 978ee47 to 07b74fd Compare February 19, 2024 11:55
Comment on lines 55 to 56
# Error: error getting omap keys ocs-storagecluster-cephfilesystem-metadata/test.subvolume:
# (2) No such file or directory
# . failed to run command. command terminated with exit code 1%!(EXTRA string=failed to list omapval)
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's document the happy case output.

pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
@yati1998 yati1998 force-pushed the omapcleanup branch 2 times, most recently from 6ffcf46 to b9336f1 Compare February 26, 2024 05:49
@yati1998
Copy link
Contributor Author

@travisn @Madhu-1 I have addressed all the comments above, please do have a look once you are free.
@Madhu-1 about adding the test for stale rados omap, we need to create sc with retain feature and a few other steps need to be followed, I am working on it to check how we can add that here in ci.

@yati1998 yati1998 force-pushed the omapcleanup branch 3 times, most recently from 40198f5 to 40a2196 Compare March 18, 2024 11:08
tests := []struct {
name string
want string
}{

Choose a reason for hiding this comment

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

Maybe consider adding negative tests as well? An empty string, a string with only no, one or two - in there probably are problematic and cause issues. It may be unlikely that these get passed to the function, but you should be prepared for weird issues in a cleanup process, some values may be unexpectedly missing or somehow got corrupted.

Copy link

@nixpanic nixpanic Mar 18, 2024

Choose a reason for hiding this comment

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

I'm not sure if the added tests provide the needed or expected results to whatever calls getOmapVal(). But this at least confirms that there are no panics happening.

@travisn travisn dismissed their stale review March 18, 2024 14:04

My feedback has been addressed. After CI is passing LGTM.

@yati1998 yati1998 requested a review from nixpanic March 18, 2024 14:07
Copy link

@nixpanic nixpanic left a comment

Choose a reason for hiding this comment

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

Looks good to me. If there are any missed corner-cases where cleanup isn't working as expected, this can always be improved later.

Copy link
Collaborator

@subhamkrai subhamkrai left a comment

Choose a reason for hiding this comment

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

@yati1998 please rebase your PR to get latest ci fixes.

@yati1998
Copy link
Contributor Author

@Madhu-1 waiting for your review here. Please feel free to add your comments.

Copy link
Member

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

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

LGTM,
small nits

pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Show resolved Hide resolved
Comment on lines +279 to +278
if err != nil || poolName == "" {
logging.Fatal(fmt.Errorf("pool name not found: %q", err))
Copy link
Member

Choose a reason for hiding this comment

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

same here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it's not required.

pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
@yati1998 yati1998 requested a review from subhamkrai March 20, 2024 03:51
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
tests/github-action-helper.sh Outdated Show resolved Hide resolved
Copy link
Collaborator

@subhamkrai subhamkrai left a comment

Choose a reason for hiding this comment

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

Also, since this clean cephfs OMAP please update the commit title and PR title to mention cephFS OMAP

docs/subvolume.md Outdated Show resolved Hide resolved
docs/subvolume.md Outdated Show resolved Hide resolved
docs/subvolume.md Outdated Show resolved Hide resolved
@yati1998 yati1998 changed the title clean omap details clean cephFS omap details Mar 20, 2024
@yati1998 yati1998 requested a review from subhamkrai March 20, 2024 09:57
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
pkg/filesystem/subvolume.go Outdated Show resolved Hide resolved
this commit deletes the omap presence of the
stale subvolume

Signed-off-by: yati1998 <ypadia@redhat.com>
@subhamkrai subhamkrai merged commit 2bcbb3e into rook:master Mar 20, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants