From 618fdc6133128a9db161debd5309c244459dc5e9 Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Wed, 29 Apr 2015 14:45:33 +0800 Subject: [PATCH] Fix vm_by_host bug When get the vm from the host,It shoud skip the vms of which the state is not 'active'.Because the error one can't be migrated. Change-Id: I56c3d9d00f521a909f17f8c63cf9d5a9f5d77144 --- neat/globals/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neat/globals/manager.py b/neat/globals/manager.py index 44af1d2..35bda9b 100644 --- a/neat/globals/manager.py +++ b/neat/globals/manager.py @@ -704,7 +704,7 @@ def vms_by_host(nova, host): :rtype: list(str) """ return [str(vm.id) for vm in nova.servers.list() - if vm_hostname(vm) == host] + if (vm_hostname(vm) == host and str(getattr(vm, 'OS-EXT-STS:vm_state')) == 'active')] @contract