Closed adamleff closed 9 years ago
@adamleff - Thanks for getting this out so quick! I pulled down your branch, built and installed knife-vcair, and it appears to be creating a VM in my ondemand org. However, just after the creation task is initiated the Fog API errors and returns immediately.
stewartc-mbpro:knife-vcair stewartc$ knife vcair server create --ssh-password ChangeMe --image "CentOS64-64BIT" --node-name centos64 --vcair-net default-routed-network --vcair-show-progress true -VV
INFO: Using configuration from /Users/stewartc/.chef/knife.rb
DEBUG: vcair_username USERNAME
DEBUG: vcair_org MYORG
DEBUG: vcair_api_host MYAPIHOST
DEBUG: vcair_api_path /api/compute/api
DEBUG: vcair_api_version 5.7
DEBUG: vcair_show_progress
DEBUG: Using fog version: 1.31.0
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/fog-1.31.0/lib/fog/vcloud_director/compute.rb:436:in `wait_and_raise_unless_success': status: queued, error: (Fog::Compute::VcloudDirector::TaskError)
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/fog-1.31.0/lib/fog/vcloud_director/compute.rb:425:in `process_task'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/fog-1.31.0/lib/fog/vcloud_director/models/compute/catalog_item.rb:17:in `instantiate'
from /Users/stewartc/.chefdk/gem/ruby/2.1.0/gems/knife-vcair-0.6.1/lib/chef/knife/vcair_server_create.rb:145:in `instantiate'
from /Users/stewartc/.chefdk/gem/ruby/2.1.0/gems/knife-vcair-0.6.1/lib/chef/knife/vcair_server_create.rb:36:in `execute_command'
from /Users/stewartc/.chefdk/gem/ruby/2.1.0/gems/knife-cloud-1.2.0/lib/chef/knife/cloud/command.rb:51:in `run'
from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:422:in `block in run_with_pretty_exceptions'
from /opt/chefdk/embedded/apps/chef/lib/chef/local_mode.rb:39:in `with_server_connectivity'
from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:421:in `run_with_pretty_exceptions'
from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:214:in `run'
from /opt/chefdk/embedded/apps/chef/lib/chef/application/knife.rb:142:in `run'
from /opt/chefdk/embedded/apps/chef/bin/knife:25:in `<top (required)>'
from /usr/bin/knife:51:in `load'
from /usr/bin/knife:51:in `<main>'
I'm currently looking through the stacktrace to see if I can provide additional information or provide any contributions
Well, darn. I will take a deeper look at this tomorrow morning. I didn't encounter this in my testing but I may have missed something. If you find anything more specific, please let me know!
@cstewart87 - I've been able to determine the cause of the issue. In vCloud Air OnDemand, all tasks appear to get created with an initial status of "queued." In Fog, while waiting for a task to complete, it considers any task that is not in a state of "running" to be no longer running:
https://github.com/fog/fog/blob/master/lib/fog/vcloud_director/models/compute/task.rb#L46
Fog should really wait for tasks that are not in a state of "running" OR "queued." I submitted a PR up to the fog repo to address this:
https://github.com/fog/fog/pull/3653
You can feel free to pull down my fog branch and run with it and it should work for you now. I've been able to create multiple vApps/VMs in OnDemand this morning with my patched fog. I'll still get this knife-vcair change cut into a gem hopefully today after a code review as it's still necessary. :)
:+1: :cocktail: :coffee: :rocket: :guardsman: :guitar: :gun: :+1: :100:
:shaved_ice: :100:
The API path is different between Subscription and OnDemand. Specifically, in Subscription it's '/api' while in OnDemand it's '/api/compute/api'.
The Fog gem supports a path override, but knife-vcair did not support collecting and passing the path override. This commit addresses that issue.
Addresses the issue reported in #28.