-
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
Rackspace improvements (OpenStack Cinder) #22023
Rackspace improvements (OpenStack Cinder) #22023
Conversation
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
2 similar comments
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
I'm currently considering a change in the Instance detection heuristics:
|
The aforementioned heuristic has been added to node address discovery. |
@metral Do you know someone who could help review this? |
@bgrant0607 I can definitely help find someone, if not I can take a stab at it as well |
@@ -1070,6 +1071,21 @@ func (os *OpenStack) CreateVolume(name string, size int, tags *map[string]string | |||
return vol.ID, err | |||
} | |||
|
|||
func (os *OpenStack) GetDevicePath(diskId string) string { | |||
files, _ := ioutil.ReadDir("/dev/disk/by-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.
The usage of the specific device path /dev/disk/by-id/virtio-<UUID>
makes a couple of assumptions:
- That the device in question is from a pure/upstream OpenStack install, and not a Rackspace Public Cloud block device, as Rackspace presents block devices under the path schema
/dev/disk/by-uuid/<UUID>
- And that the block device in question was formatted with a fs type after its creation
- By default a new block device in OpenStack or Rackspace comes clean without a fs on it where the path is
/dev/vd*
on OpenStack and/dev/xvd*
on Rackspace. - Not having a fs on the device at creation, but rather after a user specifically performs
mkfs.ext*
on it, means that the device will not exist in/dev/disk/by-uuid/<UUID>
until after its been formatted with a fs
- By default a new block device in OpenStack or Rackspace comes clean without a fs on it where the path is
I confirmed this today on fresh installs of Ubuntu 15.10, as well as a CoreOS 835.9.0, on the Rackspace Public Cloud.
GetDevicePath
would have to be altered to accommodate for this difference in environment.
Also, see: https://ask.openstack.org/en/question/50882/are-devdiskby-id-symlinks-unreliable/
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.
@metral: thanks for looking at this, GetDevicePath
is actually specific to vanilla OpenStack (os *OpenStack
). It was part of the Cinder volume plugin, which I generalized to make it work with Rackspace as well: https://github.com/kubernetes/kubernetes/pull/22023/files#diff-dcc20522f7683cc42d2cd40a27c2c155L92
For Rackspace I did not find a way to deduct the device via volume-id from the device tree at all, so I am querying the Cinder API for the device, which works fine: https://github.com/kubernetes/kubernetes/pull/22023/files#diff-dcc20522f7683cc42d2cd40a27c2c155L92
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.
For generic openstack: I think it's fine to stick with the same existing code in this change, but I share @metral's concerns about finding unformatted volumes by-uuid. I like the CinderProvider.GetDevicePath
structure you've added to this change, and we should use that in a later change to replace the generic OpenStack logic with something that also uses the cinder API to find the device name (looks like this is GetVolume(diskId).attachments[i].device
, where attachments[i].server_id==our_server_id
in cinder v2 API).
It's probably feasible to try cinder API v2 or v1 depending on what appears to be available, and therefore combine the rackspace+openstack code again. I'm not fussed about whether we do that in this change or not (there are so many other places where the rackspace+openstack providers could share code, that it seems like that's a reasonable project in itself).
@jamiehannaford, care to take a look? |
} | ||
|
||
// Attaches given cinder volume to the compute running kubelet | ||
func (os *Rackspace) AttachDisk(diskName string) (string, error) { |
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.
really minor, but maybe change os
to rs
to avoid ambiguity over providers
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.
elsewhere in this module os
is used, I kept it for consistency, as I don't want to touch a lot of unrelated lines. I'll name it rs
where I touch code, anyway. The naming issues should be addressed in a separate PR i guess.
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.
Yeah, I agree. If you could change os
to rs
in the functions you've added, though, that would be great.
@jrperritt is this something you could also have a look at? I've already left some feedback |
Yes, if there's still interest, I can have a look tomorrow. |
if instanceID == disk.Attachments[0]["server_id"] { | ||
glog.V(4).Infof("Disk: %q is already attached to compute: %q", diskName, instanceID) | ||
return disk.ID, nil | ||
} else { |
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.
Since you're returning either way, you can remove this else
line.
+1 from me. All my comments were stylistic changes (minor, to be sure). |
@@ -1080,6 +1081,21 @@ func (os *OpenStack) CreateVolume(name string, size int, tags *map[string]string | |||
return vol.ID, err | |||
} | |||
|
|||
func (os *OpenStack) GetDevicePath(diskId 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.
Add a GoDoc comment
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
b7f3a98
to
42f2b8b
Compare
LGTM |
189f01f
to
07ecd3d
Compare
@k8s-bot ok to test |
GCE e2e build/test passed for commit 07ecd3dce40768f5b001b5fef0097aab59624304. |
07ecd3d
to
ba4d74f
Compare
GCE e2e build/test passed for commit ba4d74f. |
@saad-ali, sorry I forgot to stage adjusted openstack tests. |
GCE e2e build/test passed for commit ba4d74f. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit ba4d74f. |
Automatic merge from submit-queue |
Automatic merge from submit-queue Rackspace improvements (OpenStack Cinder) This adds PV support via Cinder on Rackspace clusters. Rackspace Cloud Block Storage is pretty much vanilla OpenStack Cinder, so there is no need for a separate Volume Plugin. Instead I refactored the Cinder/OpenStack interaction a bit (by introducing a CinderProvider Interface and moving the device path detection logic to the OpenStack part). Right now this is limited to `AttachDisk` and `DetachDisk`. Creation and deletion of Block Storage is not in scope of this PR. Also the `ExternalID` and `InstanceID` cloud provider methods have been implemented for Rackspace.
This adds PV support via Cinder on Rackspace clusters. Rackspace Cloud Block Storage is pretty much vanilla OpenStack Cinder, so there is no need for a separate Volume Plugin. Instead I refactored the Cinder/OpenStack interaction a bit (by introducing a CinderProvider Interface and moving the device path detection logic to the OpenStack part).
Right now this is limited to
AttachDisk
andDetachDisk
. Creation and deletion of Block Storage is not in scope of this PR.Also the
ExternalID
andInstanceID
cloud provider methods have been implemented for Rackspace.