2316 |
2316 |
utils.CommaJoin(inst_config.secondary_nodes),
|
2317 |
2317 |
code=self.ETYPE_WARNING)
|
2318 |
2318 |
|
2319 |
|
if inst_config.disk_template in constants.DTS_NET_MIRROR:
|
|
2319 |
if inst_config.disk_template in constants.DTS_INT_MIRROR:
|
2320 |
2320 |
pnode = inst_config.primary_node
|
2321 |
2321 |
instance_nodes = utils.NiceSort(inst_config.all_nodes)
|
2322 |
2322 |
instance_groups = {}
|
... | ... | |
4369 |
4369 |
if self.needed_locks[locking.LEVEL_NODE] is not locking.ALL_SET:
|
4370 |
4370 |
for instance_name in self.acquired_locks[locking.LEVEL_INSTANCE]:
|
4371 |
4371 |
instance = self.context.cfg.GetInstanceInfo(instance_name)
|
4372 |
|
i_mirrored = instance.disk_template in constants.DTS_NET_MIRROR
|
|
4372 |
i_mirrored = instance.disk_template in constants.DTS_INT_MIRROR
|
4373 |
4373 |
if i_mirrored and self.op.node_name in instance.all_nodes:
|
4374 |
4374 |
instances_keep.append(instance_name)
|
4375 |
4375 |
self.affected_instances.append(instance)
|
... | ... | |
5709 |
5709 |
"NEW_PRIMARY": self.op.target_node,
|
5710 |
5710 |
}
|
5711 |
5711 |
|
5712 |
|
if instance.disk_template in constants.DTS_NET_MIRROR:
|
|
5712 |
if instance.disk_template in constants.DTS_INT_MIRROR:
|
5713 |
5713 |
env["OLD_SECONDARY"] = instance.secondary_nodes[0]
|
5714 |
5714 |
env["NEW_SECONDARY"] = source_node
|
5715 |
5715 |
else:
|
... | ... | |
5935 |
5935 |
"NEW_PRIMARY": target_node,
|
5936 |
5936 |
})
|
5937 |
5937 |
|
5938 |
|
if instance.disk_template in constants.DTS_NET_MIRROR:
|
|
5938 |
if instance.disk_template in constants.DTS_INT_MIRROR:
|
5939 |
5939 |
env["OLD_SECONDARY"] = target_node
|
5940 |
5940 |
env["NEW_SECONDARY"] = source_node
|
5941 |
5941 |
else:
|
... | ... | |
6434 |
6434 |
" primary node (%s)" % source_node)
|
6435 |
6435 |
demoted_node = target_node
|
6436 |
6436 |
|
6437 |
|
if instance.disk_template in constants.DTS_NET_MIRROR:
|
|
6437 |
if instance.disk_template in constants.DTS_INT_MIRROR:
|
6438 |
6438 |
self._EnsureSecondary(demoted_node)
|
6439 |
6439 |
try:
|
6440 |
6440 |
self._WaitUntilSync()
|
... | ... | |
6594 |
6594 |
self.source_node = self.instance.primary_node
|
6595 |
6595 |
|
6596 |
6596 |
# FIXME: if we implement migrate-to-any in DRBD, this needs fixing
|
6597 |
|
if self.instance.disk_template in constants.DTS_NET_MIRROR:
|
|
6597 |
if self.instance.disk_template in constants.DTS_INT_MIRROR:
|
6598 |
6598 |
self.target_node = self.instance.secondary_nodes[0]
|
6599 |
6599 |
# Otherwise self.target_node has been populated either
|
6600 |
6600 |
# directly, or through an iallocator.
|
... | ... | |
7204 |
7204 |
_CheckIAllocatorOrNode(self, "iallocator", "pnode")
|
7205 |
7205 |
|
7206 |
7206 |
if self.op.pnode is not None:
|
7207 |
|
if self.op.disk_template in constants.DTS_NET_MIRROR:
|
|
7207 |
if self.op.disk_template in constants.DTS_INT_MIRROR:
|
7208 |
7208 |
if self.op.snode is None:
|
7209 |
7209 |
raise errors.OpPrereqError("The networked disk templates need"
|
7210 |
7210 |
" a mirror node", errors.ECODE_INVAL)
|
... | ... | |
7764 |
7764 |
self.secondaries = []
|
7765 |
7765 |
|
7766 |
7766 |
# mirror node verification
|
7767 |
|
if self.op.disk_template in constants.DTS_NET_MIRROR:
|
|
7767 |
if self.op.disk_template in constants.DTS_INT_MIRROR:
|
7768 |
7768 |
if self.op.snode == pnode.name:
|
7769 |
7769 |
raise errors.OpPrereqError("The secondary node cannot be the"
|
7770 |
7770 |
" primary node.", errors.ECODE_INVAL)
|
... | ... | |
7971 |
7971 |
|
7972 |
7972 |
if self.op.wait_for_sync:
|
7973 |
7973 |
disk_abort = not _WaitForSync(self, iobj)
|
7974 |
|
elif iobj.disk_template in constants.DTS_NET_MIRROR:
|
|
7974 |
elif iobj.disk_template in constants.DTS_INT_MIRROR:
|
7975 |
7975 |
# make sure the disks are not degraded (still sync-ing is ok)
|
7976 |
7976 |
time.sleep(15)
|
7977 |
7977 |
feedback_fn("* checking mirrors status")
|
... | ... | |
9296 |
9296 |
errors.ECODE_INVAL)
|
9297 |
9297 |
|
9298 |
9298 |
if (self.op.disk_template and
|
9299 |
|
self.op.disk_template in constants.DTS_NET_MIRROR and
|
|
9299 |
self.op.disk_template in constants.DTS_INT_MIRROR and
|
9300 |
9300 |
self.op.remote_node is None):
|
9301 |
9301 |
raise errors.OpPrereqError("Changing the disk template to a mirrored"
|
9302 |
9302 |
" one requires specifying a secondary node",
|
... | ... | |
9456 |
9456 |
self.op.disk_template),
|
9457 |
9457 |
errors.ECODE_INVAL)
|
9458 |
9458 |
_CheckInstanceDown(self, instance, "cannot change disk template")
|
9459 |
|
if self.op.disk_template in constants.DTS_NET_MIRROR:
|
|
9459 |
if self.op.disk_template in constants.DTS_INT_MIRROR:
|
9460 |
9460 |
if self.op.remote_node == pnode:
|
9461 |
9461 |
raise errors.OpPrereqError("Given new secondary node %s is the same"
|
9462 |
9462 |
" as the primary node of the instance" %
|
... | ... | |
10445 |
10445 |
In particular, it returns information about newly split instances, and
|
10446 |
10446 |
instances that were already split, and remain so after the change.
|
10447 |
10447 |
|
10448 |
|
Only instances whose disk template is listed in constants.DTS_NET_MIRROR are
|
|
10448 |
Only instances whose disk template is listed in constants.DTS_INT_MIRROR are
|
10449 |
10449 |
considered.
|
10450 |
10450 |
|
10451 |
10451 |
@type changes: list of (node_name, new_group_uuid) pairs.
|
... | ... | |
10468 |
10468 |
return [instance.primary_node] + list(instance.secondary_nodes)
|
10469 |
10469 |
|
10470 |
10470 |
for inst in instance_data.values():
|
10471 |
|
if inst.disk_template not in constants.DTS_NET_MIRROR:
|
|
10471 |
if inst.disk_template not in constants.DTS_INT_MIRROR:
|
10472 |
10472 |
continue
|
10473 |
10473 |
|
10474 |
10474 |
instance_nodes = InstanceNodes(inst)
|
... | ... | |
11376 |
11376 |
"""
|
11377 |
11377 |
disk_space = _ComputeDiskSize(self.disk_template, self.disks)
|
11378 |
11378 |
|
11379 |
|
if self.disk_template in constants.DTS_NET_MIRROR:
|
|
11379 |
if self.disk_template in constants.DTS_INT_MIRROR:
|
11380 |
11380 |
self.required_nodes = 2
|
11381 |
11381 |
else:
|
11382 |
11382 |
self.required_nodes = 1
|
... | ... | |
11413 |
11413 |
raise errors.OpPrereqError("Can't relocate non-mirrored instances",
|
11414 |
11414 |
errors.ECODE_INVAL)
|
11415 |
11415 |
|
11416 |
|
if instance.disk_template in constants.DTS_NET_MIRROR and \
|
|
11416 |
if instance.disk_template in constants.DTS_INT_MIRROR and \
|
11417 |
11417 |
len(instance.secondary_nodes) != 1:
|
11418 |
11418 |
raise errors.OpPrereqError("Instance has not exactly one secondary node",
|
11419 |
11419 |
errors.ECODE_STATE)
|