Commit 3b08cd1c authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Iustin Pop
Browse files

Introduce constants.DTS_MAY_ADOPT



DTS_MAY_ADOPT include disk templates that may use disk adoption and will be
used in all respective checks.
Signed-off-by: default avatarApollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent f8f590c8
......@@ -6391,9 +6391,10 @@ class LUCreateInstance(LogicalUnit):
raise errors.OpPrereqError("Either all disks are adopted or none is",
errors.ECODE_INVAL)
if has_adopt:
if self.op.disk_template != constants.DT_PLAIN:
raise errors.OpPrereqError("Disk adoption is only supported for the"
" 'plain' disk template",
if self.op.disk_template not in constants.DTS_MAY_ADOPT:
raise errors.OpPrereqError("Disk adoption is not supported for the"
" '%s' disk template" %
self.op.disk_template,
errors.ECODE_INVAL)
if self.op.iallocator is not None:
raise errors.OpPrereqError("Disk adoption not allowed with an"
......
......@@ -325,6 +325,9 @@ DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE])
# the set of disk templates which can be grown
DTS_GROWABLE = frozenset([DT_PLAIN, DT_DRBD8, DT_FILE])
# the set of disk templates that allow adoption
DTS_MAY_ADOPT = frozenset([DT_PLAIN])
# logical disk types
LD_LV = "lvm"
LD_DRBD8 = "drbd8"
......
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