cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/site/luci/Extensions FenceHandler.p ...
Date: 6 Aug 2010 20:17:23 -0000	[thread overview]
Message-ID: <20100806201723.9426.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2010-08-06 20:17:22

Modified files:
	luci/site/luci/Extensions: FenceHandler.py RicciQueries.py 
	                           cluster_adapters.py 

Log message:
	Fix rhbz#612300 - conga will fail to start a new node that is added via luci

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.20&r2=1.4.2.21
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.11&r2=1.1.4.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.120.2.48&r2=1.120.2.49

--- conga/luci/site/luci/Extensions/FenceHandler.py	2010/08/05 19:06:35	1.4.2.20
+++ conga/luci/site/luci/Extensions/FenceHandler.py	2010/08/06 20:17:20	1.4.2.21
@@ -650,45 +650,34 @@
 		fencedev.removeAttribute('secure')
 
 	try:
-		vmlogin = form['vmlogin'].strip()
-		if not vmlogin:
+		vmware_type = form['vmware_type'].strip()
+		if not vmware_type in ('esx', 'server1', 'server2'):
+			vmware_type = None
 			raise Exception, 'blank'
-		fencedev.addAttribute('vmlogin', vmlogin)
-	except Exception, e:
-		errors.append(FD_PROVIDE_VMLOGIN)
-
-	has_vmpasswd = False
-	try:
-		vmpwd = form['vmpasswd'].strip()
-		if not vmpwd:
-			# Allow passwords that consist of only spaces.
-			if not form.has_key('vmpasswd') or form['vmpasswd'] == '':
-				raise Exception, 'blank'
-			else:
-				vmpwd = form['vmpasswd']
-		fencedev.addAttribute('vmpasswd', vmpwd)
-		has_vmpasswd = True
+		fencedev.addAttribute('vmware_type', vmware_type)
 	except Exception, e:
 		try:
-			fencedev.removeAttribute('vmpasswd')
+			fencedev.removeAttribute('vmware_type')
 		except:
 			pass
 
-	try:
-		vmpwd_script = form['vmpasswd_script'].strip()
-		if not vmpwd_script:
-			raise Exception, 'blank'
-		fencedev.addAttribute('vmpasswd_script', vmpwd_script)
-		has_vmpasswd = True
-	except Exception, e:
+	if not vmware_type in ('server1', 'server2'):
 		try:
-			fencedev.removeAttribute('vmpasswd_script')
+			vmware_dc = form['vmware_datacenter'].strip()
+			if not vmware_dc:
+				raise Exception, 'blank'
+			fencedev.addAttribute('vmware_datacenter', vmware_dc)
+		except Exception, e:
+			try:
+				fencedev.removeAttribute('vmware_datacenter')
+			except:
+				pass
+	else:
+		try:
+			fencedev.removeAttribute('vmware_datacenter')
 		except:
 			pass
 
-	if not has_vmpasswd:
-		errors.append(FD_PROVIDE_VMPASSWD)
-
 	return errors
 
 def val_noop_fd(dummy, _dummy):
--- conga/luci/site/luci/Extensions/RicciQueries.py	2008/09/17 06:29:54	1.1.4.11
+++ conga/luci/site/luci/Extensions/RicciQueries.py	2010/08/06 20:17:20	1.1.4.12
@@ -13,6 +13,7 @@
 luci_log = get_logger()
 
 def addClusterNodeBatch(cluster_name,
+						conf_str,
 						install_base,
 						install_services,
 						install_shared_storage,
@@ -22,6 +23,11 @@
 						reboot_nodes=False):
 	batch = list()
 
+	conf = str(conf_str).replace('<?xml version="1.0"?>', '')
+	conf = conf.replace('<?xml version="1.0" ?>', '')
+	conf = conf.replace('<? xml version="1.0"?>', '')
+	conf = conf.replace('<? xml version="1.0" ?>', '')
+
 	batch.append('<module name="rpm">')
 	batch.append('<request API_version="1.0">')
 	batch.append('<function_call name="install">')
