Revision 7c848a6a lib/cmdlib/instance_storage.py
b/lib/cmdlib/instance_storage.py | ||
---|---|---|
519 | 519 |
return disks |
520 | 520 |
|
521 | 521 |
|
522 |
def CheckSpindlesExclusiveStorage(diskdict, es_flag): |
|
522 |
def CheckSpindlesExclusiveStorage(diskdict, es_flag, required):
|
|
523 | 523 |
"""Check the presence of the spindle options with exclusive_storage. |
524 | 524 |
|
525 | 525 |
@type diskdict: dict |
526 | 526 |
@param diskdict: disk parameters |
527 | 527 |
@type es_flag: bool |
528 | 528 |
@param es_flag: the effective value of the exlusive_storage flag |
529 |
@type required: bool |
|
530 |
@param required: whether spindles are required or just optional |
|
529 | 531 |
@raise errors.OpPrereqError when spindles are given and they should not |
530 | 532 |
|
531 | 533 |
""" |
... | ... | |
534 | 536 |
raise errors.OpPrereqError("Spindles in instance disks cannot be specified" |
535 | 537 |
" when exclusive storage is not active", |
536 | 538 |
errors.ECODE_INVAL) |
539 |
if (es_flag and required and (constants.IDISK_SPINDLES not in diskdict or |
|
540 |
diskdict[constants.IDISK_SPINDLES] is None)): |
|
541 |
raise errors.OpPrereqError("You must specify spindles in instance disks" |
|
542 |
" when exclusive storage is active", |
|
543 |
errors.ECODE_INVAL) |
|
537 | 544 |
|
538 | 545 |
|
539 | 546 |
class LUInstanceRecreateDisks(LogicalUnit): |
... | ... | |
787 | 794 |
rpc.GetExclusiveStorageForNodeNames(self.cfg, nodes).values() |
788 | 795 |
) |
789 | 796 |
for new_params in self.disks.values(): |
790 |
CheckSpindlesExclusiveStorage(new_params, excl_stor) |
|
797 |
CheckSpindlesExclusiveStorage(new_params, excl_stor, False)
|
|
791 | 798 |
|
792 | 799 |
def Exec(self, feedback_fn): |
793 | 800 |
"""Recreate the disks. |
Also available in: Unified diff