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

fetch mirror group status #1009

Closed
wants to merge 1 commit into from
Closed

Conversation

sp98
Copy link

@sp98 sp98 commented Jul 7, 2024

Checklist

  • Added tests for features and functional changes
  • Public functions and types are documented
  • Standard formatting is applied to Go code
  • Is this a new API? Added a new file that begins with //go:build ceph_preview
  • Ran make api-update to record new APIs

New or infrequent contributors may want to review the go-ceph Developer's Guide including the section on how we track API Status and the API Stability Plan.

The go-ceph project uses mergify. View the mergify command guide for information on how to interact with mergify. Add a comment with @Mergifyio rebase to rebase your PR when github indicates that the PR is out of date with the base branch.

@sp98 sp98 force-pushed the mirror-group-status branch 3 times, most recently from 7c0317a to 33de31c Compare July 7, 2024 14:30
Copy link
Collaborator

@phlogistonjohn phlogistonjohn left a comment

Choose a reason for hiding this comment

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

The tests are rather cranky. I've tried to point out a few reasons why.

The big item you need to tackle first is to avoid adding new code to an existing file. Start a new file for the new api and the related types, maybe something like mirror_group_status.go ?

@@ -110,7 +110,8 @@ func GroupImageAdd(groupIoctx *rados.IOContext, groupName string,
cephIoctx(groupIoctx),
cGroupName,
cephIoctx(imageIoctx),
cImageName)
cImageName,
C.uint32_t(0))
Copy link
Collaborator

Choose a reason for hiding this comment

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

https://github.com/ceph/ceph/blob/reef/src/include/rbd/librbd.h#L1436

I don't understand these changes to rbd_group_image_add. It only has the four arguments that we're already passing.

@@ -160,7 +162,8 @@ func GroupImageRemoveByID(groupIoctx *rados.IOContext, groupName string,
cephIoctx(groupIoctx),
cGroupName,
cephIoctx(imageIoctx),
cid)
cid,
C.uint32_t(0))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same. Where are these extra args coming from?

MirrorGroupStatusStateStopped = MirrorGroupStatusState(C.MIRROR_GROUP_STATUS_STATE_STOPPED)
)

// MirrorImageState represents the mirroring state of a RBD image.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo/copy-paste mistake is confusing the linter.

type MirrorGroupStatusState int64

const (
// MirrorGrouptatusStateUnknown is equivalent to MIRROR_GROUP_STATUS_STATE_UNKNOWN
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo is confusing the linter.

Comment on lines +278 to +288
MirrorGroupStatusStateUnknown = MirrorGroupStatusState(C.MIRROR_GROUP_STATUS_STATE_UNKNOWN)
// MirrorGroupStatusStateError is equivalent to MIRROR_GROUP_STATUS_STATE_ERROR
MirrorGroupStatusStateError = MirrorGroupStatusState(C.MIRROR_GROUP_STATUS_STATE_ERROR)
// MirrorGroupStatusStateStartingReplay is equivalent to MIRROR_GROUP_STATUS_STATE_STARTING_REPLAY
MirrorGroupStatusStateStartingReplay = MirrorGroupStatusState(C.MIRROR_GROUP_STATUS_STATE_STARTING_REPLAY)
// MirrorGroupStatusStateReplaying is equivalent to MIRROR_GROUP_STATUS_STATE_REPLAYING
MirrorGroupStatusStateReplaying = MirrorGroupStatusState(C.MIRROR_GROUP_STATUS_STATE_REPLAYING)
// MirrorGroupStatusStateStoppingReplay is equivalent to MIRROR_GROUP_STATUS_STATE_STOPPING_REPLAY
MirrorGroupStatusStateStoppingReplay = MirrorGroupStatusState(C.MIRROR_GROUP_STATUS_STATE_STOPPING_REPLAY)
// MirrorGroupStatusStateStopped is equivalent to MIRROR_IMAGE_GROUP_STATUS_STATE_STOPPED
MirrorGroupStatusStateStopped = MirrorGroupStatusState(C.MIRROR_GROUP_STATUS_STATE_STOPPED)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Most, if not all (I didn't check), of these flags are unknown on older versions of the code. These should be moved to a new file.

// const char *group_name
// mirror_group_global_status_t *mirror_group_status,
// size_t status_size);
func GetGlobalMirrorGroupStatus(ioctx *rados.IOContext, groupName string) (GlobalMirrorGroupStatus, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

New APIs like this need to be added to a new file and then have build tags applied to them to (a) control what versions of ceph it'll build with and (b) be initially marked as preview as per our docs and the policy.

@phlogistonjohn phlogistonjohn added the API This PR includes a change to the public API of a go-ceph package label Jul 7, 2024
@sp98
Copy link
Author

sp98 commented Jul 9, 2024

closing this in favor of #1010

@sp98 sp98 closed this Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API This PR includes a change to the public API of a go-ceph package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants