Error with keypair while creating a VM via blueprint: Invalid key_name provided

622 views
Skip to first unread message

Roberto Bandini

unread,
Dec 19, 2015, 7:05:35 AM12/19/15
to cloudify-users, Federica Paganelli, Ing. Francesca Paradiso
Hi,

I tried to create a simple blueprint to build a node with a VM:

tosca_definitions_version: cloudify_dsl_1_0

imports:

node_templates:

  test_1_host:
    type: cloudify.openstack.nodes.Server
    properties:
      image: 4f413a7d-9116-406b-ba79-10113e805e18
      flavor: 3
      server:
        key_name: testKey1

If I don't set server and key_name I don't have any problem.
I would like to try to set an existing keypair as VM keypair.
I tried to do the same via Openstack dashboard and everything it's ok.
I'm getting the following error using that blueprint:

(Cloudify) D:\Programmi\Cloudify\working_dir_cl3\blueprints\test_2>cfy events li
st --include-logs --execution-id 99c089c4-0b2f-4856-bfe6-90fa9b168a26
Getting events from management server 128.104.223.153 for execution id '99c089c4
-0b2f-4856-bfe6-90fa9b168a26' [include_logs=True]
2015-12-19T11:56:13 CFY <test_2> Starting 'install' workflow execution
2015-12-19T11:56:13 CFY <test_2> [test_1_host_5dad0] Creating node
2015-12-19T11:56:14 CFY <test_2> [test_1_host_5dad0.create] Sending task 'nova_p
lugin.server.create'
2015-12-19T11:56:14 CFY <test_2> [test_1_host_5dad0.create] Task started 'nova_p
lugin.server.create'
2015-12-19T11:56:14 LOG <test_2> [test_1_host_5dad0.create] INFO: Transformed re
source name 'server_test_2_test_1_host_5dad0' to 'cloudifyserver_test_2_test_1_h
ost_5dad0'
2015-12-19T11:56:16 LOG <test_2> [test_1_host_5dad0.create] INFO: Transformed re
source name 'testKey1' to 'cloudifytestKey1'
2015-12-19T11:56:16 LOG <test_2> [test_1_host_5dad0.create] INFO: Creating VM wi
th parameters: {'name': u'cloudifyserver_test_2_test_1_host_5dad0', u'key_name':
 u'cloudifytestKey1', 'image': u'4f413a7d-9116-406b-ba79-10113e805e18', 'meta':
{'cloudify_management_network_name': u'cloudify-management-network', 'cloudify_m
anagement_network_id': u'7c334e37-84a8-4d38-b99a-437de6e8087b'}, 'nics': [{'net-
id': u'7c334e37-84a8-4d38-b99a-437de6e8087b'}], 'flavor': 3, 'security_groups':
[u'cloudify-sg-agents']}
2015-12-19T11:56:16 LOG <test_2> [test_1_host_5dad0.create] ERROR: Exception rai
sed on operation [nova_plugin.server.create] invocation
Traceback (most recent call last):
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/cloudify/dec
orators.py", line 125, in wrapper
    result = func(*args, **kwargs)
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/openstack_pl
ugin_common/__init__.py", line 535, in wrapper
    _re_raise(e, recoverable=False, status_code=e.code)
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/openstack_pl
ugin_common/__init__.py", line 530, in wrapper
    return f(*args, **kw)
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/openstack_pl
ugin_common/__init__.py", line 515, in wrapper
    return f(*args, **kw)
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/nova_plugin/
server.py", line 246, in create
    s = nova_client.servers.create(**server)
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/novaclient/v
2/servers.py", line 926, in create
    **boot_kwargs)
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/novaclient/v
2/servers.py", line 540, in _boot
    return_raw=return_raw, **kwargs)
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/novaclient/b
ase.py", line 161, in _create
    _resp, body = self.api.client.post(url, body=body)
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/novaclient/c
lient.py", line 454, in post
    return self._cs_request(url, 'POST', **kwargs)
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/novaclient/c
lient.py", line 429, in _cs_request
    resp, body = self._time_request(url, method, **kwargs)
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/novaclient/c
lient.py", line 402, in _time_request
    resp, body = self.request(url, method, **kwargs)
  File "/root/cloudify.test_2/env/local/lib/python2.7/site-packages/novaclient/c
lient.py", line 396, in request
    raise exceptions.from_response(resp, body, url, method)
NonRecoverableError: Invalid key_name provided. [status_code=400]
2015-12-19T11:56:16 CFY <test_2> [test_1_host_5dad0.create] Task failed 'nova_pl
ugin.server.create' -> NonRecoverableError('Invalid key_name provided. [status_c
ode=400]',) [attempt 1]
2015-12-19T11:56:17 CFY <test_2> 'install' workflow execution failed: RuntimeErr
or: Workflow failed: Task failed 'nova_plugin.server.create' -> NonRecoverableEr
ror('Invalid key_name provided. [status_code=400]',)

Total events: 10

What could be the problem?

I have that keypair in my Openstack. I've read a previous post about this error here, but I don't know it it's the same errore, I think that I'm always using the same admin user. I attach to this post a screenshot to let you see that the kaypair is present.

Thank you,

Roberto
testkey.jpg

Roberto Bandini

unread,
Dec 19, 2015, 12:29:44 PM12/19/15
to cloudify-users, federica....@unifi.it, francesca...@unifi.it
Hi,

I read about the "transformed resource" in the log and so I tried to create a "cloudifytestKey1" but I have the same error.
Even if I use input, args ecc that's the same:

test_2_host:
    type: cloudify.openstack.nodes.Server
    properties:
      image: 4f413a7d-9116-406b-ba79-10113e805e18
      flavor: 3
    interfaces:
      cloudify.interfaces.lifecycle:
        create:
          inputs:
            args:
              key_name: testKey1

"testKey1" in the blueprint and "cloudifytestKey1" in the keypairs list, cause the "resource transformation"... but same error: invalid key_name.

Where am I wrong?

Thank you,

Roberto

Roberto Bandini

unread,
Dec 19, 2015, 1:08:13 PM12/19/15
to cloudify-users, federica....@unifi.it, francesca...@unifi.it
Hi, 

sorry, I've found that it's the same problem that I've read in the previous post:
https://groups.google.com/forum/#!topic/cloudify-users/7GVeKfUtlLQ

Infact, on Cloudlab.us you have an "admin" user to usually login in Openstack dashboard and an "adminapi" user used during Cloudify bootstrap and so on.
So, I created a keypair with admin user on dashboard and "adminapi" user, via blueprint can't see that keypair.

Thank you anyway,

Roberto

Il giorno sabato 19 dicembre 2015 13:05:35 UTC+1, Roberto Bandini ha scritto:
Reply all
Reply to author
Forward
0 new messages