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

Bug 1904385: make ControllerPublishVolume idempotent #63

Merged
merged 1 commit into from Jan 12, 2021

Conversation

bennyz
Copy link
Member

@bennyz bennyz commented Jan 7, 2021

If the disk is already attached to the VM, return OK

Signed-off-by: Benny Zlotnik bzlotnik@redhat.com

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 7, 2021
@bennyz
Copy link
Member Author

bennyz commented Jan 7, 2021

/retest

@bennyz bennyz closed this Jan 7, 2021
@bennyz bennyz reopened this Jan 7, 2021
@bennyz
Copy link
Member Author

bennyz commented Jan 7, 2021

/retest

@bennyz
Copy link
Member Author

bennyz commented Jan 7, 2021

/test e2e-ovirt

1 similar comment
@bennyz
Copy link
Member Author

bennyz commented Jan 10, 2021

/test e2e-ovirt

@bennyz
Copy link
Member Author

bennyz commented Jan 10, 2021

/test e2e-ovirt

@bennyz bennyz changed the title make ControllerPublishVolume idempotent Bug 1904385: make ControllerPublishVolume idempotent Jan 10, 2021
@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. label Jan 10, 2021
@openshift-ci-robot
Copy link

@bennyz: This pull request references Bugzilla bug 1904385, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1904385: make ControllerPublishVolume idempotent

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-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Jan 10, 2021
_, err = diskAttachmentByVmAndDisk(conn, req.NodeId, req.VolumeId)
if err != nil {
// If attachment was not found we are good to
_, ok := err.(*AttachmentNotFoundError)
Copy link

Choose a reason for hiding this comment

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

I think it is better to use errors.Is() or errors.As() here because it checks wrapped errors too. Not an issue now, but later with some refactoring this could become relevant.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I tried it previously, but I think it doesn't apply here since the error isn't wrapped (and there is no need to wrap it as this error is actually desired in this case)

Copy link

Choose a reason for hiding this comment

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

It's more of a nitpick, really. I'm just thinking about the future when somebody is working on this code. If the error will be wrapped in the future using the errors methods make the code more resilient.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm ok with nits :) do you have an example of how it would look in this case? Because as I understand to use errors I'd need to create an instance of the error struct, but perhaps I'm missing something

Copy link

Choose a reason for hiding this comment

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

From memory it should work like this:

notFoundError := &AttachmentNotFoundError{}
if errors.As(err, &notFoundError) {
    // ...
}

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, like I said, it requires an additional instance which looks weird, but I changed it anyway

Copy link

Choose a reason for hiding this comment

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

Alternatively, you can also store the error in a variable and use errors.Is, that is less quirky.

@bennyz
Copy link
Member Author

bennyz commented Jan 12, 2021

/hold

@janoszen can you lgtm?
if not, please create a PR to add yourself to the OWENRS file

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 12, 2021
@ghost
Copy link

ghost commented Jan 12, 2021

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2021
@bennyz
Copy link
Member Author

bennyz commented Jan 12, 2021

/test e2e-ovirt

If the disk is already attached to the VM, return OK

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2021
@ghost
Copy link

ghost commented Jan 12, 2021

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2021
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bennyz, janoszen

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

@bennyz
Copy link
Member Author

bennyz commented Jan 12, 2021

I forgot a !

@bennyz
Copy link
Member Author

bennyz commented Jan 12, 2021

/unhold

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 12, 2021
@openshift-merge-robot openshift-merge-robot merged commit fec07a3 into openshift:master Jan 12, 2021
@openshift-ci-robot
Copy link

@bennyz: All pull requests linked via external trackers have merged:

Bugzilla bug 1904385 has been moved to the MODIFIED state.

In response to this:

Bug 1904385: make ControllerPublishVolume idempotent

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.

@bennyz bennyz deleted the idempotent-publish branch January 12, 2021 19:36
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. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants