Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > d536e3b2143fe88c174c968d683c0f4f > files > 29

conga-0.12.2-24.el5_6.1.src.rpm

Index: luci/site/luci/Extensions/LuciValidation.py
===================================================================
RCS file: /cvs/cluster/conga/luci/site/luci/Extensions/LuciValidation.py,v
retrieving revision 1.6.2.13
diff -u -r1.6.2.13 LuciValidation.py
--- a/luci/site/luci/Extensions/LuciValidation.py	7 Jan 2010 18:08:35 -0000	1.6.2.13
+++ b/luci/site/luci/Extensions/LuciValidation.py	5 Aug 2010 19:31:30 -0000
@@ -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):