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 cluster/form-macros site/luci/Exten ...
Date: 1 Feb 2007 20:49:09 -0000	[thread overview]
Message-ID: <20070201204909.11450.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-02-01 20:49:08

Modified files:
	luci/cluster   : form-macros 
	luci/site/luci/Extensions: ModelBuilder.py cluster_adapters.py 
	                           conga_constants.py 

Log message:
	- implement deletion of a virtual machine service
	- don't increment the cluster configuration number needlessly

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.170&r2=1.171
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.223&r2=1.224
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.35&r2=1.36

--- conga/luci/cluster/form-macros	2007/02/01 20:27:33	1.170
+++ conga/luci/cluster/form-macros	2007/02/01 20:49:08	1.171
@@ -3748,7 +3748,7 @@
 		<tfoot class="systemsTable">
 			<tr class="systemsTable"><td colspan="2">
 				<div class="hbSubmit">
-					<input type="submit" value="Create Virtual Machine" />
+					<input type="submit" value="Create Virtual Machine Service" />
 				</div>
 			</td></tr>
 		</tfoot>
@@ -3784,13 +3784,13 @@
 	<table class="systemsTable">
 		<thead class="systemsTable">
 			<tr class="systemsTable"><td class="systemsTable">
-				<p class="reshdr">Properties for <tal:block tal:replace="vminfo/name | string:virtual machine"/></p>
+				<p class="reshdr">Properties for <tal:block tal:replace="vminfo/name | string:virtual machine service"/></p>
 			</td></tr>
 		<tfoot class="systemsTable">
 			<tr class="systemsTable"><td colspan="2">
 				<div class="hbSubmit">
-					<input name="submit" type="submit" value="Update Virtual Machine" />
-					<input name="delete" type="submit" value="Delete Virtual Machine" />
+					<input name="submit" type="submit" value="Update Virtual Machine Service" />
+					<input name="delete" type="submit" value="Delete Virtual Machine Service" />
 				</div>
 			</td></tr>
 		</tfoot>
--- conga/luci/site/luci/Extensions/ModelBuilder.py	2007/01/24 19:45:44	1.18
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2007/02/01 20:49:08	1.19
@@ -585,13 +585,13 @@
 
     raise GeneralError('FATAL',"Couldn't find service name in current list")
 
-  def retrieveXenVMsByName(self, name):
-    vms = self.getXENVMs()
+  def retrieveVMsByName(self, name):
+    vms = self.getVMs()
     for v in vms:
       if v.getName() == name:
         return v
 
-    raise GeneralError('FATAL',"Couldn't find xen vm name %s in current node list" % name)
+    raise GeneralError('FATAL',"Couldn't find VM name %s in current list" % name)
 
   def getFenceDevices(self):
     if self.fencedevices_ptr == None:
@@ -724,7 +724,7 @@
 
     return None
         
-  def getXENVMs(self):
+  def getVMs(self):
     rg_list = list()
     if self.resourcemanager_ptr != None:
       kids = self.resourcemanager_ptr.getChildren()
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/31 23:45:09	1.223
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/01 20:49:08	1.224
@@ -590,8 +590,6 @@
 			request.SESSION.set('add_node', add_cluster)
 			return (False, { 'errors': errors, 'messages': messages })
 
-		cp = model.getClusterPtr()
-		cp.incrementConfigVersion()
 		model.setModified(True)
 		conf_str = str(model.exportModelAsString())
 		if not conf_str:
@@ -838,8 +836,6 @@
 		return (False, {'errors': [ 'Unable to determine cluster name' ]})
 
 	try:
-		cp = model.getClusterPtr()
-		cp.incrementConfigVersion()
 		model.setModified(True)
 		conf = model.exportModelAsString()
 		if not conf:
@@ -1402,7 +1398,7 @@
       else:
         try:
           set_node_flag(self, clustername, rc.hostname(), batch_id,
-          CLUSTER_CONFIG, 'Adding new fence device \"%s\"' % retobj)
+            CLUSTER_CONFIG, 'Adding new fence device \"%s\"' % retobj)
         except:
           pass
 
@@ -1494,7 +1490,7 @@
       else:
         try:
           set_node_flag(self, clustername, rc.hostname(), batch_id,
-          CLUSTER_CONFIG, 'Updating fence device \"%s\"' % retobj)
+            CLUSTER_CONFIG, 'Updating fence device \"%s\"' % retobj)
         except:
           pass
 
@@ -1852,8 +1848,6 @@
   if error_code == FD_VAL_SUCCESS:
     messages.append(error_string)
     try:
-      cp = model.getClusterPtr()
-      cp.incrementConfigVersion()
       model.setModified(True)
       conf_str = model.exportModelAsString()
       if not conf_str:
@@ -1887,7 +1881,7 @@
       else:
         try:
           set_node_flag(self, clustername, rc.hostname(), batch_id,
-          CLUSTER_CONFIG, 'Updating cluster configuration')
+            CLUSTER_CONFIG, 'Removing fence device \"%s\"' % fencedev_name)
         except:
           pass
 
