[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2007-01-22 17:06:49

Modified files:
	luci/site/luci/Extensions: Vm.py cluster_adapters.py 

Log message:
	vm resources need special handling. to fix later.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Vm.py.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.208&r2=1.209

--- conga/luci/site/luci/Extensions/Vm.py	2007/01/20 04:50:20	1.3
+++ conga/luci/site/luci/Extensions/Vm.py	2007/01/22 17:06:48	1.4
@@ -1,16 +1,15 @@
 import string
 from TagObject import TagObject
-from BaseResource import BaseResource
-
-import gettext
-_ = gettext.gettext
 
 TAG_NAME = "vm"
-RESOURCE_TYPE = _("Virtual Machine")
 
-class Vm(BaseResource):
+class Vm(TagObject):
   def __init__(self):
-    BaseResource.__init__(self)
+    TagObject.__init__(self)
     self.TAG_NAME = TAG_NAME
-    self.resource_type = RESOURCE_TYPE
-    self.addAttribute('autostart', '1')
+    #Have autostart set by default
+    self.addAttribute("autostart","1")
+
+  def getProperties(self):
+    stringbuf = ""
+    return stringbuf
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/20 04:50:20	1.208
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/22 17:06:48	1.209
@@ -6408,160 +6408,6 @@
 		return [None, None, errors]
 	return [res, model, None]
 
-def addVM(request, form=None):
-	errors = list()
-
-	if form is None:
-		form = request.form
-
-	if not form:
-		luci_log.debug_verbose('addVM0: form is missing')
-		return None
-
-	model = request.SESSION.get('model')
-	if not model:
-		luci_log.debug_verbose('addVM1: model is missing')
-		return None
-
-	res = None
-	if form.has_key('edit'):
-		try:
-			oldname = form['oldname'].strip()
-			if not oldname:
-				raise Exception, 'oldname is blank.'
-			try:
-				res = getResourceForEdit(model, oldname)
-			except KeyError, e:
-				errors.append('No VM resource named \"%s\" exists.' % oldname)
-		except Exception, e:
-			errors.append('No original name was found for this VM resource.')
-			luci_log.debug_verbose('addVM2: %s' % str(e))
-	else:
-		try:
-			res = Vm()
-			if not res:
-				raise Exception, 'could not create VM object'
-		except Exception, e:
-			errors.append('An error occurred while creating an VM resource.')
-			luci_log.debug_verbose('addVM3: %s' % str(e))
-
-	if not res:
-		return [None, None, errors]
-
-	try:
-		name = form['resourceName'].strip()
-		if not name:
-			raise Exception, 'No name was given for this VM resource.'
-		res.addAttribute('name', name)
-	except Exception, e:
-		err = str(e)
-		errors.append(err)
-		luci_log.debug_verbose('addVM4: %s' % err)
-
-	try:
-		domain = form['domain'].strip()
-		if not domain:
-			raise KeyError, 'No domain was given for this VM resource.'
-		res.addAttribute('domain', domain)
-	except Exception, e:
-		err = str(e)
-		errors.append(err)
-		luci_log.debug_verbose('addVM5: %s' % err)
-
-	try:
-		bootloader = form['bootloader'].strip()
-		if not bootloader:
-			raise KeyError, 'No bootloader was given for this VM resource.'
-		res.addAttribute('bootloader', bootloader)
-	except Exception, e:
-		err = str(e)
-		errors.append(err)
-		luci_log.debug_verbose('addVM6: %s' % err)
-
-	try:
-		path = form['path'].strip()
-		if not path:
-			raise KeyError, 'No path specification was given for this VM resource.'
-		res.addAttribute('path', path)
-	except Exception, e:
-		err = str(e)
-		errors.append(err)
-		luci_log.debug_verbose('addVM7: %s' % err)
-
-	try:
-		disk = form['rootdisk_physical'].strip()
-		if not disk:
-			raise KeyError, 'No physical root disk was given for this VM resource.'
-		res.addAttribute('rootdisk_physical', disk)
-	except Exception, e:
-		err = str(e)
-		errors.append(err)
-		luci_log.debug_verbose('addVM8: %s' % err)
-
-	try:
-		disk = form['rootdisk_virtual'].strip()
-		if not disk:
-			raise KeyError, 'No virtual root disk was given for this VM resource.'
-		res.addAttribute('rootdisk_virtual', disk)
-	except Exception, e:
-		err = str(e)
-		errors.append(err)
-		luci_log.debug_verbose('addVM9: %s' % err)
-
-	try:
-		disk = form['swapdisk_physical'].strip()
-		if not disk:
-			raise KeyError, 'No physical swap disk was given for this VM resource.'
-		res.addAttribute('swapdisk_physical', disk)
-	except Exception, e:
-		err = str(e)
-		errors.append(err)
-		luci_log.debug_verbose('addVM10: %s' % err)
-
-	try:
-		disk = form['swapdisk_virtual'].strip()
-		if not disk:
-			raise KeyError, 'No virtual swap disk was given for this VM resource.'
-		res.addAttribute('swapdisk_virtual', disk)
-	except Exception, e:
-		err = str(e)
-		errors.append(err)
-		luci_log.debug_verbose('addVM11: %s' % err)
-
-	try:
-		vif = form['vif'].strip()
-		if not vif:
-			raise KeyError, 'No virtual interface MAC address was given for this VM resource.'
-		res.addAttribute('vif', vif)
-	except Exception, e:
-		err = str(e)
-		errors.append(err)
-		luci_log.debug_verbose('addVM12: %s' % err)
-
-	try:
-		memsize = int(form['memory'].strip())
-		res.addAttribute('memory', memsize)
-	except Exception, e:
-		err = str(e)
-		errors.append(err)
-		luci_log.debug_verbose('addVM13: %s' % err)
-
-	try:
-		recovery = form['recovery'].lower().strip()
-		if not recovery:
-			raise Exception, 'No recovery method was given for this VM resource.'
-		if recovery != 'restart' and recovery != 'relocate' and recovery != 'disable':
-			raise Exception, 'An invalid recovery type, \"%s\", was given for this VM resource.' % recovery
-		res.addAttribute('recovery', recovery)
-	except Exception, e:
-		err = str(e)
-		errors.append(err)
-		luci_log.debug_verbose('addVM14: %s' % err)
-
-	if len(errors) > 1:
-		return [None, None, errors]
-	return [res, model, None]
-
 resourceAddHandler = {
 	'ip': addIp,
 	'fs': addFs,
@@ -6571,7 +6417,6 @@
 	'nfsc': addNfsc,
 	'scr': addScr,
 	'smb': addSmb,
-	'vm': addVM,
 	'tomcat-5': addTomcat5,
 	'postgres-8': addPostgres8,
 	'apache': addApache,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]