rackspace / gophercloud

A Go SDK for OpenStack. IN FEATURE FREEZE. See Issue #592
http://gophercloud.io
Other
456 stars 185 forks source link

How to create OpenStack compute instance using keypair name? #624

Open buchanae opened 7 years ago

buchanae commented 7 years ago

There doesn't seem to be any allowance for a keypair name in openstack/servers/CreateOpts. That's surprising.

Looks like the rackspace version has it: https://godoc.org/github.com/rackspace/gophercloud/rackspace/compute/v2/servers#CreateOpts

Did this get forgotten, or is there a different way to do it I'm not seeing?

Thanks!

buchanae commented 7 years ago

Oh, I see, I'm supposed to combine keypairs.CreateOptsExt and servers.CreateOpts? I had to dig up this test code commit to find that, https://github.com/rackspace/gophercloud/commit/476583ff0d5b9903a6633bb822ef5a09f0294409

In that case, I suppose this issue is about making that easier and/or more obvious. Keypair is a core concept and deserves a place in server.CreateOpts, just like the rackspace version.

If you disagree with that suggestion (which I hope you don't) I suggest we at least add an example here: http://gophercloud.io/docs/compute/#create-server

I'm happy to write the code for either option, given someone tells me I'm not crazy.

Thanks!

HeikoOnnebrink commented 7 years ago

just yesterday wrote mail to 'sdk-support@rackspace.com' asking same question. I was searching for KeyPair in the CreateOpts and did not find it .. I also double vote for having this as an CreateOption 👍