diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py
index <HASH>..<HASH> 100644
--- a/pyghmi/ipmi/private/session.py
+++ b/pyghmi/ipmi/private/session.py
@@ -288,7 +288,7 @@ class Session(object):
 
     @classmethod
     def _cleanup(cls):
-        for sesskey in cls.bmc_handlers:
+        for sesskey in list(cls.bmc_handlers):
             session = cls.bmc_handlers[sesskey]
             session.cleaningup = True
             session.logout()
Fix cleanup loop of changing dictionary

The dictionary size can change, causing this loop to
fail.  Fix by wrapping the iterator in a list prior to
iterating.

Change-Id: I<I>dd5b8b<I>e<I>d6fd<I>ab<I>ce<I>d7a