Revision e3443b36 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
2604 | 2604 |
return disks_info |
2605 | 2605 |
|
2606 | 2606 |
|
2607 |
def _AssembleInstanceDisks(lu, instance, ignore_secondaries=False): |
|
2607 |
def _AssembleInstanceDisks(lu, instance, ignore_secondaries=False, |
|
2608 |
ignore_size=False): |
|
2608 | 2609 |
"""Prepare the block devices for an instance. |
2609 | 2610 |
|
2610 | 2611 |
This sets up the block devices on all nodes. |
... | ... | |
2616 | 2617 |
@type ignore_secondaries: boolean |
2617 | 2618 |
@param ignore_secondaries: if true, errors on secondary nodes |
2618 | 2619 |
won't result in an error return from the function |
2620 |
@type ignore_size: boolean |
|
2621 |
@param ignore_size: if true, the current known size of the disk |
|
2622 |
will not be used during the disk activation, useful for cases |
|
2623 |
when the size is wrong |
|
2619 | 2624 |
@return: False if the operation failed, otherwise a list of |
2620 | 2625 |
(host, instance_visible_name, node_visible_name) |
2621 | 2626 |
with the mapping from node devices to instance devices |
... | ... | |
2636 | 2641 |
# 1st pass, assemble on all nodes in secondary mode |
2637 | 2642 |
for inst_disk in instance.disks: |
2638 | 2643 |
for node, node_disk in inst_disk.ComputeNodeTree(instance.primary_node): |
2644 |
if ignore_size: |
|
2645 |
node_disk = node_disk.Copy() |
|
2646 |
node_disk.UnsetSize() |
|
2639 | 2647 |
lu.cfg.SetDiskID(node_disk, node) |
2640 | 2648 |
result = lu.rpc.call_blockdev_assemble(node, node_disk, iname, False) |
2641 | 2649 |
msg = result.RemoteFailMsg() |
... | ... | |
2653 | 2661 |
for node, node_disk in inst_disk.ComputeNodeTree(instance.primary_node): |
2654 | 2662 |
if node != instance.primary_node: |
2655 | 2663 |
continue |
2664 |
if ignore_size: |
|
2665 |
node_disk = node_disk.Copy() |
|
2666 |
node_disk.UnsetSize() |
|
2656 | 2667 |
lu.cfg.SetDiskID(node_disk, node) |
2657 | 2668 |
result = lu.rpc.call_blockdev_assemble(node, node_disk, iname, True) |
2658 | 2669 |
msg = result.RemoteFailMsg() |
Also available in: Unified diff