All of lore.kernel.org
 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/HelperFunction ...
Date: 15 Jan 2008 04:41:43 -0000	[thread overview]
Message-ID: <20080115044143.5336.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2008-01-15 04:41:41

Modified files:
	luci/site/luci/Extensions: HelperFunctions.py LuciClusterInfo.py 
	                           LuciValidation.py LuciZopeExternal.py 
	                           homebase_adapters.py 
	luci/site/luci/Extensions/ClusterModel: ModelBuilder.py 
	luci/cluster   : cluster_svc-macros 
	.              : Makefile clustermon.spec.in.in conga.spec.in.in 

Log message:
	Fix bz383071 (Virtual machine configuration - add field for "migration type" xml attr = "migrate")

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/HelperFunctions.py.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciValidation.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeExternal.py.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.54&r2=1.55
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/cluster_svc-macros.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/Makefile.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/clustermon.spec.in.in.diff?cvsroot=cluster&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&r1=1.92&r2=1.93

--- conga/luci/site/luci/Extensions/HelperFunctions.py	2008/01/02 21:00:31	1.12
+++ conga/luci/site/luci/Extensions/HelperFunctions.py	2008/01/15 04:41:40	1.13
@@ -9,7 +9,8 @@
 import threading
 
 def resolveOSType(os_str):
-	if not os_str or os_str.find('Tikanga') != (-1) or os_str.find('FC6') != (-1) or os_str.find('Zod') != (-1) or os_str.find('Moonshine') != (-1):
+	rhel5_clu_ver = [ 'Tikanga', 'Zod', 'Moonshine', 'Werewolf' ]
+	if not os_str or os_str in rhel5_clu_ver:
 		return 'rhel5'
 	else:
 		return 'rhel4'
--- conga/luci/site/luci/Extensions/LuciClusterInfo.py	2008/01/02 21:00:31	1.18
+++ conga/luci/site/luci/Extensions/LuciClusterInfo.py	2008/01/15 04:41:40	1.19
@@ -575,6 +575,15 @@
 		return {}
 
 	clumap = {}
+	try:
+		cluster_os = model.getClusterOS()
+		if cluster_os.find('Tikanga'):
+			os_minor = int(cluster_os[cluster_os.find('5.') + 2])
+			if os_minor > 1:
+				clumap['vm_migration_choice'] = True
+	except:
+		pass
+
 	if not model:
 		try:
 			model = getModelForCluster(self, cluname)
@@ -1487,6 +1496,15 @@
 			luci_log.debug_verbose('getVMInfo0: no service name')
 		return vm_map
 
+	try:
+		cluster_os = model.getClusterOS()
+		if cluster_os.find('Tikanga'):
+			os_minor = int(cluster_os[cluster_os.find('5.') + 2])
+			if os_minor > 1:
+				vm_map['vm_migration_choice'] = True
+	except:
+		pass
+
 	vm_map['formurl'] = '%s?clustername=%s&pagetype=29&servicename=%s' \
 		% (baseurl, clustername, svcname)
 
@@ -1537,7 +1555,7 @@
 		return None
 
 	try:
-		model = ModelBuilder(0, None, None, cluster_conf_node)
+		model = ModelBuilder(None, cluster_conf_node, rc.os())
 		if not model:
 			raise Exception, 'ModelBuilder() returned None'
 		model.setIsVirtualized(isVirtualized)
--- conga/luci/site/luci/Extensions/LuciValidation.py	2008/01/02 21:00:31	1.2
+++ conga/luci/site/luci/Extensions/LuciValidation.py	2008/01/15 04:41:40	1.3
@@ -1062,7 +1062,7 @@
 def validate_vmsvc_form(model, request):
 	errors = list()
 
-	fvar = GetReqVars(request, [ 'vmname', 'oldname', 'vmpath', 'recovery', 'domain', ])
+	fvar = GetReqVars(request, [ 'vmname', 'oldname', 'vmpath', 'recovery', 'domain', 'migration_type'])
 
 	vm_name = fvar['vmname']
 	if vm_name is None:
@@ -1092,6 +1092,10 @@
 	if recovery is not None and recovery != 'restart' and recovery != 'relocate' and recovery != 'disable':
 		errors.append('You entered an invalid recovery option "%s" for VM service "%s". Valid options are "restart" "relocate" and "disable"' % (recovery, vm_name))
 
