From: Michal Fojtik <[email protected]>
Signed-off-by: Michal fojtik <[email protected]> --- .../deltacloud/drivers/vsphere/vsphere_driver.rb | 31 ++++++++----------- 1 files changed, 13 insertions(+), 18 deletions(-) diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb index 9e123e4..6430750 100644 --- a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +++ b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb @@ -60,7 +60,6 @@ module Deltacloud::Drivers::VSphere start.to(:pending) .on( :create ) pending.to(:stopped) .automatically stopped.to(:running) .on( :start ) - running.to(:running) .on( :reboot ) running.to(:shutting_down) .on( :stop ) shutting_down.to(:stopped) .automatically stopped.to(:finish) .on( :destroy ) @@ -199,19 +198,20 @@ module Deltacloud::Drivers::VSphere vm.CloneVM_Task(:folder => vm.parent, :name => opts[:name], :spec => spec) #.wait_for_completion puts "Cloning complete!" # Since task itself is not returning anything, construct Instance from things we already have + Instance::new( + :id => opts[:name], + :name => opts[:name], + :owner_id => credentials.user, + :realm_id => dc.name, + :state => 'RUNNING', + :instance_profile => InstanceProfile::new('default'), + :actions => instance_actions_for( 'RUNNING' ) + ) end - Instance::new( - :id => opts[:name], - :name => opts[:name], - :owner_id => credentials.user, - :realm_id => dc.name, - :state => 'RUNNING', - :instance_profile => InstanceProfile::new('default'), - :actions => instance_actions_for( 'RUNNING' ) - ) end def execute_on_vm(credentials, name) + puts name vsphere = new_client(credentials) safely do rootFolder = vsphere.serviceInstance.content.rootFolder @@ -220,11 +220,6 @@ module Deltacloud::Drivers::VSphere end end - # Reboot an instance, given its id. - def reboot_instance(credentials, id) - execute_on_vm(credentials, id).Reboot - end - # Start an instance, given its id. def start_instance(credentials, id) execute_on_vm(credentials, id).PowerOnVM_Task.wait_for_completion @@ -318,9 +313,9 @@ module Deltacloud::Drivers::VSphere exceptions do - on /Not\ Found/ do - status 404 - end + #on /Not\ Found/ do + # status 404 + #end on /RbVmomi/ do status 502 -- 1.7.4.1
