deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvl...@redhat.com
Subject [PATCH] DTACLOUD-462 - a GET for an instance can fail while a different instance is being destroyed.
Date Fri, 15 Feb 2013 20:43:22 GMT
From: Joe VLcek <jvlcek@redhat.com>

---
 server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
index 65ba26d..9212c26 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
@@ -127,12 +127,13 @@ class RhevmDriver < Deltacloud::BaseDriver
     inst_arr = []
     safely do
       if opts[:id]
-        vms = client.vms(:id => opts[:id])
+        vm = client.vm(opts[:id])
+        inst_arr << convert_instance(client, vm)
       else
         vms = client.vms
-      end
-      vms.each do |vm|
-        inst_arr << convert_instance(client, vm)
+        vms.each do |vm|
+          inst_arr << convert_instance(client, vm)
+        end
       end
     end
     inst_arr = filter_on( inst_arr, :id, opts )
@@ -286,7 +287,7 @@ class RhevmDriver < Deltacloud::BaseDriver
   # UNASSIGNED, DOWN, UP, POWERING_UP, POWERED_DOWN, PAUSED, MIGRATING_FROM,
   # MIGRATING_TO, UNKNOWN, NOT_RESPONDING, WAIT_FOR_LAUNCH, REBOOT_IN_PROGRESS,
   # SAVING_STATE, RESTORING_STATE, SUSPENDED, IMAGE_ILLEGAL,
-  # IMAGE_LOCKED or POWERING_DOWN
+  # IMAGE_LOCKED, MIGRATING or POWERING_DOWN
   #
   def convert_state(state)
     unless state.respond_to?(:upcase)
@@ -295,7 +296,7 @@ class RhevmDriver < Deltacloud::BaseDriver
     state = state.gsub('\\', '').strip.upcase
     return 'PENDING' if ['WAIT_FOR_LAUNCH', 'REBOOT_IN_PROGRESS', 'SAVING_STATE',
                         'RESTORING_STATE', 'POWERING_UP', 'IMAGE_LOCKED', 'SAVING_STATE'].include?
state
-    return 'STOPPING' if state == 'POWERING_DOWN'
+    return 'STOPPING' if ['POWERING_DOWN', 'MIGRATING'].include? state
     return 'STOPPED' if ['UNASSIGNED', 'DOWN', 'NOT_RESPONDING',
                          'IMAGE_ILLEGAL', 'UNKNOWN'].include? state
     return 'RUNNING' if ['UP', 'MIGRATING_TO', 'MIGRATING_FROM'].include? state
-- 
1.7.11.7


Mime
View raw message