Skip to content

Commit

Permalink
Fixed incorrect errors when removing/adding nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
feist committed Sep 7, 2012
1 parent 2519d40 commit dd84b13
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pcs/cluster.py
Expand Up @@ -356,6 +356,8 @@ def cluster_node(argv):
sys.exit(1)
else:
nodesRemoved = False
output, retval = utils.run(["crm_node", "--force","-R", node])

for my_node in utils.getNodesFromCorosyncConf():
retval, output = utils.removeLocalNode(my_node,node)
if retval != 0:
Expand Down
13 changes: 12 additions & 1 deletion pcs/utils.py
Expand Up @@ -87,7 +87,7 @@ def addLocalNode(node,node_to_add):
retval2 = myout[0]
output = myout[1]
except ValueError:
return 1,output
return 1, output
return retval2, output
else:
return 1, output
Expand Down Expand Up @@ -252,12 +252,16 @@ def addNodeToCorosync(node):

# TODO: Need to make this smarter about parsing files not generated by pcs
def removeNodeFromCorosync(node):
error = False
node_found = False
for c_node in getNodesFromCorosyncConf():
if c_node == node:
node_found = True
break

if not node_found:
return False

corosync_conf = getCorosyncConf().split("\n")
for x in range(len(corosync_conf)):
if corosync_conf[x].find("node {") != -1:
Expand All @@ -267,12 +271,19 @@ def removeNodeFromCorosync(node):
nodeid = match.group(1)
else:
print "Error: Unable to determine nodeid for %s" % node
error = True
break
new_corosync_conf = "\n".join(corosync_conf[0:x] + corosync_conf[x+4:])
print new_corosync_conf
setCorosyncConf(new_corosync_conf)
run(["/sbin/corosync-cmapctl", "-D", "nodelist.node." +
str(nodeid) + "."])

if error:
return False
else:
return True

def getHighestnodeid(corosync_conf):
highest = 0
corosync_conf = getCorosyncConf()
Expand Down

0 comments on commit dd84b13

Please sign in to comment.