softlayer / knife-softlayer

Other
25 stars 21 forks source link

"instance.wait_for" method returns timeout. #21

Open urasoko-zz opened 9 years ago

urasoko-zz commented 9 years ago

Already the instance is ready, but "instance.wait_for" method returns timeout. Actually, when the command is waiting for, I can bootstrap on another console. Logs are below.

$ knife softlayer server create -B 0:25 -N chef-server -C 1 --datacenter tok02 -D urasoko.com -H chef-server -O CENTOS_6_64 -R 1024 -r recipe["chef-server"] -VV
INFO: Using configuration from /Users/urasoko/CL/chef-repo/.chef/knife.rb
Launching SoftLayer VM, this may take a few minutes.
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
...........................................................
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/fog-core-1.25.0/lib/fog/core/wait_for.rb:11:in `wait_for': The specified wait_for timeout (600 seconds) was exceeded (Fog::Errors::TimeoutError)
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/fog-core-1.25.0/lib/fog/core/model.rb:66:in `wait_for'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-softlayer-0.3.12/lib/chef/knife/softlayer_server_create.rb:303:in `block in run'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-softlayer-0.3.12/lib/chef/knife/softlayer_server_create.rb:408:in `call'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-softlayer-0.3.12/lib/chef/knife/softlayer_server_create.rb:408:in `block in progress'

Can anybody catch this?

cphrmky commented 9 years ago

@urasoko

I don't see anything where you're injecting a public key to the instance when it's being created.

In the initial release of this plugin I had it reading the random password that SL creates from the API and using that to login once the instance was ready. That has since changed when support was added for RSA key pairs.

Is your problem resolved if you upload at least one key to your SLayer account and run the server create command like this:

knife softlayer server create --ssh-keys 1234,5678 -B 0:25 -N chef-server ...

Of course, you'll need to substitute the values for --ssh-keys argument with the id or ids of keys that are on your SLayer account. For more on this checkout the key pair examples.

urasoko-zz commented 9 years ago

@cphrmky Thx 4 ur reply. I added "-S" parameter but not fix... (Of course I could login at another console with no pass.) Won't you need any more info?

$ knife softlayer key pair list
  +--------+-----------+---------------------------+-------------+
  | id     | label     | create_date               | modify_date |
  +--------+-----------+---------------------------+-------------+
...
  +--------+-----------+---------------------------+-------------+
  | 144916 | h-urasoko | 2015-01-28T19:39:11+09:00 |             |
  +--------+-----------+---------------------------+-------------+

$ knife softlayer server create -B 0:25 -N chef-server -C 1 --datacenter tok02 -D urasoko.com -H chef-server -O CENTOS_6_64 -R 1024 -r recipe["chef-server"] -S 144916  -VV
INFO: Using configuration from /Users/urasoko/CL/chef-repo/.chef/knife.rb
Launching SoftLayer VM, this may take a few minutes.
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
............................................................................
......................................................................
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/fog-core-1.25.0/lib/fog/core/wait_for.rb:11:in `wait_for': The specified wait_for timeout (600 seconds) was exceeded (Fog::Errors::TimeoutError)
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/fog-core-1.25.0/lib/fog/core/model.rb:66:in `wait_for'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-softlayer-0.3.12/lib/chef/knife/softlayer_server_create.rb:303:in `block in run'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-softlayer-0.3.12/lib/chef/knife/softlayer_server_create.rb:408:in `call'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-softlayer-0.3.12/lib/chef/knife/softlayer_server_create.rb:408:in `block in progress'
dodizzle commented 9 years ago

I am having the same issue where the server is created but the bootstrap fails to connect. I'm trying to debug this now but haven't been able to find the root cause.

dodizzle commented 9 years ago

I don't think its getting the public ip back when the instance is requested or at least when I print instance in softlayer_server_create.rb its missing the ip address. The next line is using the instance object to wait determine if it up. Hard to do if it doesn't have a public ip address.

This is what the instance object contains.

<Fog::Compute::Softlayer::Server id=XXXXX, name="cccc", domain="XXXXX.com", fqdn="cccc.XXXX.com", cpu=2, ram=2048, disk=nil, private_ip_address=nil, public_ip_address=nil, flavor_id=nil, bare_metal=nil, os_code=nil, image_id="XXXXXX-XXXX-XXXX-XXXXX-XXXXX", ephemeral_storage=true, key_pairs=nil, network_components=[], created_at=nil, last_verified_date=nil, metric_poll_date=nil, modify_date=nil, account_id=XXXXX, datacenter="dal05", single_tenant=nil, global_identifier=nil, hourly_billing_flag=true, tags=nil, private_network_only=nil, user_data=nil, uid=nil

cphrmky commented 9 years ago

@urasoko @dodizzle ,

Thanks for the feedback, sorry for the delay. I'll look into this and try to replicate.

erkolson commented 9 years ago

I'm also seeing this same behavior with a private-network-only => true. I have my ssh config set up to proxy through a public host into the right subnet. From the command line I can seamlessly ssh to the new ip address using the same ssh-user, ssh-key, and identity file used in the "knife softlayer server create ..." command.

Any suggestions for debugging this? The debug flag does not seem to add any additional information.