You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2013/06/28 11:06:32 UTC

[3/9] git commit: Added 'stop' functionality to ec2 driver

Added 'stop' functionality to ec2 driver

Added new state, added stop method, removed alias.


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/4d62d3c4
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/4d62d3c4
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/4d62d3c4

Branch: refs/heads/master
Commit: 4d62d3c4fdd27164899df41b28b5f964598414ed
Parents: 9ea3eeb
Author: David Ellinger <de...@ltionline.com>
Authored: Mon Apr 29 09:43:59 2013 -0400
Committer: marios <ma...@redhat.com>
Committed: Fri Jun 28 12:05:49 2013 +0300

----------------------------------------------------------------------
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/4d62d3c4/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index f258dfb..b740254 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -132,8 +132,9 @@ module Deltacloud
           running.to( :running )        .on( :reboot )
           running.to( :stopping )       .on( :stop )
           stopping.to(:stopped)         .automatically
-          stopping.to(:finish)          .automatically
-          stopped.to( :finish )         .automatically
+
+          stopped.to(:finish)         .on( :destroy)
+
         end
 
         # We do not allow users to set the endpoint through environment
@@ -319,6 +320,16 @@ module Deltacloud
           end
         end
 
+        def stop_instance(credentials, instance_id)
+          ec2 = new_client(credentials)
+          if ec2.stop_instances([instance_id])
+            instance(credentials, :id => instance_id)
+          else
+            raise Deltacloud::BackendError.new(500, "Instance", "Instance stop failed", "")
+          end
+        end
+
+
         def destroy_instance(credentials, instance_id)
           ec2 = new_client(credentials)
           if ec2.terminate_instances([instance_id])
@@ -328,8 +339,6 @@ module Deltacloud
           end
         end
 
-        alias :stop_instance :destroy_instance
-
         def metrics(credentials, opts={})
           cw = new_client(credentials, :mon)
           metrics_arr = []