-
Notifications
You must be signed in to change notification settings - Fork 807
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
Stop treating prefixes as magic in DeviceManager #1518
Stop treating prefixes as magic in DeviceManager #1518
Conversation
Signed-off-by: Connor Catlett <[email protected]>
Please update the commit title to be more descriptive of the actual problem. 'Stop treating prefixes as magic' isn't very informative. |
@@ -22,8 +22,7 @@ import ( | |||
|
|||
// ExistingNames is a map of assigned device names. Presence of a key with a device | |||
// name in the map means that the device is allocated. Value is irrelevant and | |||
// can be used for anything that NameAllocator user wants. Only the relevant | |||
// part of device name should be in the map, e.g. "ba" for "/dev/xvdba". | |||
// can be used for anything that NameAllocator user wants. | |||
type ExistingNames map[string]string |
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.
If we don't care about the value, it should be struct{}
.
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.
Although we don't care about the value there is a value: the caller passes in a map[string]string
, which is not compatible with a map[string]struct{}
.
c1ac044
to
bba5b11
Compare
DM treats the prefixes "/dev/xvd" and "/dev/sd" as magic. This leads to a bug where volumes with a prefix starting with "/dev/sd" (for example, "/dev/sdf") will get incorrectly mangled into a "/dev/xvd" form (i.e. converting "/dev/sdf" to "/dev/xvdf"). This will cause a volume that is already mounted and prefixed with "/dev/sd" (for example, a volume manually mounted via the AWS console) to get stuck in an infinite loop as the node will believe it is mounted at the wrong path. With this change, instead of storing only the end of the path in the inflight and existing volumes map, we instead store the entire device path. The previously leaky abstraction from the allocator to store only the end of the path is contained to the allocator, which has a new parameter for the desired prefix. This commit also vastly increases the range of paths the allocator can generate from 52 simultaneously mounted volumes to 650. Signed-off-by: Connor Catlett <[email protected]>
bba5b11
to
58fc07e
Compare
/lgtm |
Will approve this PR tomorrow if no further feedback to include this change in our March release. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: torredil 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 |
/hold needs fix |
EBS has undocumented validation on the device that prevents the use of device names after /dev/xvddx. Also, expand the beginning of the device pool to account for this smaller pool of device names. Signed-off-by: Connor Catlett <[email protected]>
42e61c7
to
882acf6
Compare
/remove-hold Minor fix, but someone else should re-review before this is merged. |
/lgtm |
Blocked on kubernetes/test-infra#29003. |
/retest |
1 similar comment
/retest |
/retest |
Due to kubernetes-sigs#1518, volumes now start with /dev/xvda rather than /dev/xvdb. Because of this, the hardcoded path in the snow code stopped working, breaking mounting on snow devices. This change instead creates the snow device path based on the last character of the generated path, rather than trying to do it via trimming, which is unreliable. Snow devices are currently limited to 10 volumes attached which makes this 100% safe, but this will need to be revisited if snow every adds suport for >26 volumes. Signed-off-by: Connor Catlett <[email protected]>
Due to kubernetes-sigs#1518, volumes now start with /dev/xvda rather than /dev/xvdb. Because of this, the hardcoded path in the snow code stopped working, breaking mounting on snow devices. This change instead creates the snow device path based on the last character of the generated path, rather than trying to do it via trimming, which is unreliable. Snow devices are currently limited to 10 volumes attached which makes this 100% safe, but this will need to be revisited if snow ever adds suport for >26 volumes. Signed-off-by: Connor Catlett <[email protected]>
DM treats the prefixes "/dev/xvd" and "/dev/sd" as magic. This leads to a bug where volumes with a prefix starting with "/dev/sd" (for example, "/dev/sdf") will get incorrectly mangled into a "/dev/xvd" form (i.e. converting "/dev/sdf" to "/dev/xvdf"). This will cause a volume that is already mounted and prefixed with "/dev/sd" (for example, a volume manually mounted via the AWS console) to get stuck in an infinite loop as the node will believe it is mounted at the wrong path.
With this change, instead of storing only the end of the path in the inflight and existing volumes map, we instead store the entire device path. The previously leaky abstraction from the allocator to store only the end of the path is contained to the allocator, which has a new parameter for the desired prefix.
This commit also vastly increases the range of paths the allocator can generate from 52 simultaneously mounted volumes to 650.
Signed-off-by: Connor Catlett [email protected]