Skip to content

Support diskSizeGb and local SSD when creating an instance on GCE - #496

Closed
phildav wants to merge 9 commits into
apache:trunkfrom
cogniteev:trunk
Closed

phildav wants to merge 9 commits into
apache:trunkfrom
cogniteev:trunk

Conversation

@phildav

@phildav phildav commented Apr 2, 2015

Copy link
Copy Markdown

GCE has options to specify the size of boot disk when creating an instance, as well as adding a local SSD to the instance.
This pull request adds 2 new options in create_node:

  • ex_boot_disk_size_gb to specify the size of the boot disk to create. If not set the default GCE was is used.
  • ex_with_local_ssd to attach a local SSD and specify which interface to use.

@erjohnso

erjohnso commented Apr 2, 2015

Copy link
Copy Markdown
Contributor

Hi @phildav - thanks for the contribution!

As you can see, create_node is becoming quite cluttered and tricky to keep updated with GCE API changes and ensure backwards compatibility. Thats why, in a recent change, I punted on providing new arguments for things like local SSD and instead just allowed for a generic JSON/python argument ex_disks_gce_struct. The idea obviously is to let the programmer specify anything here that the upstream GCE API accepts for disks.

I can understand philosophically in wanting new params for local ssd and disk size, but it's not strictly necessary, correct?

Also, if we go with this pull-request, I'd like to see tests (and rigorous ones) that ensure backwards compatibility.

@phildav

phildav commented Apr 2, 2015

Copy link
Copy Markdown
Author

Hi @erjohnso , thank you for the quick reply.
The reason why I added this into libcloud is that I'm using salt cloud, and it's not aware of ex_disks_gce_struct. Building this structure is not totally obvious since it require to know what gce expects. Although it does not belong to the list of features in common with other clouds, my feeling is that it make sense to have this in libcloud instead of its multiple users.
Let me know which direction you want to go with this PR: write specific tests, rework disk options or close it and wait for a better idea...

@erjohnso

erjohnso commented Apr 2, 2015

Copy link
Copy Markdown
Contributor

Hi @phildav

My preference would be to see salt-cloud extended to support a local-ssd type,

https://github.com/saltstack/salt/blob/develop/salt/cloud/clouds/gce.py#L2047

which I think would be cleaner from a Salt user's perspective (rather than requiring them to specify a new attribute/parameter).

But, this would then require and update to the GCE driver to properly format the ex_disks_gce_struct and adding that to **kwargs before creating the new VM,

https://github.com/saltstack/salt/blob/develop/salt/cloud/clouds/gce.py#L2047

I know it's a bit more work inside salt-cloud, but I do think it's cleaner that way.

wdyt?

@phildav

phildav commented Apr 2, 2015

Copy link
Copy Markdown
Author

Sure it can be done in salt-cloud. But then every client of libcloud who wants to support these options has to know

  • how to build the ex_disks_gce_struct properly
  • resolve diskType and image links with ex_get_disktype and ex_get_image
  • how to build the request to get local SSD to work (took me a few tries).

For what it's worth (I'm not a long time user of libcloud), since it's not trivial to build this ex_disks_gce_struct structure then I would put that code in common.
I agree that create_node may not be the best place if that piece of code gets large, so maybe we can add a helper that creates ex_disks_gce_struct properly in libcloud so it's available for every user ?

@erjohnso

erjohnso commented Apr 6, 2015

Copy link
Copy Markdown
Contributor

@phildav - sorry for the lag.

I'm OK moving forward with your approach to extend libcloud's create() call extended to include local-ssd, but would like to see some stringent tests included. When it comes time to roll this up into salt-cloud, I'd still suggest exposing it as local-ssd to the user as I suggested versus setting a new param.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants