diff --git a/lib/opcodes.py b/lib/opcodes.py index d0dc45fa6566ca39bf8d6e3694b1639e2ecc042d..959d56b0e212c1d8568f32797fd9652d1a4e015a 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -1340,8 +1340,8 @@ class OpInstanceMultiAlloc(OpCode): type(state)) if "instances" in state: - insts = [OpCode.LoadOpCode(inst) for inst in state["instances"]] - state["instances"] = insts + state["instances"] = map(OpCode.LoadOpCode, state["instances"]) + return OpCode.__setstate__(self, state) def Validate(self, set_defaults): diff --git a/test/ganeti.opcodes_unittest.py b/test/ganeti.opcodes_unittest.py index a5e36d2ab3d16ba17c7747e5e22561bc4a0939ac..c310ecc6cb7b60fafae149f537917ca1677f0058 100755 --- a/test/ganeti.opcodes_unittest.py +++ b/test/ganeti.opcodes_unittest.py @@ -297,7 +297,6 @@ class TestOpcodes(unittest.TestCase): self.assertEqual(op.value2, "world") self.assertEqual(op.debug_level, 123) - def testOpInstanceMultiAlloc(self): inst = dict([(name, []) for name in opcodes.OpInstanceCreate.GetAllSlots()]) inst_op = opcodes.OpInstanceCreate(**inst)