+ OP_DSC_FIELD = "duration"
+ __slots__ = OpCode.__slots__ + ["duration", "on_master", "on_nodes"]
+
+
+class OpTestAllocator(OpCode):
+ """Allocator framework testing.
+
+ This opcode has two modes:
+ - gather and return allocator input for a given mode (allocate new
+ or replace secondary) and a given instance definition (direction
+ 'in')
+ - run a selected allocator for a given operation (as above) and
+ return the allocator output (direction 'out')
+
+ """
+ OP_ID = "OP_TEST_ALLOCATOR"
+ OP_DSC_FIELD = "allocator"
+ __slots__ = OpCode.__slots__ + [
+ "direction", "mode", "allocator", "name",
+ "mem_size", "disks", "disk_template",
+ "os", "tags", "nics", "vcpus", "hypervisor",
+ ]
+
+OP_MAPPING = dict([(v.OP_ID, v) for v in globals().values()
+ if (isinstance(v, type) and issubclass(v, OpCode) and
+ hasattr(v, "OP_ID"))])