deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject git commit: Fix Openstack 'stop' behaviour - wasn't setting state correctly
Date Wed, 07 Nov 2012 12:57:20 GMT
Updated Branches:
  refs/heads/master 18917ebab -> 131d53886


Fix Openstack 'stop' behaviour - wasn't setting state correctly

Fixes DTACLOUD_328


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

Branch: refs/heads/master
Commit: 131d5388626eca2092b7e4136efa00b4f2021e9e
Parents: 18917eb
Author: marios <marios@redhat.com>
Authored: Tue Nov 6 10:23:40 2012 +0200
Committer: marios <marios@redhat.com>
Committed: Wed Nov 7 14:55:50 2012 +0200

----------------------------------------------------------------------
 .../drivers/openstack/openstack_driver.rb          |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/131d5388/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
index fc141b5..fef9e39 100644
--- a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
+++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
@@ -190,11 +190,19 @@ module Deltacloud
 
         def destroy_instance(credentials, instance_id)
           os = new_client(credentials)
+          server = instance = nil
           safely do
             server = os.get_server(instance_id)
             server.delete!
-            convert_from_server(server, os.connection.authuser)
           end
+          begin
+            server.populate
+            instance = convert_from_server(server, os.connection.authuser)
+          rescue OpenStack::Exception::ItemNotFound
+            instance = convert_from_server(server, os.connection.authuser)
+            instance.state = "STOPPED"
+          end
+          instance
         end
 
         alias_method :stop_instance, :destroy_instance


Mime
View raw message