Commit 668f755d authored by Iustin Pop's avatar Iustin Pop
Browse files

Rename OpReplaceDisks and LUReplaceDisks


Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 5659e2e2
......@@ -761,10 +761,10 @@ def ReplaceDisks(opts, args):
# replace secondary
mode = constants.REPLACE_DISK_CHG
op = opcodes.OpReplaceDisks(instance_name=args[0], disks=disks,
remote_node=new_2ndary, mode=mode,
iallocator=iallocator,
early_release=opts.early_release)
op = opcodes.OpInstanceReplaceDisks(instance_name=args[0], disks=disks,
remote_node=new_2ndary, mode=mode,
iallocator=iallocator,
early_release=opts.early_release)
SubmitOrSend(op, opts)
return 0
......
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -275,10 +275,10 @@ def EvacuateNode(opts, args):
iname = row[0]
node = row[1]
ToStdout("Will relocate instance %s to node %s", iname, node)
op = opcodes.OpReplaceDisks(instance_name=iname,
remote_node=node, disks=[],
mode=constants.REPLACE_DISK_CHG,
early_release=opts.early_release)
op = opcodes.OpInstanceReplaceDisks(instance_name=iname,
remote_node=node, disks=[],
mode=constants.REPLACE_DISK_CHG,
early_release=opts.early_release)
jex.QueueJob(iname, op)
results = jex.GetResults()
bad_cnt = len([row for row in results if not row[0]])
......
......@@ -7745,7 +7745,7 @@ class LUInstanceConsole(NoHooksLU):
return console.ToDict()
class LUReplaceDisks(LogicalUnit):
class LUInstanceReplaceDisks(LogicalUnit):
"""Replace the disks of an instance.
"""
......
......@@ -861,7 +861,7 @@ class OpInstanceReboot(OpCode):
]
class OpReplaceDisks(OpCode):
class OpInstanceReplaceDisks(OpCode):
"""Replace the disks of an instance."""
OP_ID = "OP_INSTANCE_REPLACE_DISKS"
OP_DSC_FIELD = "instance_name"
......
......@@ -433,10 +433,10 @@ class R_2_nodes_name_evacuate(baserlib.R_Generic):
if dry_run:
jid = None
else:
op = opcodes.OpReplaceDisks(instance_name=iname,
remote_node=node, disks=[],
mode=constants.REPLACE_DISK_CHG,
early_release=early_r)
op = opcodes.OpInstanceReplaceDisks(instance_name=iname,
remote_node=node, disks=[],
mode=constants.REPLACE_DISK_CHG,
early_release=early_r)
jid = baserlib.SubmitJob([op])
jobs.append((jid, iname, node))
......@@ -1098,11 +1098,11 @@ class R_2_instances_name_replace_disks(baserlib.R_Generic):
else:
disks = []
op = opcodes.OpReplaceDisks(instance_name=instance_name,
remote_node=remote_node,
mode=mode,
disks=disks,
iallocator=iallocator)
op = opcodes.OpInstanceReplaceDisks(instance_name=instance_name,
remote_node=remote_node,
mode=mode,
disks=disks,
iallocator=iallocator)
return baserlib.SubmitJob([op])
......
......@@ -605,14 +605,15 @@ class Burner(object):
def BurnReplaceDisks1D8(self):
"""Replace disks on primary and secondary for drbd8."""
Log("Replacing disks on the same nodes")
early_release = self.opts.early_release
for instance in self.instances:
Log("instance %s", instance, indent=1)
ops = []
for mode in constants.REPLACE_DISK_SEC, constants.REPLACE_DISK_PRI:
op = opcodes.OpReplaceDisks(instance_name=instance,
mode=mode,
disks=[i for i in range(self.disk_count)],
early_release=self.opts.early_release)
op = opcodes.OpInstanceReplaceDisks(instance_name=instance,
mode=mode,
disks=list(range(self.disk_count)),
early_release=early_release)
Log("run %s", mode, indent=2)
ops.append(op)
self.ExecOrQueue(instance, ops)
......@@ -632,12 +633,12 @@ class Burner(object):
msg = "with iallocator %s" % self.opts.iallocator
else:
msg = tnode
op = opcodes.OpReplaceDisks(instance_name=instance,
mode=mode,
remote_node=tnode,
iallocator=self.opts.iallocator,
disks=[],
early_release=self.opts.early_release)
op = opcodes.OpInstanceReplaceDisks(instance_name=instance,
mode=mode,
remote_node=tnode,
iallocator=self.opts.iallocator,
disks=[],
early_release=self.opts.early_release)
Log("run %s %s", mode, msg, indent=2)
self.ExecOrQueue(instance, [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