Revision 5d55819e lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
542 | 542 |
errors.ECODE_INVAL) |
543 | 543 |
|
544 | 544 |
|
545 |
def _CheckDiskTemplate(template): |
|
546 |
"""Ensure a given disk template is valid. |
|
547 |
|
|
548 |
""" |
|
549 |
if template not in constants.DISK_TEMPLATES: |
|
550 |
msg = ("Invalid disk template name '%s', valid templates are: %s" % |
|
551 |
(template, utils.CommaJoin(constants.DISK_TEMPLATES))) |
|
552 |
raise errors.OpPrereqError(msg, errors.ECODE_INVAL) |
|
553 |
|
|
554 |
|
|
545 | 555 |
def _ExpandItemName(fn, name, kind): |
546 | 556 |
"""Expand an item name. |
547 | 557 |
|
... | ... | |
5845 | 5855 |
self.op.mode, errors.ECODE_INVAL) |
5846 | 5856 |
|
5847 | 5857 |
# disk template and mirror node verification |
5848 |
if self.op.disk_template not in constants.DISK_TEMPLATES: |
|
5849 |
raise errors.OpPrereqError("Invalid disk template name", |
|
5850 |
errors.ECODE_INVAL) |
|
5858 |
_CheckDiskTemplate(self.op.disk_template) |
|
5851 | 5859 |
|
5852 | 5860 |
if self.op.hypervisor is None: |
5853 | 5861 |
self.op.hypervisor = self.cfg.GetHypervisorType() |
Also available in: Unified diff