Commit 5c54b832 authored by Iustin Pop's avatar Iustin Pop

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
parent bd028152
......@@ -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.
......
......@@ -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)
......
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