-
Notifications
You must be signed in to change notification settings - Fork 28
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
csi: delete stale subvolumesnapshot #307
Conversation
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.
@yati1998 what about the omap cleanup?
pkg/filesystem/subvolume.go
Outdated
if len(splitSnapshotHandle) < 6 { | ||
return nil | ||
} | ||
snapshotHandleId := splitSnapshotHandle[len(splitSnapshotHandle)-1] |
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.
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.
yes, it just compares the snap-id ignore the prefix which matches with snapshothandle.
b9b5b61
to
bd4100e
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.
LGTM, just a small test suggestion
@subhamkrai do you have any idea why is the ci failing, it seems it is failing due to some plugin test. Can you please check? |
pkg/filesystem/subvolume.go
Outdated
if err != nil || snapshotcontentname == "" { | ||
logging.Info("No snapshot content found for snapshot %s: %s", snap, err) | ||
return "" | ||
} |
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.
am not sure this check is correct, we can consider the error !=nil as not found right?
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.
yes correct.
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 looks like a wrong assumption to consider err!=nil
as not found and continue , can you please check this again
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.
Having this assumption will leave a stale entry in the omap, can you please check, if there is any error when running this command it should be logged as Fatal not just info and return empty struct which will skip omap deletion operation.
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.
okay checked that, added the required change
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.
@Madhu-1 please do review again.
4de207a
to
2b4598b
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.
The CI is failing:
go: github.com/kubernetes-csi/external-snapshotter/client/[email protected] requires go >= 1.22.0 (running go 1.21.11)
make: *** [Makefile:19: build] Error 1
yes, checked that, we need to update the go.mod here itself or send another PR and merge it first? |
@yati1998 I created this issue #309 please rebase your PR once that issue is closed. |
pkg/filesystem/subvolume.go
Outdated
snapshotHandles := make(map[string]snapshotInfo) | ||
for _, snap := range snapList.Items { | ||
driverName := snap.Spec.Driver | ||
if snap.Status != nil && snap.Status.SnapshotHandle != nil && strings.Contains(driverName, "cephfs") { |
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.
cephfs.csi.ceph.com
use this one
pkg/filesystem/subvolume.go
Outdated
if err != nil || snapshotcontentname == "" { | ||
logging.Info("No snapshot content found for snapshot %s: %s", snap, err) | ||
return "" | ||
} |
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 looks like a wrong assumption to consider err!=nil
as not found and continue , can you please check this again
@Madhu-1 I think this is fine, either there is no omap or some error running the command, anywhich ways we are printing the error too. we do the same for pv also, looks fine to me. |
pkg/filesystem/subvolume.go
Outdated
args := []string{"getomapval", snapomapval, "csi.snapname", "-p", poolName, "--namespace", "csi", "/dev/stdout"} | ||
cmd := "rados" | ||
snapshotcontentname, err := runCommand(ctx, clientsets, operatorNamespace, cephClusterNamespace, cmd, args) | ||
if snapshotcontentname == "" { |
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 also have err==nil
check to work as expected or else if its err!=nil we will have it snapshotcontentname set to empty string
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.
oh yeah, got it.
@yati1998 Could you look at the CI? Not sure at a glance what the failure is. |
@yati1998 Please rebase it to resolve the merge conflicts |
this commit checks if there are any stale volumesnapshots, if yes, it deletes the snapshots Signed-off-by: yati1998 <[email protected]>
can you please review now? |
this commit checks if there are any stale
volumesnapshots, if yes, it deletes the
snapshots