From 5c54b832dc21858aa283f95b9e7d5c6abb521d79 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Fri, 30 May 2008 10:52:21 +0000 Subject: [PATCH] LURemoveInstance: fix op.ignore_failures usage Currently: the LURemoveInstance.Exec() method uses the ignore_failures attribute of the OpRemoveInstance opcode, but it doesn't check for its existence. The patch adds this attribute to _OP_REQP and to all the places where this opcode was created. This attributes is always passed by gnt-instance, but burnin didn't pass it so it can fail if it enters the 'fail to remove disks' branch of the method (which is why it was not triggered until now). Reviewed-by: ultrotter, imsnah --- lib/cmdlib.py | 2 +- tools/burnin | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 9008862ac..4fc15dd7f 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2662,7 +2662,7 @@ class LURemoveInstance(LogicalUnit): """ HPATH = "instance-remove" HTYPE = constants.HTYPE_INSTANCE - _OP_REQP = ["instance_name"] + _OP_REQP = ["instance_name", "ignore_failures"] def BuildHooksEnv(self): """Build hooks env. diff --git a/tools/burnin b/tools/burnin index c97e4ac24..073720e74 100755 --- a/tools/burnin +++ b/tools/burnin @@ -291,7 +291,8 @@ class Burner(object): exp_op = opcodes.OpExportInstance(instance_name=instance, target_node=enode, shutdown=True) - rem_op = opcodes.OpRemoveInstance(instance_name=instance) + rem_op = opcodes.OpRemoveInstance(instance_name=instance, + ignore_failures=True) nam_op = opcodes.OpQueryInstances(output_fields=["name"], names=[instance]) full_name = self.ExecOp(nam_op)[0][0] @@ -356,7 +357,8 @@ class Burner(object): def Remove(self): """Remove the instances.""" for instance in self.to_rem: - op = opcodes.OpRemoveInstance(instance_name=instance) + op = opcodes.OpRemoveInstance(instance_name=instance, + ignore_failures=True) Log("- Remove instance %s" % instance) self.ExecOp(op) -- GitLab