Ask Your Question
0

how to add a keypair into a instance with Openstack API?

asked 2013-02-28 20:29:20 -0500

danielnuneze gravatar image

Hi Stackers

I want to manage the server creation with OpenStack API. I follow this reference http://docs.openstack.org/api/openstack-compute/programmer/content/booting-a-new-server.html (http://docs.openstack.org/api/opensta...) . This script boot a instances properly but it create an ip in each network and without keypair. How can I manage the network and keypair with OpenStack API?

Thanks alot

edit retag flag offensive close merge delete

4 answers

Sort by ยป oldest newest most voted
0

answered 2013-03-02 03:15:50 -0500

zzs gravatar image

IMHO, using "key_name" attribute.

edit flag offensive delete link more
0

answered 2013-03-02 17:55:41 -0500

danielnuneze gravatar image

Thanks Jason

I have been create "millave" in the keypair list

nova keypair-list

+-----------+------------------------------------------------------------------------+ | Name | Fingerprint | +-----------+------------------------------------------------------------------------+ | millave | 56:91:41:b3:5c:38:61:66:42:5f:21:ce:bd:43:cc:57 | +-----------+------------------------------------------------------------------------+

I try put the key_name attribute in metadata parameters so:

sMetadata = {"function":"MTA y Webmail", "key_name":"millave", "admin":"Daniel Nunez"} s = { "server": { "name": sname, "imageRef": str(sImageRef), "flavorRef": str(sFlavorRef), "metadata": sMetadata, "personality": sPersonality } } sj = json.dumps(s) params4 = sj headers4 = { "X-Auth-Token":apitoken, "Content-type":"application/json" }

conn4 = httplib.HTTPConnection(apiurlt[1]) conn4.request("POST", "%s/servers" % apiurl, params4, headers4)

But this manner don't injected the key in the instance. how should I do it?

edit flag offensive delete link more
0

answered 2013-03-04 04:40:32 -0500

danielnuneze gravatar image

Thanks Jason Zhang, that solved my question.

edit flag offensive delete link more
0

answered 2013-03-04 04:41:25 -0500

danielnuneze gravatar image

Thanks

I solve the problem, is not a metadata parameter, is a server parameter.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2013-02-28 20:29:20 -0500

Seen: 159 times

Last updated: Mar 04 '13