+	migration_type = fvar['migration_type']
+	if migration_type is not None and migration_type != 'live' and migration_type != 'pause':
+		errors.append('Migration type must be either "live" or "pause"')
+
 	if len(errors) > 0:
 		return (False, {'errors': errors })
 
@@ -1130,6 +1134,8 @@
 
 	xvm.addAttribute('autostart', str(autostart))
 	xvm.addAttribute('exclusive', str(exclusive))
+	if migration_type:
+		xvm.addAttribute('migrate', str(migration_type))
 
 	fdom = fvar['domain']
 	if fdom:
--- conga/luci/site/luci/Extensions/LuciZopeExternal.py	2008/01/02 21:00:31	1.5
+++ conga/luci/site/luci/Extensions/LuciZopeExternal.py	2008/01/15 04:41:40	1.6
@@ -14,8 +14,8 @@
 	getDefaultUser
 
 from cluster_adapters import clusterTaskProcess, \
-	resourceDelete, serviceDelete, \
-	isClusterBusy, nodeTaskProcess, process_cluster_conf_editor, \
+	resourceDelete, serviceDelete, isClusterBusy, nodeTaskProcess, \
+	process_cluster_conf_editor, \
 	serviceMigrate, serviceRestart, serviceStart, serviceStop, \
 	getResourceInfo, getSystemLogs
 
--- conga/luci/site/luci/Extensions/homebase_adapters.py	2008/01/02 21:00:32	1.54
+++ conga/luci/site/luci/Extensions/homebase_adapters.py	2008/01/15 04:41:40	1.55
@@ -201,7 +201,7 @@
 	try:
 		cur_host_trusted = request.form.has_key('host_is_trusted')
 	except:
-		cur_host_trusted = False
+		cur_host_trusted = not check_certs
 
 	trust_shown = False
 	try:
--- conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py	2008/01/02 20:56:08	1.14
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py	2008/01/15 04:41:40	1.15
@@ -50,8 +50,8 @@
 from Rm import Rm
 from Altname import Altname
 
