Revision 51cb1581 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
2519 | 2519 |
" the master, please restart manually: %s", msg) |
2520 | 2520 |
|
2521 | 2521 |
|
2522 |
def _RecursiveCheckIfLVMBased(disk): |
|
2523 |
"""Check if the given disk or its children are lvm-based. |
|
2524 |
|
|
2525 |
@type disk: L{objects.Disk} |
|
2526 |
@param disk: the disk to check |
|
2527 |
@rtype: boolean |
|
2528 |
@return: boolean indicating whether a LD_LV dev_type was found or not |
|
2529 |
|
|
2530 |
""" |
|
2531 |
if disk.children: |
|
2532 |
for chdisk in disk.children: |
|
2533 |
if _RecursiveCheckIfLVMBased(chdisk): |
|
2534 |
return True |
|
2535 |
return disk.dev_type == constants.LD_LV |
|
2536 |
|
|
2537 |
|
|
2538 | 2522 |
class LUSetClusterParams(LogicalUnit): |
2539 | 2523 |
"""Change the parameters of the cluster. |
2540 | 2524 |
|
... | ... | |
2598 | 2582 |
|
2599 | 2583 |
""" |
2600 | 2584 |
if self.op.vg_name is not None and not self.op.vg_name: |
2601 |
instances = self.cfg.GetAllInstancesInfo().values() |
|
2602 |
for inst in instances: |
|
2603 |
for disk in inst.disks: |
|
2604 |
if _RecursiveCheckIfLVMBased(disk): |
|
2605 |
raise errors.OpPrereqError("Cannot disable lvm storage while" |
|
2606 |
" lvm-based instances exist", |
|
2607 |
errors.ECODE_INVAL) |
|
2585 |
if self.cfg.HasAnyDiskOfType(constants.LD_LV): |
|
2586 |
raise errors.OpPrereqError("Cannot disable lvm storage while lvm-based" |
|
2587 |
" instances exist", errors.ECODE_INVAL) |
|
2608 | 2588 |
|
2609 | 2589 |
node_list = self.acquired_locks[locking.LEVEL_NODE] |
2610 | 2590 |
|
Also available in: Unified diff