Revision 3f3ea14c lib/cmdlib/instance_storage.py
b/lib/cmdlib/instance_storage.py | ||
---|---|---|
343 | 343 |
constants.IDISK_NAME: name, |
344 | 344 |
} |
345 | 345 |
|
346 |
if constants.IDISK_METAVG in disk: |
|
347 |
new_disk[constants.IDISK_METAVG] = disk[constants.IDISK_METAVG] |
|
348 |
if constants.IDISK_ADOPT in disk: |
|
349 |
new_disk[constants.IDISK_ADOPT] = disk[constants.IDISK_ADOPT] |
|
346 |
for key in [ |
|
347 |
constants.IDISK_METAVG, |
|
348 |
constants.IDISK_ADOPT, |
|
349 |
constants.IDISK_SPINDLES, |
|
350 |
]: |
|
351 |
if key in disk: |
|
352 |
new_disk[key] = disk[key] |
|
350 | 353 |
|
351 | 354 |
# For extstorage, demand the `provider' option and add any |
352 | 355 |
# additional parameters (ext-params) to the dict |
... | ... | |
515 | 518 |
return disks |
516 | 519 |
|
517 | 520 |
|
521 |
def CheckSpindlesExclusiveStorage(diskdict, es_flag): |
|
522 |
"""Check the presence of the spindle options with exclusive_storage. |
|
523 |
|
|
524 |
@type diskdict: dict |
|
525 |
@param diskdict: disk parameters |
|
526 |
@type es_flag: bool |
|
527 |
@param es_flag: the effective value of the exlusive_storage flag |
|
528 |
@raise errors.OpPrereqError when spindles are given and they should not |
|
529 |
|
|
530 |
""" |
|
531 |
if (not es_flag and constants.IDISK_SPINDLES in diskdict and |
|
532 |
diskdict[constants.IDISK_SPINDLES] is not None): |
|
533 |
raise errors.OpPrereqError("Spindles in instance disks cannot be specified" |
|
534 |
" when exclusive storage is not active", |
|
535 |
errors.ECODE_INVAL) |
|
536 |
|
|
537 |
|
|
518 | 538 |
class LUInstanceRecreateDisks(LogicalUnit): |
519 | 539 |
"""Recreate an instance's missing disks. |
520 | 540 |
|
... | ... | |
758 | 778 |
|
759 | 779 |
assert not self.glm.is_owned(locking.LEVEL_NODE_ALLOC) |
760 | 780 |
|
781 |
if self.op.nodes: |
|
782 |
nodes = self.op.nodes |
|
783 |
else: |
|
784 |
nodes = instance.all_nodes |
|
785 |
excl_stor = compat.any( |
|
786 |
rpc.GetExclusiveStorageForNodeNames(self.cfg, nodes).values() |
|
787 |
) |
|
788 |
for new_params in self.disks.values(): |
|
789 |
CheckSpindlesExclusiveStorage(new_params, excl_stor) |
|
790 |
|
|
761 | 791 |
def Exec(self, feedback_fn): |
762 | 792 |
"""Recreate the disks. |
763 | 793 |
|
Also available in: Unified diff