-DLM_TYPE	= 0
-GULM_TYPE	= 1
+DLM_TYPE    = 0
+GULM_TYPE   = 1
 
 TAGNAMES = { 'cluster': Cluster,
              'clusternodes': ClusterNodes,
@@ -119,8 +119,10 @@
 
 
 class ModelBuilder:
-  def __init__(self, lock_type, filename=None, mcast_addr=None, domm=None):
-    self.filename = filename
+  def __init__(self, mcast_addr=None, domm=None, cluster_os=None):
+    if domm is None:
+      raise Exception, 'No cluster configuration'
+
     self.lock_type = DLM_TYPE
     self.mcast_address = mcast_addr
     self.mcast_interface = None
@@ -141,43 +143,25 @@
     self.fence_xvmd_ptr = None
     self.unusual_items = list()
     self.isVirtualized = False
+    self.cluster_os = cluster_os 
+
     if mcast_addr is None:
       self.usesMulticast = False
     else:
       self.usesMulticast = True
 
-    if domm is not None:
-      self.parent = domm
-      self.object_tree = self.buildModel(None)
-      self.check_empty_ptrs()
-      self.check_fence_daemon()
-      self.resolve_fence_instance_types()
-      self.purgePCDuplicates()
-      self.resolve_references()
-      self.check_for_multicast()
-      self.check_for_nodeids()
-    else:
-      if filename is None:
-        if lock_type == DLM_TYPE:
-          self.lock_type = DLM_TYPE
-          self.object_tree = self.buildDLMModelTemplate()
-        else:
-          self.lock_type = GULM_TYPE
-          self.object_tree = self.buildGULMModelTemplate()
-      else:
-        try:
-          self.parent = minidom.parse(self.filename)
-        except IOError, e:
-          pass
-
-        self.object_tree = self.buildModel(None)
-        self.check_empty_ptrs()
-        self.check_fence_daemon()
-        self.resolve_fence_instance_types()
-        self.purgePCDuplicates()
-        self.resolve_references()
-        self.check_for_multicast()
+    self.parent = domm
+    self.object_tree = self.buildModel(None)
+    self.check_empty_ptrs()
+    self.check_fence_daemon()
+    self.resolve_fence_instance_types()
+    self.purgePCDuplicates()
+    self.resolve_references()
+    self.check_for_multicast()
+    self.check_for_nodeids()
 
+  def getClusterOS(self):
+    return self.cluster_os
 
   def buildModel(self, parent_node, parent_object=None):
 
--- conga/luci/cluster/cluster_svc-macros	2008/01/02 20:52:22	1.2
+++ conga/luci/cluster/cluster_svc-macros	2008/01/15 04:41:41	1.3
@@ -140,6 +140,8 @@
 </div>
 
 <div metal:define-macro="vmadd-form">
+	<tal:block tal:define="
+		global clusterinfo python: here.getClusterInfo(modelb, request)" />
 <form method="post" action="">
 	<input type="hidden" name="clustername"
 		tal:attributes="value request/clustername | nothing" />
@@ -178,6 +180,7 @@
 					</select>
 				</td>
 			</tr>
+
 			<tr class="systemsTable">
 				<td>Recovery policy</td>
 				<td>
@@ -189,6 +192,19 @@
 					</select>
 				</td>
 			</tr>
+
+			<tr class="systemsTable"
+				tal:condition="exists:clusterinfo/vm_migration_choice">
+
+				<td>Migration type</td>
+				<td>
+					<select name="migration_type">
+						<option value="live" selected="selected">Live</option>
+						<option value="pause">Pause</option>
+					</select>
+				</td>
+			</tr>
+						
 			<tr class="systemsTable"><td colspan="2">
 				<div class="hbSubmit">
 					<input type="submit" value="Create Virtual Machine Service" />
@@ -343,6 +359,21 @@
 					</select>
 				</td>
 			</tr>
+
+			<tr class="systemsTable"
+				tal:condition="exists:vminfo/vm_migration_choice">
+
+				<td>Migration type</td>
+				<td>
+					<select name="migration_type">
+						<option value="live" tal:content="string:Live"
+							tal:attributes="selected python:('migrate' not in vminfo or vminfo['migrate'] != 'pause') and 'selected' or ''" />
+						<option value="pause" tal:content="string:Pause"
+							tal:attributes="selected python:('migrate' in vminfo and vminfo['migrate'] == 'pause') and 'selected' or ''" />
+					</select>
+				</td>
+			</tr>
+						
 			<tr class="systemsTable"><td colspan="2">
 				<div class="hbSubmit">
 					<input name="submit" type="submit" value="Update Virtual Machine Service" />
--- conga/Makefile	2007/09/11 16:02:16	1.14
+++ conga/Makefile	2008/01/15 04:41:41	1.15
@@ -1,6 +1,6 @@
 ################################################################################
 ##
-## Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved.
+## Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
 ##
 ## This copyrighted material is made available to anyone wishing to use,
 ## modify, copy, or redistribute it subject to the terms and conditions
--- conga/clustermon.spec.in.in	2007/10/10 20:09:46	1.34
+++ conga/clustermon.spec.in.in	2008/01/15 04:41:41	1.35
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (C) 2006-2007 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2006-2008 Red Hat, Inc. All rights reserved.
 #
 # This copyrighted material is made available to anyone wishing to use,
 # modify, copy, or redistribute it subject to the terms and conditions
--- conga/conga.spec.in.in	2008/01/14 20:51:42	1.92
+++ conga/conga.spec.in.in	2008/01/15 04:41:41	1.93
@@ -303,6 +303,7 @@
 - Fixed bz337041 (Add option to not fail-back service)
 - Fixed bz264161 (RFE: support setting the "__independent_subtree" attribute on cluster resources)
 - Fixed bz239387 (RFE: add timeouts for actions that can leave cluster unreachable)
+- Fixed bz383071 (Virtual machine configuration - add field for "migration type" xml attr = "migrate")
 
 * Mon Aug 27 2007 Ryan McCabe <rmccabe@redhat.com> 0.10.0-6
 - Fixed bz253783



             reply	other threads:[~2008-01-15  4:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-15  4:41 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-11-29 22:29 [Cluster-devel] conga luci/site/luci/Extensions/HelperFunction kupcevic

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=20080115044143.5336.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.