-
Notifications
You must be signed in to change notification settings - Fork 522
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
feature: add bs delete snapshot #2889
Conversation
cicheck |
2 similar comments
cicheck |
cicheck |
|
||
func (sCmd *SnapShotCommand) Init(cmd *cobra.Command, args []string) error { | ||
snapshotAddrs, err := config.GetBsSnapshotAddrSlice(sCmd.Cmd) | ||
if err.TypeCode() != cmderror.CODE_SUCCESS || len(snapshotAddrs) == 0 { |
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 two cases are diff, maybe they are not suitable for processing in a statement.
snapshotutil.QueryOffset: snapshotutil.Offset, | ||
} | ||
if sCmd.failed { | ||
params[snapshotutil.QueryStatus] = 5 |
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 might be better to change the hard code.
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.
What does it mean to change the hard code?
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.
For example, you can use static variable to record what 5 means.
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.
ok,understand,I will modify it.
if sCmd.failed { | ||
params[snapshotutil.QueryStatus] = 5 | ||
} | ||
if sCmd.uuid != "*" { |
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.
ditto
cicheck |
6 similar comments
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
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.
good job
tools-v2/README.md
Outdated
Usage: | ||
|
||
```shell | ||
curve bs delete snapshot |
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.
Add example of optional parameters
) | ||
|
||
const ( | ||
snapshotExample = `$ curve bs delete snapshot` |
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.
ditto
func (sCmd *SnapShotCommand) Init(cmd *cobra.Command, args []string) error { | ||
snapshotAddrs, err := config.GetBsSnapshotAddrSlice(sCmd.Cmd) | ||
if err.TypeCode() != cmderror.CODE_SUCCESS { | ||
return err.ToError() |
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.
set a value for sCmd.Error
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.
Do you mean setting value to this err.ToError()?
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.
see #2890
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.
thanks,I got it
cicheck |
1 similar comment
cicheck |
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
@Cyber-SiKu PTAL~ |
However, if you want to merge the pr to master, please merge your commits into one. |
ac67d2f
to
bcbe08f
Compare
cicheck |
rows := make([]map[string]string, 0) | ||
for _, snapshot := range snapshotsList { | ||
row := make(map[string]string) | ||
err := DeleteSnapShot(sCmd.snapshotAddrs, sCmd.timeout, snapshot) |
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.
should handle error here?
tools-v2/pkg/config/bs.go
Outdated
@@ -675,6 +680,10 @@ func AddBsSnapshotIDOptionFlag(cmd *cobra.Command) { | |||
AddBsStringOptionFlag(cmd, CURVEBS_SNAPSHOT_ID, "snapshot seqId") | |||
} | |||
|
|||
func AddBsSnapshotFailedDOptionFlag(cmd *cobra.Command) { |
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.
AddBsSnapshotFailedOptionFlag?
691c708
to
d2bfa24
Compare
cicheck |
1 similar comment
cicheck |
0ed3edc
to
e22656f
Compare
cicheck |
27 similar comments
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
What problem does this PR solve?
Issue Number: #2578
Problem Summary:
What is changed and how it works?
What's Changed:
add bs delete snapshot
How it Works:
Side effects(Breaking backward compatibility? Performance regression?):
Check List