Commit b05f29a6 authored by Guido Trotter's avatar Guido Trotter
Browse files

burnin.ExecOrQueue: remove variable argument list



In order to later add an optional parameter we transform the variable
ops argument list in an explicit list.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent fe7c59d5
...@@ -347,13 +347,13 @@ class Burner(object): ...@@ -347,13 +347,13 @@ class Burner(object):
self._SetDebug(ops) self._SetDebug(ops)
return self.MaybeRetry(rval, "opcode", self._ExecOp, *ops) return self.MaybeRetry(rval, "opcode", self._ExecOp, *ops)
def ExecOrQueue(self, name, *ops): def ExecOrQueue(self, name, ops):
"""Execute an opcode and manage the exec buffer.""" """Execute an opcode and manage the exec buffer."""
if self.opts.parallel: if self.opts.parallel:
self._SetDebug(ops) self._SetDebug(ops)
self.queued_ops.append((ops, name)) self.queued_ops.append((ops, name))
else: else:
return self.ExecOp(self.queue_retry, *ops) return self.ExecOp(self.queue_retry, *ops) # pylint: disable-msg=W0142
def StartBatch(self, retry): def StartBatch(self, retry):
"""Start a new batch of jobs. """Start a new batch of jobs.
...@@ -544,7 +544,7 @@ class Burner(object): ...@@ -544,7 +544,7 @@ class Burner(object):
hvparams=self.hvp, hvparams=self.hvp,
) )
self.ExecOrQueue(instance, op) self.ExecOrQueue(instance, [op])
self.to_rem.append(instance) self.to_rem.append(instance)
@_DoBatch(False) @_DoBatch(False)
...@@ -558,7 +558,7 @@ class Burner(object): ...@@ -558,7 +558,7 @@ class Burner(object):
op = opcodes.OpGrowDisk(instance_name=instance, disk=idx, op = opcodes.OpGrowDisk(instance_name=instance, disk=idx,
amount=growth, wait_for_sync=True) amount=growth, wait_for_sync=True)
Log("increase disk/%s by %s MB", idx, growth, indent=2) Log("increase disk/%s by %s MB", idx, growth, indent=2)
self.ExecOrQueue(instance, op) self.ExecOrQueue(instance, [op])
@_DoBatch(True) @_DoBatch(True)
def BurnReplaceDisks1D8(self): def BurnReplaceDisks1D8(self):
...@@ -574,7 +574,7 @@ class Burner(object): ...@@ -574,7 +574,7 @@ class Burner(object):
early_release=self.opts.early_release) early_release=self.opts.early_release)
Log("run %s", mode, indent=2) Log("run %s", mode, indent=2)
ops.append(op) ops.append(op)
self.ExecOrQueue(instance, *ops) # pylint: disable-msg=W0142 self.ExecOrQueue(instance, ops)
@_DoBatch(True) @_DoBatch(True)
def BurnReplaceDisks2(self): def BurnReplaceDisks2(self):
...@@ -598,7 +598,7 @@ class Burner(object): ...@@ -598,7 +598,7 @@ class Burner(object):
disks=[], disks=[],
early_release=self.opts.early_release) early_release=self.opts.early_release)
Log("run %s %s", mode, msg, indent=2) Log("run %s %s", mode, msg, indent=2)
self.ExecOrQueue(instance, op) self.ExecOrQueue(instance, [op])
@_DoCheckInstances @_DoCheckInstances
@_DoBatch(False) @_DoBatch(False)
...@@ -609,7 +609,7 @@ class Burner(object): ...@@ -609,7 +609,7 @@ class Burner(object):
Log("instance %s", instance, indent=1) Log("instance %s", instance, indent=1)
op = opcodes.OpFailoverInstance(instance_name=instance, op = opcodes.OpFailoverInstance(instance_name=instance,
ignore_consistency=False) ignore_consistency=False)
self.ExecOrQueue(instance, op) self.ExecOrQueue(instance, [op])
@_DoCheckInstances @_DoCheckInstances
@_DoBatch(False) @_DoBatch(False)
...@@ -622,7 +622,7 @@ class Burner(object): ...@@ -622,7 +622,7 @@ class Burner(object):
Log("instance %s", instance, indent=1) Log("instance %s", instance, indent=1)
op = opcodes.OpMoveInstance(instance_name=instance, op = opcodes.OpMoveInstance(instance_name=instance,
target_node=tnode) target_node=tnode)
self.ExecOrQueue(instance, op) self.ExecOrQueue(instance, [op])
@_DoBatch(False) @_DoBatch(False)
def BurnMigrate(self): def BurnMigrate(self):
...@@ -636,7 +636,7 @@ class Burner(object): ...@@ -636,7 +636,7 @@ class Burner(object):
op2 = opcodes.OpMigrateInstance(instance_name=instance, live=True, op2 = opcodes.OpMigrateInstance(instance_name=instance, live=True,
cleanup=True) cleanup=True)
Log("migration and migration cleanup", indent=2) Log("migration and migration cleanup", indent=2)
self.ExecOrQueue(instance, op1, op2) self.ExecOrQueue(instance, [op1, op2])
@_DoCheckInstances @_DoCheckInstances
@_DoBatch(False) @_DoBatch(False)
...@@ -703,7 +703,7 @@ class Burner(object): ...@@ -703,7 +703,7 @@ class Burner(object):
Log("remove instance", indent=2) Log("remove instance", indent=2)
Log(import_log_msg, indent=2) Log(import_log_msg, indent=2)
Log("remove export", indent=2) Log("remove export", indent=2)
self.ExecOrQueue(instance, exp_op, rem_op, imp_op, erem_op) self.ExecOrQueue(instance, [exp_op, rem_op, imp_op, erem_op])
@staticmethod @staticmethod
def StopInstanceOp(instance): def StopInstanceOp(instance):
...@@ -730,7 +730,7 @@ class Burner(object): ...@@ -730,7 +730,7 @@ class Burner(object):
Log("instance %s", instance, indent=1) Log("instance %s", instance, indent=1)
op1 = self.StopInstanceOp(instance) op1 = self.StopInstanceOp(instance)
op2 = self.StartInstanceOp(instance) op2 = self.StartInstanceOp(instance)
self.ExecOrQueue(instance, op1, op2) self.ExecOrQueue(instance, [op1, op2])
@_DoBatch(False) @_DoBatch(False)
def BurnRemove(self): def BurnRemove(self):
...@@ -740,7 +740,7 @@ class Burner(object): ...@@ -740,7 +740,7 @@ class Burner(object):
Log("instance %s", instance, indent=1) Log("instance %s", instance, indent=1)
op = opcodes.OpRemoveInstance(instance_name=instance, op = opcodes.OpRemoveInstance(instance_name=instance,
ignore_failures=True) ignore_failures=True)
self.ExecOrQueue(instance, op) self.ExecOrQueue(instance, [op])
def BurnRename(self): def BurnRename(self):
"""Rename the instances. """Rename the instances.
...@@ -778,7 +778,7 @@ class Burner(object): ...@@ -778,7 +778,7 @@ class Burner(object):
os_type=self.opts.os) os_type=self.opts.os)
Log("reinstall specifying the OS", indent=2) Log("reinstall specifying the OS", indent=2)
op4 = self.StartInstanceOp(instance) op4 = self.StartInstanceOp(instance)
self.ExecOrQueue(instance, op1, op2, op3, op4) self.ExecOrQueue(instance, [op1, op2, op3, op4])
@_DoCheckInstances @_DoCheckInstances
@_DoBatch(True) @_DoBatch(True)
...@@ -794,7 +794,7 @@ class Burner(object): ...@@ -794,7 +794,7 @@ class Burner(object):
ignore_secondaries=False) ignore_secondaries=False)
Log("reboot with type '%s'", reboot_type, indent=2) Log("reboot with type '%s'", reboot_type, indent=2)
ops.append(op) ops.append(op)
self.ExecOrQueue(instance, *ops) # pylint: disable-msg=W0142 self.ExecOrQueue(instance, ops)
@_DoCheckInstances @_DoCheckInstances
@_DoBatch(True) @_DoBatch(True)
...@@ -810,7 +810,7 @@ class Burner(object): ...@@ -810,7 +810,7 @@ class Burner(object):
Log("activate disks when online", indent=2) Log("activate disks when online", indent=2)
Log("activate disks when offline", indent=2) Log("activate disks when offline", indent=2)
Log("deactivate disks (when offline)", indent=2) Log("deactivate disks (when offline)", indent=2)
self.ExecOrQueue(instance, op_act, op_stop, op_act, op_deact, op_start) self.ExecOrQueue(instance, [op_act, op_stop, op_act, op_deact, op_start])
@_DoCheckInstances @_DoCheckInstances
@_DoBatch(False) @_DoBatch(False)
...@@ -828,7 +828,7 @@ class Burner(object): ...@@ -828,7 +828,7 @@ class Burner(object):
op_start = self.StartInstanceOp(instance) op_start = self.StartInstanceOp(instance)
Log("adding a disk", indent=2) Log("adding a disk", indent=2)
Log("removing last disk", indent=2) Log("removing last disk", indent=2)
self.ExecOrQueue(instance, op_add, op_stop, op_rem, op_start) self.ExecOrQueue(instance, [op_add, op_stop, op_rem, op_start])
@_DoBatch(False) @_DoBatch(False)
def BurnAddRemoveNICs(self): def BurnAddRemoveNICs(self):
...@@ -842,7 +842,7 @@ class Burner(object): ...@@ -842,7 +842,7 @@ class Burner(object):
instance_name=instance, nics=[(constants.DDM_REMOVE, {})]) instance_name=instance, nics=[(constants.DDM_REMOVE, {})])
Log("adding a NIC", indent=2) Log("adding a NIC", indent=2)
Log("removing last NIC", indent=2) Log("removing last NIC", indent=2)
self.ExecOrQueue(instance, op_add, op_rem) self.ExecOrQueue(instance, [op_add, op_rem])
def ConfdCallback(self, reply): def ConfdCallback(self, reply):
"""Callback for confd queries""" """Callback for confd queries"""
......
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