@@ -2012,21 +2006,33 @@
 	except KeyError, e:
 		isNew = True
 
-	if isNew is True:
-		xvm = Vm()
-		xvm.addAttribute('name', vm_name)
-		xvm.addAttribute('path', vm_path)
-		rmptr = model.getResourceManagerPtr()
-		rmptr.addChild(xvm)
-	else:
+	delete_vm = False
+	if request.form.has_key('delete'):
 		try:
-			xvm = model.retrieveXenVMsByName(old_name)
+			xvm = model.retrieveVMsByName(old_name)
 			if not xvm:
 				raise Exception, 'not found'
+			rmptr = model.getResourceManagerPtr()
+			rmptr.removeChild(xvm)
+			delete_vm = True
 		except:
-			return (False, {'errors': ['No virtual machine named \"%s\" exists.' % old_name ]})
-		xvm.addAttribute('name', vm_name)
-		xvm.addAttribute('path', vm_path)
+			return (False, {'errors': ['No virtual machine service named \"%s\" exists.' % old_name ]})
+	else:
+		if isNew is True:
+			xvm = Vm()
+			xvm.addAttribute('name', vm_name)
+			xvm.addAttribute('path', vm_path)
+			rmptr = model.getResourceManagerPtr()
+			rmptr.addChild(xvm)
+		else:
+			try:
+				xvm = model.retrieveVMsByName(old_name)
+				if not xvm:
+					raise Exception, 'not found'
+			except:
+				return (False, {'errors': ['No virtual machine service named \"%s\" exists.' % old_name ]})
+			xvm.addAttribute('name', vm_name)
+			xvm.addAttribute('path', vm_path)
 
 	try:
 		model.setModified(True)
@@ -2059,10 +2065,12 @@
 		return (False, {'errors': [ 'Error creating virtual machine %s.' % vm_name ]})
 
 	try:
-		if isNew is True:
-			set_node_flag(self, clustername, rc.hostname(), str(batch_number), XENVM_ADD, "Creating virtual machine \'%s\'" % vm_name)
+		if delete_vm is True:
+			set_node_flag(self, clustername, rc.hostname(), str(batch_number), VM_CONFIG, "Deleting virtual machine service \'%s\'" % vm_name)
+		elif isNew is True:
+			set_node_flag(self, clustername, rc.hostname(), str(batch_number), VM_ADD, "Creating virtual machine service \'%s\'" % vm_name)
 		else:
-			set_node_flag(self, clustername, rc.hostname(), str(batch_number), XENVM_CONFIG, "Configuring virtual machine \'%s\'" % vm_name)
+			set_node_flag(self, clustername, rc.hostname(), str(batch_number), VM_CONFIG, "Configuring virtual machine service \'%s\'" % vm_name)
 	except Exception, e:
 		luci_log.debug_verbose('validateVM6: failed to set flags: %s' % str(e))
 
@@ -2337,10 +2345,10 @@
   if model.getIsVirtualized() == True:
     vmadd = {}
     vmadd['Title'] = "Add a Virtual Service"
-    vmadd['cfg_type'] = "xenvmadd"
-    vmadd['absolute_url'] = url + "?pagetype=" + XENVM_ADD + "&clustername=" + cluname
+    vmadd['cfg_type'] = "vmadd"
+    vmadd['absolute_url'] = url + "?pagetype=" + VM_ADD + "&clustername=" + cluname
     vmadd['Description'] = "Add a Virtual Service to this cluster"
-    if pagetype == XENVM_ADD:
+    if pagetype == VM_ADD:
       vmadd['currentItem'] = True
     else:
       vmadd['currentItem'] = False
@@ -2360,7 +2368,7 @@
     svcfg['currentItem'] = False
 
   services = model.getServices()
-  xenvms = model.getXENVMs()
+  vms = model.getVMs()
   serviceable = list()
   for service in services:
     servicename = service.getName()
@@ -2383,19 +2391,19 @@
 
     serviceable.append(svc)
 
-  for xenvm in xenvms:
-    xenname = xenvm.getName()
+  for vm in vms:
+    name = vm.getName()
     svc = {}
-    svc['Title'] = xenname
-    svc['cfg_type'] = "xenvm"
-    svc['absolute_url'] = url + "?pagetype=" + XENVM_CONFIG + "&servicename=" + xenname + "&clustername=" + cluname
+    svc['Title'] = name
+    svc['cfg_type'] = "vm"
+    svc['absolute_url'] = url + "?pagetype=" + VM_CONFIG + "&servicename=" + name + "&clustername=" + cluname
     svc['Description'] = "Configure this Virtual Service"
-    if pagetype == XENVM_CONFIG:
+    if pagetype == VM_CONFIG:
       try:
         xname = request['servicename']
       except KeyError, e:
         xname = ""
-      if xenname == xname:
+      if name == xname:
         svc['currentItem'] = True
       else:
         svc['currentItem'] = False
