Revision 4e7f986e lib/cmdlib/instance_storage.py
b/lib/cmdlib/instance_storage.py | ||
---|---|---|
226 | 226 |
info = GetInstanceInfoText(instance) |
227 | 227 |
if target_node_uuid is None: |
228 | 228 |
pnode_uuid = instance.primary_node |
229 |
all_node_uuids = instance.all_nodes
|
|
229 |
all_node_uuids = lu.cfg.GetInstanceNodes(instance, disks=disks)
|
|
230 | 230 |
else: |
231 | 231 |
pnode_uuid = target_node_uuid |
232 | 232 |
all_node_uuids = [pnode_uuid] |
... | ... | |
610 | 610 |
|
611 | 611 |
ial.Run(self.op.iallocator) |
612 | 612 |
|
613 |
assert req.RequiredNodes() == len(self.instance.all_nodes)
|
|
613 |
assert req.RequiredNodes() == len(self.cfg.GetInstanceNodes(self.instance))
|
|
614 | 614 |
|
615 | 615 |
if not ial.success: |
616 | 616 |
raise errors.OpPrereqError("Can't compute nodes using iallocator '%s':" |
... | ... | |
711 | 711 |
"""Build hooks nodes. |
712 | 712 |
|
713 | 713 |
""" |
714 |
nl = [self.cfg.GetMasterNode()] + list(self.instance.all_nodes) |
|
714 |
nl = [self.cfg.GetMasterNode()] + \ |
|
715 |
list(self.cfg.GetInstanceNodes(self.instance)) |
|
715 | 716 |
return (nl, nl) |
716 | 717 |
|
717 | 718 |
def CheckPrereq(self): |
... | ... | |
724 | 725 |
assert instance is not None, \ |
725 | 726 |
"Cannot retrieve locked instance %s" % self.op.instance_name |
726 | 727 |
if self.op.node_uuids: |
727 |
if len(self.op.node_uuids) != len(instance.all_nodes): |
|
728 |
inst_nodes = self.cfg.GetInstanceNodes(instance) |
|
729 |
if len(self.op.node_uuids) != len(inst_nodes): |
|
728 | 730 |
raise errors.OpPrereqError("Instance %s currently has %d nodes, but" |
729 | 731 |
" %d replacement nodes were specified" % |
730 |
(instance.name, len(instance.all_nodes),
|
|
732 |
(instance.name, len(inst_nodes), |
|
731 | 733 |
len(self.op.node_uuids)), |
732 | 734 |
errors.ECODE_INVAL) |
733 | 735 |
assert instance.disk_template != constants.DT_DRBD8 or \ |
... | ... | |
789 | 791 |
if self.op.node_uuids: |
790 | 792 |
node_uuids = self.op.node_uuids |
791 | 793 |
else: |
792 |
node_uuids = instance.all_nodes
|
|
794 |
node_uuids = self.cfg.GetInstanceNodes(instance)
|
|
793 | 795 |
excl_stor = compat.any( |
794 | 796 |
rpc.GetExclusiveStorageForNodes(self.cfg, node_uuids).values() |
795 | 797 |
) |
... | ... | |
854 | 856 |
|
855 | 857 |
# All touched nodes must be locked |
856 | 858 |
mylocks = self.owned_locks(locking.LEVEL_NODE) |
857 |
assert mylocks.issuperset(frozenset(self.instance.all_nodes)) |
|
859 |
inst_nodes = self.cfg.GetInstanceNodes(self.instance) |
|
860 |
assert mylocks.issuperset(frozenset(inst_nodes)) |
|
858 | 861 |
new_disks = CreateDisks(self, self.instance, to_skip=to_skip) |
859 | 862 |
|
860 | 863 |
# TODO: Release node locks before wiping, or explain why it's not possible |
... | ... | |
1401 | 1404 |
"""Build hooks nodes. |
1402 | 1405 |
|
1403 | 1406 |
""" |
1404 |
nl = [self.cfg.GetMasterNode()] + list(self.instance.all_nodes) |
|
1407 |
nl = [self.cfg.GetMasterNode()] + \ |
|
1408 |
list(self.cfg.GetInstanceNodes(self.instance)) |
|
1405 | 1409 |
return (nl, nl) |
1406 | 1410 |
|
1407 | 1411 |
def CheckPrereq(self): |
... | ... | |
1413 | 1417 |
self.instance = self.cfg.GetInstanceInfo(self.op.instance_uuid) |
1414 | 1418 |
assert self.instance is not None, \ |
1415 | 1419 |
"Cannot retrieve locked instance %s" % self.op.instance_name |
1416 |
node_uuids = list(self.instance.all_nodes)
|
|
1420 |
node_uuids = list(self.cfg.GetInstanceNodes(self.instance))
|
|
1417 | 1421 |
for node_uuid in node_uuids: |
1418 | 1422 |
CheckNodeOnline(self, node_uuid) |
1419 | 1423 |
self.node_es_flags = rpc.GetExclusiveStorageForNodes(self.cfg, node_uuids) |
... | ... | |
1474 | 1478 |
utils.FormatUnit(self.target, "h"))) |
1475 | 1479 |
|
1476 | 1480 |
# First run all grow ops in dry-run mode |
1477 |
for node_uuid in self.instance.all_nodes: |
|
1481 |
inst_nodes = self.cfg.GetInstanceNodes(self.instance) |
|
1482 |
for node_uuid in inst_nodes: |
|
1478 | 1483 |
result = self.rpc.call_blockdev_grow(node_uuid, |
1479 | 1484 |
(self.disk, self.instance), |
1480 | 1485 |
self.delta, True, True, |
... | ... | |
1506 | 1511 |
|
1507 | 1512 |
# We know that (as far as we can test) operations across different |
1508 | 1513 |
# nodes will succeed, time to run it for real on the backing storage |
1509 |
for node_uuid in self.instance.all_nodes:
|
|
1514 |
for node_uuid in inst_nodes:
|
|
1510 | 1515 |
result = self.rpc.call_blockdev_grow(node_uuid, |
1511 | 1516 |
(self.disk, self.instance), |
1512 | 1517 |
self.delta, False, True, |
... | ... | |
1926 | 1931 |
@return: True if they are activated, False otherwise |
1927 | 1932 |
|
1928 | 1933 |
""" |
1929 |
node_uuids = instance.all_nodes
|
|
1934 |
node_uuids = self.cfg.GetInstanceNodes(instance)
|
|
1930 | 1935 |
|
1931 | 1936 |
for idx, dev in enumerate(instance.disks): |
1932 | 1937 |
for node_uuid in node_uuids: |
Also available in: Unified diff