Commit aa0b600b authored by Guido Trotter's avatar Guido Trotter

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: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent cab667cc
......@@ -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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment