[Cluster-devel] conga/luci/site/luci/Extensions LuciValidation.py

rmccabe at sourceware.org rmccabe at sourceware.org
Thu Aug 5 19:32:59 UTC 2010


CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2010-08-05 19:32:58

Modified files:
	luci/site/luci/Extensions: LuciValidation.py 

Log message:
	Fix rhbz#603114: Can't create KVM guest resources without a path to the XML file

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciValidation.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6.2.13&r2=1.6.2.14

--- conga/luci/site/luci/Extensions/LuciValidation.py	2010/01/07 18:08:35	1.6.2.13
+++ conga/luci/site/luci/Extensions/LuciValidation.py	2010/08/05 19:32:58	1.6.2.14
@@ -1116,10 +1116,6 @@
 		errors.append('No virtual machine name was given')
 
 	vm_path = fvar['vmpath']
-	if vm_path is None:
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('validateVM3: no vm path')
-		errors.append('No path to the virtual machine configuration directory was given for VM service "%s"' % vm_name)
 
 	autostart = 1
 	if request.form.has_key('autostart'):
@@ -1192,7 +1188,8 @@
 		if isNew is True:
 			xvm = Vm()
 			xvm.addAttribute('name', vm_name)
-			xvm.addAttribute('path', vm_path)
+			if vm_path:
+				xvm.addAttribute('path', vm_path)
 			rmptr = model.getResourceManagerPtr()
 			rmptr.addChild(xvm)
 		else:
@@ -1203,7 +1200,11 @@
 			except:
 				return (False, { 'errors': [ 'No virtual machine service named "%s" exists' % old_name ]})
 			xvm.addAttribute('name', vm_name)
-			xvm.addAttribute('path', vm_path)
+
+			if vm_path:
+				xvm.addAttribute('path', vm_path)
+			else:
+				xvm.removeAttribute('vm_path')
 
 	if nfslock is not None:
 		xvm.addAttribute('nfslock', '1')
@@ -1229,6 +1230,8 @@
 	hypervisor = fvar['hypervisor']
 	if hypervisor == 'xen':
 		xvm.addAttribute('hypervisor', 'xen')
+		if not vm_path:
+			errors.append('No path to the virtual machine configuration directory was given for VM service "%s"' % vm_name)
 	elif hypervisor == 'qemu':
 		xvm.addAttribute('hypervisor', 'qemu')
 	else:
@@ -1264,6 +1267,8 @@
 		action = VM_CONFIG
 		status_msg = 'Configuring virtual machine service "%s"' % vm_name
 
+	if len(errors) > 0:
+		return (False, {'errors': errors })
 	return (True, { 'action_type': action, 'action_msg': status_msg })
 
 def validate_fence_del(model, request):




More information about the Cluster-devel mailing list