LURemoveInstance: fix op.ignore_failures usage
authorIustin Pop <iustin@google.com>
Fri, 30 May 2008 10:51:22 +0000 (10:51 +0000)
committerIustin Pop <iustin@google.com>
Fri, 30 May 2008 10:51:22 +0000 (10:51 +0000)
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
tools/burnin

index 09dab44..e2ba9c6 100644 (file)
@@ -2614,7 +2614,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.
index fd1e054..52f6ab7 100755 (executable)
@@ -299,7 +299,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]
@@ -347,7 +348,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)