From b5a882de6088a5dc1962cd988cc33c3cae10507c Mon Sep 17 00:00:00 2001 From: John Herndon Date: Tue, 19 Feb 2013 22:53:49 +0000 Subject: [PATCH] Flush tokens on instance delete Force console auth service to flush all tokens associated with an instance when it is deleted. This will fix bug 1125378, where the console for the wrong instance can be connected to via the console if the correct circumstances occur. This change also adds a call to validate the token when it is used. This check will ensure that all tokens are valid for their target instances. Tokens can become scrambled when a compute node is restarted, because the virt driver may not assign ports in the same way. Change-Id: I0d83ec6c4dbfef1af912a200ee15f8052f72da96 fixes: bug 1125378 --- nova/common/memorycache.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nova/common/memorycache.py b/nova/common/memorycache.py index f89e4b265..c124784d5 100644 --- a/nova/common/memorycache.py +++ b/nova/common/memorycache.py @@ -83,3 +83,8 @@ class Client(object): new_value = int(value) + delta self.cache[key] = (self.cache[key][0], str(new_value)) return new_value + + def delete(self, key, time=0): + """Deletes the value associated with a key.""" + if key in self.cache: + del self.cache[key]