@@ -3996,8 +4004,6 @@
 				% (delete_target.getName(), str(e)))
 
 		try:
-			cp = model.getClusterPtr()
-			cp.incrementConfigVersion()
 			model.setModified(True)
 			str_buf = model.exportModelAsString()
 			if not str_buf:
@@ -4823,14 +4829,12 @@
 
 	return getNodeLogs(rc)
 
-def processXenVM(self, req):
-	pass
-
-def getXenVMInfo(self, model, request):
+def getVMInfo(self, model, request):
   map = {}
   baseurl = request['URL']
   clustername = request['clustername']
   svcname = None
+
   try:
     svcname = request['servicename']
   except KeyError, e:
@@ -4842,22 +4846,22 @@
   map['formurl'] = urlstring
 
   try:
-    xenvmname = request['servicename']
+    vmname = request['servicename']
   except:
     try:
-      xenvmname = request.form['servicename']
+      vmname = request.form['servicename']
     except:
       luci_log.debug_verbose('servicename is missing from request')
       return map
 
   try:
-    xenvm = model.retrieveXenVMsByName(xenvmname)
+    vm = model.retrieveVMsByName(vmname)
   except:
     luci_log.debug('An error occurred while attempting to get VM %s' \
-    % xenvmname)
+      % vmname)
     return map
 
-  attrs= xenvm.getAttributes()
+  attrs= vm.getAttributes()
   keys = attrs.keys()
   for key in keys:
     map[key] = attrs[key]
@@ -5305,8 +5309,6 @@
 		return (False, {'errors': [ '%s: error removing service %s.' % (errstr, name) ]})
 
 	try:
-		cp = model.getClusterPtr()
-		cp.incrementConfigVersion()
 		model.setModified(True)
 		conf = model.exportModelAsString()
 		if not conf:
@@ -5387,8 +5389,6 @@
 		return errstr + ': the specified resource was not found.'
 
 	try:
-		cp = model.getClusterPtr()
-		cp.incrementConfigVersion()
 		model.setModified(True)
 		conf = model.exportModelAsString()
 		if not conf:
@@ -6702,8 +6702,6 @@
 		return 'Unable to add the new resource'
 
 	try:
-		cp = model.getClusterPtr()
-		cp.incrementConfigVersion()
 		model.setModified(True)
 		conf = model.exportModelAsString()
 		if not conf:
--- conga/luci/site/luci/Extensions/conga_constants.py	2007/01/23 13:53:36	1.35
+++ conga/luci/site/luci/Extensions/conga_constants.py	2007/02/01 20:49:08	1.36
@@ -13,8 +13,8 @@
 NODE_ADD="15"
 NODE_PROCESS="16"
 NODE_LOGS="17"
-XENVM_ADD="18"
-XENVM_CONFIG="19"
+VM_ADD="18"
+VM_CONFIG="19"
 SERVICES="20"
 SERVICE_ADD="21"
 SERVICE_LIST="22"
@@ -24,7 +24,7 @@
 SERVICE_START="26"
 SERVICE_STOP="27"
 SERVICE_RESTART="28"
-XENVM_PROCESS="29"
+VM_PROCESS="29"
 RESOURCES="30"
 RESOURCE_ADD="31"
 RESOURCE_LIST="32"



             reply	other threads:[~2007-02-01 20:49 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-01 20:49 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-09-21  3:11 [Cluster-devel] conga/luci cluster/form-macros site/luci/Exten rmccabe
2007-06-19 15:54 rmccabe
2007-05-03 20:16 rmccabe
2007-03-15 16:41 rmccabe
2007-03-14 22:38 rmccabe
2007-03-14 22:37 rmccabe
2007-03-05 16:50 rmccabe
2007-03-05 16:50 rmccabe
2007-03-05 16:49 rmccabe
2007-02-15 22:44 rmccabe
2007-02-08  3:46 rmccabe
2007-02-07 17:02 rmccabe
2007-02-07 16:55 rmccabe
2007-02-02  4:34 rmccabe
2007-02-02  0:11 rmccabe
2007-01-31 23:36 rmccabe
2007-01-31  5:26 rmccabe
2007-01-23 13:53 rmccabe
2007-01-15 18:21 rmccabe
2007-01-11 19:11 rmccabe
2007-01-10 21:40 rmccabe
2007-01-06  3:29 rmccabe
2006-12-14 23:14 rmccabe
2006-12-14 18:22 rmccabe
2006-12-11 22:42 rmccabe
2006-12-11 21:51 rmccabe
2006-12-06 22:11 rmccabe
2006-12-06 21:16 rmccabe
2006-11-13 21:40 rmccabe
2006-11-12  2:10 rmccabe
2006-11-09 20:32 rmccabe
2006-11-03 22:48 rmccabe
2006-10-25  1:53 rmccabe
2006-10-25  1:11 rmccabe
2006-10-13 21:25 rmccabe
2006-08-03 18:36 shuennek
2006-07-21 14:49 rmccabe
2006-07-20 16:59 rmccabe

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=20070201204909.11450.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).