Commit 7df43a76 authored by Iustin Pop's avatar Iustin Pop
Browse files

Relax replace_disks_all meaning for drbd8

In order to make the replace secondary action to be done via the same
opcode parameters for both remote_raid1 and drbd, we must allow the
LUReplaceDisks to change replace_disks_all for drbd with non-empty
remote_node into replace_disks_sec.

This fixes gnt-node evacuate and also allows gnt-instace replace-disks
to have the same syntax for both remote_raid1 and drbd (when replacing
the secondary).

Reviewed-by: ultrotter
parent 59885275
......@@ -3329,6 +3329,7 @@ class LUReplaceDisks(LogicalUnit):
raise errors.OpPrereqError("Instance '%s' not known" %
self.instance = instance
self.op.instance_name =
if instance.disk_template not in constants.DTS_NET_MIRROR:
raise errors.OpPrereqError("Instance's disk layout is not"
......@@ -3367,6 +3368,11 @@ class LUReplaceDisks(LogicalUnit):
raise errors.OpPrereqError("Template 'remote_raid1' only allows all"
" disks replacement, not individual ones")
if instance.disk_template == constants.DT_DRBD8:
if (self.op.mode == constants.REPLACE_DISK_ALL and
remote_node is not None):
# switch to replace secondary mode
self.op.mode = constants.REPLACE_DISK_SEC
if self.op.mode == constants.REPLACE_DISK_ALL:
raise errors.OpPrereqError("Template 'drbd8' only allows primary or"
" secondary disk replacement, not"
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