Skip to content

Conversation

@jsafrane
Copy link
Contributor

So the node / CSINodeInfo object can be deleted and detach continutes to work.

Fixes: #83

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 26, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jsafrane

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 26, 2018
@jsafrane jsafrane force-pushed the store-node-id branch 2 times, most recently from 208c2da to 8c00225 Compare October 26, 2018 14:18
@jsafrane
Copy link
Contributor Author

@davidz627, PTAL

Copy link
Contributor

@davidz627 davidz627 left a comment

Choose a reason for hiding this comment

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

some small comments

return va, nil, fmt.Errorf("could not add VolumeAttachment finalizer: %s", err)
originalVA := va
va, finalizerAdded := h.prepareVAFinalizer(va)
va, nodeIDAdded := h.prepareVANodeID(va, nodeID)
Copy link
Contributor

Choose a reason for hiding this comment

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

it is not clear the copy semantics here. In fact I looked through and it seems like both prepare functions do a deepcopy of the va. Since these two functions are both only called together here, wondering if we can wrap both in one prepareVA function that does the deepcopy so we are not repeating work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do DeepCopy() before calling prepareVAFinalizer, but then I do DeepCopy even when no change is needed. Now I do two DeepCopies when one is needed and zero copies when none is needed.

I'd like to avoid funky bool parameters to prepareVAFinalizer or prepareVANodeID if they should do the clone by themselves or it has been already cloned by previous method.

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm I see what you mean. I am ok with either option, feel free to revert if you think the other way is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I restored double DeepCopy()

if finalizerAdded || nodeIDAdded {
va, err = h.saveVA(va)
if err != nil {
// va modification failed, return the original va that's still on API server
Copy link
Contributor

Choose a reason for hiding this comment

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

is this necessarily true, could we have error type where API Server has been modified yet error isi still returned. How bad is returning the incorrect VA here (it might not be that important).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code tries to save error to va.Status. It's likely fail if the error was conflict, but who knows... I try to keep va to the last state acknowledged by API server.

addedVA: va(false, fin, ann),
expectedActions: []core.Action{
core.NewUpdateAction(vaGroupResourceVersion, metav1.NamespaceNone, vaWithAttachError(va(false, fin), "node \"node1\" has no NodeID annotation")),
core.NewUpdateAction(vaGroupResourceVersion, metav1.NamespaceNone, vaWithAttachError(va(false, fin, ann), "node \"node1\" has no NodeID annotation")),
Copy link
Contributor

Choose a reason for hiding this comment

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

wonder if this should work now cause we get the nodeid from the VA

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, this is about attach. It should fail if driver is not registered to the node.

@davidz627
Copy link
Contributor

/lgtm
/hold
for squash and CI fix

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 31, 2018
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 31, 2018
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 1, 2018
So the node / CSINodeInfo object can be deleted and detach continutes to
work.
@jsafrane jsafrane force-pushed the store-node-id branch 2 times, most recently from 1e1e3c6 to cc01f60 Compare November 1, 2018 09:51
@jsafrane
Copy link
Contributor Author

jsafrane commented Nov 1, 2018

squashed, rebased, restored double DeepCopy(). @davidz627, PTAL

@davidz627
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 1, 2018
@davidz627
Copy link
Contributor

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 1, 2018
@k8s-ci-robot k8s-ci-robot merged commit db579c9 into kubernetes-csi:master Nov 1, 2018
jsafrane pushed a commit to jsafrane/external-attacher that referenced this pull request Sep 24, 2025
STOR-2392: Rebase to upstream v4.9.0 for OCP 4.20
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants