lib/vmpooler/providers/vsphere.rb
# The connection_pool method is normally used only for testing
The connection_pool method is normally used only for testing
The connection_pool method is normally used only for testing
def migrate_vm_to_new_host(pool_name, vm_name, vm_hash, connection)
          @redis.with_metrics do |redis|
            redis.sadd('vmpooler__migration', vm_name)
          end
          target_host_name = select_next_host(pool_name, @provider_hosts, vm_hash['architecture'])
          target_host_object = find_host_by_dnsname(connection, target_host_name)
          finish = migrate_vm_and_record_timing(pool_name, vm_name, vm_hash, target_host_object, target_host_name)
          @redis.with_metrics do |redis|
            redis.multi
            redis.hset("vmpooler__vm__#{vm_name}", 'host', target_host_name)
            redis.hset("vmpooler__vm__#{vm_name}", 'migrated', true)
            redis.exec
          end
          logger.log('s', "[>] [#{pool_name}] '#{vm_name}' migrated from #{vm_hash['host_name']} to #{target_host_name} in #{finish} seconds")
        ensure
          @redis.with_metrics do |redis|
            redis.srem('vmpooler__migration', vm_name)
          end
        end
def migrate_vm_to_new_host ( pool_name , vm_name , vm_hash , connection ) @redis . with_metrics do | redis | redis . sadd ( 'vmpooler__migration' , vm_name ) end target_host_name = select_next_host ( pool_name , @provider_hosts , vm_hash [ 'architecture' ] ) target_host_object = find_host_by_dnsname ( connection , target_host_name ) finish = migrate_vm_and_record_timing ( pool_name , vm_name , vm_hash , target_host_object , target_host_name ) @redis . with_metrics do | redis | redis . multi redis . hset ( "vmpooler__vm__#{vm_name}" , 'host' , target_host_name ) redis . hset ( "vmpooler__vm__#{vm_name}" , 'migrated' , true ) redis . exec end logger . log ( 's' , "[>] [#{pool_name}] '#{vm_name}' migrated from #{vm_hash['host_name']} to #{target_host_name} in #{finish} seconds" ) ensure @redis . with_metrics do | redis | redis . srem ( 'vmpooler__migration' , vm_name ) end end
The connection_pool method is normally used only for testing
The connection_pool method is normally used only for testing
pool_name
vm_name
vm_hash
connection