Revision f4bc1f2c lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
522 | 522 |
secondary_ip != hostname.ip and |
523 | 523 |
(not utils.TcpPing(constants.LOCALHOST_IP_ADDRESS, secondary_ip, |
524 | 524 |
constants.DEFAULT_NODED_PORT))): |
525 |
raise errors.OpPrereqError("You gave %s as secondary IP,\n"
|
|
526 |
"but it does not belong to this host." % |
|
525 |
raise errors.OpPrereqError("You gave %s as secondary IP," |
|
526 |
" but it does not belong to this host." %
|
|
527 | 527 |
secondary_ip) |
528 | 528 |
self.secondary_ip = secondary_ip |
529 | 529 |
|
... | ... | |
550 | 550 |
|
551 | 551 |
if not (os.path.isfile(constants.NODE_INITD_SCRIPT) and |
552 | 552 |
os.access(constants.NODE_INITD_SCRIPT, os.X_OK)): |
553 |
raise errors.OpPrereqError("Init.d script '%s' missing or not "
|
|
554 |
"executable." % constants.NODE_INITD_SCRIPT) |
|
553 |
raise errors.OpPrereqError("Init.d script '%s' missing or not" |
|
554 |
" executable." % constants.NODE_INITD_SCRIPT)
|
|
555 | 555 |
|
556 | 556 |
def Exec(self, feedback_fn): |
557 | 557 |
"""Initialize the cluster. |
... | ... | |
950 | 950 |
(fname, to_node)) |
951 | 951 |
finally: |
952 | 952 |
if not rpc.call_node_start_master(master): |
953 |
logger.Error("Could not re-enable the master role on the master,\n"
|
|
954 |
"please restart manually.") |
|
953 |
logger.Error("Could not re-enable the master role on the master," |
|
954 |
" please restart manually.")
|
|
955 | 955 |
|
956 | 956 |
|
957 | 957 |
def _WaitForSync(cfgw, instance, proc, oneshot=False, unlock=False): |
... | ... | |
1401 | 1401 |
if not utils.TcpPing(myself.secondary_ip, |
1402 | 1402 |
secondary_ip, |
1403 | 1403 |
constants.DEFAULT_NODED_PORT): |
1404 |
raise errors.OpPrereqError( |
|
1405 |
"Node secondary ip not reachable by TCP based ping to noded port")
|
|
1404 |
raise errors.OpPrereqError("Node secondary ip not reachable by TCP"
|
|
1405 |
" based ping to noded port")
|
|
1406 | 1406 |
|
1407 | 1407 |
self.new_node = objects.Node(name=node, |
1408 | 1408 |
primary_ip=primary_ip, |
... | ... | |
1500 | 1500 |
new_node.secondary_ip, |
1501 | 1501 |
constants.DEFAULT_NODED_PORT, |
1502 | 1502 |
10, False): |
1503 |
raise errors.OpExecError("Node claims it doesn't have the" |
|
1504 |
" secondary ip you gave (%s).\n" |
|
1505 |
"Please fix and re-run this command." % |
|
1506 |
new_node.secondary_ip) |
|
1503 |
raise errors.OpExecError("Node claims it doesn't have the secondary ip" |
|
1504 |
" you gave (%s). Please fix and re-run this" |
|
1505 |
" command." % new_node.secondary_ip) |
|
1507 | 1506 |
|
1508 | 1507 |
success, msg = ssh.VerifyNodeHostname(node) |
1509 | 1508 |
if not success: |
1510 | 1509 |
raise errors.OpExecError("Node '%s' claims it has a different hostname" |
1511 |
" than the one the resolver gives: %s.\n"
|
|
1512 |
"Please fix and re-run this command." % |
|
1510 |
" than the one the resolver gives: %s." |
|
1511 |
" Please fix and re-run this command." %
|
|
1513 | 1512 |
(node, msg)) |
1514 | 1513 |
|
1515 | 1514 |
# Distribute updated /etc/hosts and known_hosts to all nodes, |
... | ... | |
1572 | 1571 |
|
1573 | 1572 |
if self.old_master == self.new_master: |
1574 | 1573 |
raise errors.OpPrereqError("This commands must be run on the node" |
1575 |
" where you want the new master to be.\n"
|
|
1576 |
"%s is already the master" % |
|
1574 |
" where you want the new master to be." |
|
1575 |
" %s is already the master" %
|
|
1577 | 1576 |
self.old_master) |
1578 | 1577 |
|
1579 | 1578 |
def Exec(self, feedback_fn): |
... | ... | |
1602 | 1601 |
if not rpc.call_node_start_master(self.new_master): |
1603 | 1602 |
logger.Error("could not start the master role on the new master" |
1604 | 1603 |
" %s, please check" % self.new_master) |
1605 |
feedback_fn("Error in activating the master IP on the new master,\n"
|
|
1606 |
"please fix manually.") |
|
1604 |
feedback_fn("Error in activating the master IP on the new master," |
|
1605 |
" please fix manually.")
|
|
1607 | 1606 |
|
1608 | 1607 |
|
1609 | 1608 |
|
... | ... | |
1778 | 1777 |
result = rpc.call_blockdev_assemble(node, node_disk, |
1779 | 1778 |
instance.name, is_primary) |
1780 | 1779 |
if not result: |
1781 |
logger.Error("could not prepare block device %s on node %s (is_pri" |
|
1782 |
"mary=%s)" % (inst_disk.iv_name, node, is_primary)) |
|
1780 |
logger.Error("could not prepare block device %s on node %s" |
|
1781 |
" (is_primary=%s)" % |
|
1782 |
(inst_disk.iv_name, node, is_primary)) |
|
1783 | 1783 |
if is_primary or not ignore_secondaries: |
1784 | 1784 |
disks_ok = False |
1785 | 1785 |
if is_primary: |
... | ... | |
2134 | 2134 |
try: |
2135 | 2135 |
feedback_fn("Running the instance OS create scripts...") |
2136 | 2136 |
if not rpc.call_instance_os_add(inst.primary_node, inst, "sda", "sdb"): |
2137 |
raise errors.OpExecError("Could not install OS for instance %s "
|
|
2138 |
"on node %s" % |
|
2137 |
raise errors.OpExecError("Could not install OS for instance %s" |
|
2138 |
" on node %s" %
|
|
2139 | 2139 |
(inst.name, inst.primary_node)) |
2140 | 2140 |
finally: |
2141 | 2141 |
_ShutdownInstanceDisks(inst, self.cfg) |
... | ... | |
2210 | 2210 |
try: |
2211 | 2211 |
if not rpc.call_instance_run_rename(inst.primary_node, inst, old_name, |
2212 | 2212 |
"sda", "sdb"): |
2213 |
msg = ("Could run OS rename script for instance %s\n" |
|
2214 |
"on node %s\n" |
|
2215 |
"(but the instance has been renamed in Ganeti)" % |
|
2213 |
msg = ("Could run OS rename script for instance %s on node %s (but the" |
|
2214 |
" instance has been renamed in Ganeti)" % |
|
2216 | 2215 |
(inst.name, inst.primary_node)) |
2217 | 2216 |
logger.Error(msg) |
2218 | 2217 |
finally: |
... | ... | |
3144 | 3143 |
raise errors.OpPrereqError("Can't find this device ('%s') in the" |
3145 | 3144 |
" instance." % self.op.disk_name) |
3146 | 3145 |
if len(disk.children) > 1: |
3147 |
raise errors.OpPrereqError("The device already has two slave" |
|
3148 |
" devices.\n" |
|
3149 |
"This would create a 3-disk raid1" |
|
3150 |
" which we don't allow.") |
|
3146 |
raise errors.OpPrereqError("The device already has two slave devices." |
|
3147 |
" This would create a 3-disk raid1 which we" |
|
3148 |
" don't allow.") |
|
3151 | 3149 |
self.disk = disk |
3152 | 3150 |
|
3153 | 3151 |
def Exec(self, feedback_fn): |
... | ... | |
3425 | 3423 |
if not _CreateBlockDevOnSecondary(cfg, remote_node, instance, |
3426 | 3424 |
new_drbd, False, |
3427 | 3425 |
_GetInstanceInfoText(instance)): |
3428 |
raise errors.OpExecError("Failed to create new component on" |
|
3429 |
" secondary node %s\n" |
|
3430 |
"Full abort, cleanup manually!" % |
|
3426 |
raise errors.OpExecError("Failed to create new component on secondary" |
|
3427 |
" node %s. Full abort, cleanup manually!" % |
|
3431 | 3428 |
remote_node) |
3432 | 3429 |
|
3433 | 3430 |
logger.Info("adding new mirror component on primary") |
... | ... | |
3438 | 3435 |
# remove secondary dev |
3439 | 3436 |
cfg.SetDiskID(new_drbd, remote_node) |
3440 | 3437 |
rpc.call_blockdev_remove(remote_node, new_drbd) |
3441 |
raise errors.OpExecError("Failed to create volume on primary!\n"
|
|
3442 |
"Full abort, cleanup manually!!") |
|
3438 |
raise errors.OpExecError("Failed to create volume on primary!" |
|
3439 |
" Full abort, cleanup manually!!")
|
|
3443 | 3440 |
|
3444 | 3441 |
# the device exists now |
3445 | 3442 |
# call the primary node to add the mirror to md |
Also available in: Unified diff