From a223bf4d6104aa16aa11f8ff029ef42cc4d99e40 Mon Sep 17 00:00:00 2001 From: isaac-hammes Date: Thu, 7 Sep 2023 12:47:58 -0700 Subject: [PATCH] (RE-15750) Handle vm no longer existing when attempting to migrate. --- lib/vmpooler/providers/vsphere.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/vmpooler/providers/vsphere.rb b/lib/vmpooler/providers/vsphere.rb index c174448..efd3c9f 100644 --- a/lib/vmpooler/providers/vsphere.rb +++ b/lib/vmpooler/providers/vsphere.rb @@ -1103,6 +1103,9 @@ module Vmpooler begin connection = ensured_vsphere_connection(pool_object) vm_hash = get_vm_details(pool_name, vm_name, connection) + + raise StandardError, 'failed to get vm details. vm is unreachable or no longer exists' if vm_hash.nil? + @redis.with_metrics do |redis| redis.hset("vmpooler__vm__#{vm_name}", 'host', vm_hash['host_name']) migration_count = redis.scard('vmpooler__migration')