@@ -84,15 +90,7 @@
 	batch.append('<request API_version="1.0">')
 	batch.append('<function_call name="set_cluster.conf">')
 	batch.append('<var mutable="false" name="propagate" type="boolean" value="false"/>')
-	batch.append('<var mutable="false" name="cluster.conf" type="xml">')
-	batch.append('<cluster config_version="1" name="%s">' % cluster_name)
-	batch.append('<fence_daemon post_fail_delay="0" post_join_delay="3"/>')
-	batch.append('<clusternodes/>')
-	batch.append('<cman/>')
-	batch.append('<fencedevices/>')
-	batch.append('<rm/>')
-	batch.append('</cluster>')
-	batch.append('</var>')
+	batch.append('<var mutable="false" name="cluster.conf" type="xml">%s</var>' % conf)
 	batch.append('</function_call>')
 	batch.append('</request>')
 	batch.append('</module>')
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2009/01/26 17:01:22	1.120.2.48
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2010/08/06 20:17:21	1.120.2.49
@@ -545,7 +545,26 @@
 	try:
 		skeys = system_list.keys()
 		skeys.sort()
+
+		for x in skeys:
+			i = system_list[x]
+			next_node_id += 1
+			new_node = ClusterNode()
+			new_node.attr_hash['name'] = str(i['host'])
+			new_node.attr_hash['votes'] = str(1)
+			while next_node_id in used_ids:
+				next_node_id += 1
+			new_node.attr_hash['nodeid'] = str(next_node_id)
+			nodesptr.addChild(new_node)
+
+		model.setModified(True)
+		conf_str = str(model.exportModelAsString())
+		if not conf_str:
+			raise Exception, 'Unable to save the new cluster model'
+
+		# Propagate the new cluster.conf to the existing nodes
 		batch_node = rq.addClusterNodeBatch(clustername,
+						conf_str,
 						True,
 						True,
 						shared_storage,
@@ -559,27 +578,12 @@
 			raise Exception, 'batch is blank'
 
 		for x in skeys:
-			i = system_list[x]
 			system_list[x]['batch'] = batch_node_xml
-			next_node_id += 1
-			new_node = ClusterNode()
-			new_node.attr_hash['name'] = str(i['host'])
-			new_node.attr_hash['votes'] = str(1)
-			while next_node_id in used_ids:
-				next_node_id += 1
-			new_node.attr_hash['nodeid'] = str(next_node_id)
-			nodesptr.addChild(new_node)
 
 		if incomplete or len(errors) > 0:
 			request.SESSION.set('add_node', add_cluster)
 			return (False, { 'errors': errors, 'messages': messages })
 
-		model.setModified(True)
-		conf_str = str(model.exportModelAsString())
-		if not conf_str:
-			raise Exception, 'Unable to save the new cluster model'
-
-		# Propagate the new cluster.conf to the existing nodes
 		# before having any of the new nodes join. If this fails,
 		# abort the whole process.
 		result = rq.setClusterConfSync(cluster_ricci, conf_str)



             reply	other threads:[~2010-08-06 20:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-06 20:17 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-01-02 21:00 [Cluster-devel] conga/luci/site/luci/Extensions FenceHandler.p rmccabe
2007-10-03 19:40 rmccabe
2007-09-21  3:02 rmccabe
2007-07-26  4:36 rmccabe
2007-05-15 21:42 rmccabe
2007-01-19 21:48 rmccabe
2007-01-19 19:41 rmccabe
2007-01-11 22:49 rmccabe
2006-12-20 22:06 jparsons
2006-12-20 20:24 jparsons
2006-12-18 22:16 jparsons
2006-12-18 15:18 jparsons
2006-12-18  4:44 jparsons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100806201723.9426.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).