deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH] Fix Openstack 'stop' behaviour - wasn't setting state correctly
Date Wed, 26 Sep 2012 09:59:24 GMT
From: marios <marios@redhat.com>

thanks to Jan Provaznik

Signed-off-by: marios <marios@redhat.com>
---
 server/lib/deltacloud/drivers/openstack/openstack_driver.rb | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
index 7e11258..1ff6781 100644
--- a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
+++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
@@ -190,11 +190,20 @@ 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
+          ensure
+            instance = convert_from_server(server, os.connection.authuser)
+            instance.state = "STOPPED"
+          end
+          instance
         end
 
         alias_method :stop_instance, :destroy_instance
-- 
1.7.11.4


Mime
View raw message