-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Add RepairVolumeHandle to the csi translation struct #83593
Conversation
/sig storage |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: davidz627 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 |
} | ||
|
||
nodeTok := strings.Split(nodeID, "/") | ||
if len(nodeTok) != volIDTotalElements { |
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.
is this right? node token has the same number of elements as volume id?
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 is also fully qualified (projects/{project}/zones/{zone}/instances/{instanceName}) and is the same as the selfID given by GCE
if len(tok) != volIDTotalElements { | ||
return "", fmt.Errorf("volume handle has wrong number of elements; got %v, wanted %v", len(tok), volIDTotalElements) | ||
} | ||
if tok[volIDProjectValue] != UnspecifiedValue { |
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.
Is this right? Can a project be unspecified?
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.
Also if the project is unspecified, does that guarantee the zone/region is specified?
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.
in migration project is always unspecified (that information isn't encoded in in-tree API objects at all). Zone/region is unspecified based on whether the zone label is applied to the PV or not (I think we are not always guaranteed that is the case especially in pre-provisioned or inline volumes).
So this will always fix the project - and sometimes fix the zone/region. Logic is kind of complicated so I have the unit test
06b1b4c
to
b89b029
Compare
b89b029
to
2af7113
Compare
/retest |
2af7113
to
93f7cec
Compare
@msau42 ready for next round of review |
/lgtm |
Add RepairVolumeHandle to the csi translation struct
RepairVolumeHandle is needed in VerifyVolumesAttached on the external attacher when we need to do strict volume handle matching to check
VolumeAttachment
attached
status. Most Plugins will already have fully qualified volume handles butGCE PD
sometimes does not have full information and hasUNSPECIFIED
so that needs to be repaired before we can verify whether that volume is attached./assign @msau42
/cc @ddebroy @leakingtapan
/kind feature