From aa0b600b390915a18b63590554e0859be4319d4d Mon Sep 17 00:00:00 2001 From: Guido Trotter Date: Wed, 21 Apr 2010 13:09:41 +0100 Subject: [PATCH] KVM: fix a bug in _TryReadUidFile If the uid pool is not in use _TryReadUidFile will try to return "uid" even if it hasn't tried to read it at all. Signed-off-by: Guido Trotter Reviewed-by: Iustin Pop --- lib/hypervisor/hv_kvm.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 6b74833..1fa6f1e 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -235,13 +235,12 @@ class KVMHypervisor(hv_base.BaseHypervisor): if os.path.exists(uid_file): try: uid = int(utils.ReadFile(uid_file)) + return uid except EnvironmentError: logging.warning("Can't read uid file", exc_info=True) - return None except (TypeError, ValueError): logging.warning("Can't parse uid file contents", exc_info=True) - return None - return uid + return None @classmethod def _RemoveInstanceRuntimeFiles(cls, pidfile, instance_name): -- 1.7.10.4