[Cluster-devel] conga/luci/site/luci/Extensions StorageReport. ...
rmccabe at sourceware.org
rmccabe at sourceware.org
Fri Jun 1 23:18:16 UTC 2007
CVSROOT: /cvs/cluster
Module name: conga
Branch: EXPERIMENTAL
Changes by: rmccabe at sourceware.org 2007-06-01 23:18:16
Modified files:
luci/site/luci/Extensions: StorageReport.py Variable.py
conga_constants.py
ricci_communicator.py
ricci_defines.py
Log message:
cloneNode() is a very expensive call. don't call it unless necessary. this needs
more auditing.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.23.2.5&r2=1.23.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Variable.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.4.8.4&r2=1.4.8.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.39.2.5&r2=1.39.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.25.2.5&r2=1.25.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_defines.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.8.2&r2=1.1.8.3
--- conga/luci/site/luci/Extensions/StorageReport.py 2007/05/30 22:04:33 1.23.2.5
+++ conga/luci/site/luci/Extensions/StorageReport.py 2007/06/01 23:18:16 1.23.2.6
@@ -29,12 +29,10 @@
SESSION_STORAGE_XML_REPORT = 'storage_xml_report_dir'
-
class StorageReport:
def __init__(self, storage_xml_report):
- #self.__report = minidom.parseString(storage_xml_report).firstChild
- self.__report = storage_xml_report.cloneNode(True)
+ self.__report = storage_xml_report#.cloneNode(True)
self.__mappers = None
self.__m_temps = None
@@ -55,14 +53,14 @@
m_type = mapp_node.getAttribute('mapper_type')
if not (m_type in self.__mapp_dir):
self.__mapp_dir[m_type] = []
- self.__mapp_dir[m_type].append(mapp_node.cloneNode(True))
+ self.__mapp_dir[m_type].append(mapp_node)#.cloneNode(True))
self.__m_temps_dir = {} # holds mapper_template lists by mapper_type
for temp_node in self.__m_temps:
m_type = temp_node.getAttribute('mapper_type')
if not (m_type in self.__m_temps_dir):
self.__m_temps_dir[m_type] = []
- self.__m_temps_dir[m_type].append(temp_node.cloneNode(True))
+ self.__m_temps_dir[m_type].append(temp_node)#.cloneNode(True))
#
@@ -70,7 +68,7 @@
def get_xml_report(self):
- return self.__report.cloneNode(True)
+ return self.__report#.cloneNode(True)
def get_mappers(self, mapper_type=''):
@@ -81,7 +79,7 @@
l = self.__mapp_dir[mapper_type]
r = []
for s in l:
- r.append(s.cloneNode(True))
+ r.append(s)#s.cloneNode(True))
return r
@@ -90,7 +88,7 @@
for mapper_type in self.__mapp_dir:
l = []
for m in self.__mapp_dir[mapper_type]:
- l.append(m.cloneNode(True))
+ l.append(m)#.cloneNode(True))
r[mapper_type] = l
return r
@@ -100,7 +98,7 @@
raise Exception, 'empty mapper_id!!!'
for m in self.__mappers:
if m.getAttribute('mapper_id') == mapper_id:
- return m.cloneNode(True)
+ return m#.cloneNode(True)
return None
@@ -109,7 +107,7 @@
for mapper_type in self.__m_temps_dir:
l = []
for m in self.__m_temps_dir[mapper_type]:
- l.append(m.cloneNode(True))
+ l.append(m)#.cloneNode(True))
r[mapper_type] = l
return r
@@ -122,7 +120,7 @@
l = self.__m_temps_dir[mapper_type]
r = []
for s in l:
- r.append(s.cloneNode(True))
+ r.append(s)#.cloneNode(True))
return r
@@ -138,7 +136,7 @@
for node in targets_xml.childNodes:
if node.nodeType == xml.dom.Node.ELEMENT_NODE:
if node.nodeName == BD_TYPE:
- targets_list.append(node.cloneNode(True))
+ targets_list.append(node)#.cloneNode(True))
return targets_list
@@ -154,7 +152,7 @@
for node in targets_xml.childNodes:
if node.nodeType == xml.dom.Node.ELEMENT_NODE:
if node.nodeName == BD_TEMPLATE:
- targets_list.append(node.cloneNode(True))
+ targets_list.append(node)#.cloneNode(True))
return targets_list
@@ -170,7 +168,7 @@
for node in targets_xml.childNodes:
if node.nodeType == xml.dom.Node.ELEMENT_NODE:
if node.nodeName == BD_TYPE:
- targets_list.append(node.cloneNode(True))
+ targets_list.append(node)#.cloneNode(True))
return targets_list
@@ -186,7 +184,7 @@
for node in targets_xml.childNodes:
if node.nodeType == xml.dom.Node.ELEMENT_NODE:
if node.nodeName == BD_TYPE:
- targets_list.append(node.cloneNode(True))
+ targets_list.append(node)#.cloneNode(True))
return targets_list
@@ -198,7 +196,7 @@
for node in mapper.childNodes:
if node.nodeType == xml.dom.Node.ELEMENT_NODE:
if node.nodeName == PROPS_TAG:
- props = node.cloneNode(True)
+ props = node#.cloneNode(True)
if props is None:
raise Exception, 'mapper missing properties tag'
return props
@@ -212,7 +210,7 @@
targets = self.get_targets(mapper)
for t_xml in targets:
if t_xml.getAttribute('path') == path:
- return t_xml.cloneNode(True)
+ return t_xml#.cloneNode(True)
return None
def is_storage_report_cached(session, storagename):
@@ -328,7 +326,6 @@
else:
raise Exception, 'Host responded: %s' % err_desc_v.get_value()
- #xml_report = fr_r.toxml()
xml_report = fr_r
# cache xml_report
@@ -449,7 +446,7 @@
mapper_ret['new_sources'] = new_sources
mapper_ret['icon'] = icon_name
mapper_ret['color'] = color
- mapper_ret['xml'] = mapper.cloneNode(True)
+ mapper_ret['xml'] = mapper#.cloneNode(True)
assemble_all_targets(mapper_ret)
@@ -647,7 +644,7 @@
mapper_ret['max_sources'] = max_sources
mapper_ret['icon'] = icon_name
mapper_ret['color'] = color
- mapper_ret['xml'] = mapper.cloneNode(True)
+ mapper_ret['xml'] = mapper#.cloneNode(True)
mapper_ret['actions'] = []
@@ -819,7 +816,7 @@
if object_type == 'bd':
bd_data = get_bd_data(self, storage_report, mapper_id, path)
- bd_xml = bd_data['xml'].cloneNode(True)
+ bd_xml = bd_data['xml']#.cloneNode(True)
if action_type == 'Remove':
doc = minidom.Document()
@@ -831,7 +828,8 @@
req.setAttribute("sequence", "10")
f_call = doc.createElement("function_call")
f_call.setAttribute('name', 'remove_bd')
- f_call.appendChild(Variable('bd', bd_xml.cloneNode(True)).export_xml(doc))
+ #f_call.appendChild(Variable('bd', bd_xml.cloneNode(True)).export_xml(doc))
+ f_call.appendChild(Variable('bd', bd_xml.export_xml(doc)))
req.appendChild(f_call)
module.appendChild(req)
@@ -885,7 +883,7 @@
for c_data in content_data_list:
if c_data['id'] == selected_content_id:
selected_content_data = c_data
- selected_content = c_data['xml'].cloneNode(True)
+ selected_content = c_data['xml']#.cloneNode(True)
# update selected_content props
props_xml = None
@@ -965,7 +963,7 @@
elif object_type == 'bd_template':
path = request[PT_PATH]
bd_data = get_bd_data(self, storage_report, mapper_id, path)
- bd_xml = bd_data['xml'].cloneNode(True)
+ bd_xml = bd_data['xml']#.cloneNode(True)
#return bd_xml.toprettyxml()
if action_type == 'Apply': # Create
@@ -1013,7 +1011,7 @@
for c_data in content_data_list:
if c_data['id'] == selected_content_id:
selected_content_data = c_data
- selected_content = c_data['xml'].cloneNode(True)
+ selected_content = c_data['xml']#.cloneNode(True)
# update selected_content props
props_xml = None
@@ -1093,7 +1091,7 @@
elif object_type == 'mapper':
mapper_data = get_mapper_data(self, storage_report, mapper_id)
- mapper_xml = mapper_data['xml'].cloneNode(True)
+ mapper_xml = mapper_data['xml']#.cloneNode(True)
#return mapper_xml.toprettyxml()
if action_type == 'Remove':
@@ -1173,7 +1171,7 @@
elif object_type == 'mapper_template':
mapper_data = get_mapper_template_data(self, storage_report, mapper_type)
- mapper_xml = mapper_data['xml'].cloneNode(True)
+ mapper_xml = mapper_data['xml']#.cloneNode(True)
#return mapper_xml.toprettyxml()
if action_type == 'Apply':
@@ -1221,7 +1219,7 @@
for node in mapper_xml.childNodes:
if node.nodeType == xml.dom.Node.ELEMENT_NODE:
if node.nodeName == MAPPER_SOURCES_TAG:
- node.appendChild(s_xml.cloneNode(True))
+ node.appendChild(s_xml)#.cloneNode(True))
#return mapper_xml.toprettyxml()
doc = minidom.Document()
batch = doc.createElement("batch")
@@ -1232,7 +1230,8 @@
req.setAttribute("sequence", "10")
f_call = doc.createElement("function_call")
f_call.setAttribute('name', 'create_mapper')
- f_call.appendChild(Variable('mapper', mapper_xml.cloneNode(True)).export_xml(doc))
+# f_call.appendChild(Variable('mapper', mapper_xml.cloneNode(True)).export_xml(doc))
+ f_call.appendChild(Variable('mapper', mapper_xml.export_xml(doc)))
req.appendChild(f_call)
module.appendChild(req)
@@ -1246,7 +1245,7 @@
elif object_type == 'add_sources':
mapper_data = get_mapper_data(self, storage_report, mapper_id)
- mapper_xml = mapper_data['xml'].cloneNode(True)
+ mapper_xml = mapper_data['xml']#.cloneNode(True)
new_sources = []
#return mapper_xml.toprettyxml()
@@ -1258,7 +1257,7 @@
path = v[len('source_bd_'):]
for ns in mapper_data['new_sources']:
if ns['path'] == path:
- new_sources.append(ns['xml'].cloneNode(True))
+ new_sources.append(ns['xml'])#.cloneNode(True))
#return mapper_xml.toprettyxml()
doc = minidom.Document()
batch = doc.createElement("batch")
@@ -1560,7 +1559,7 @@
data['contents'] = contents
data['icon'] = icon_name
data['color'] = color
- data['xml'] = bd_xml.cloneNode(True)
+ data['xml'] = bd_xml#.cloneNode(True)
actions = []
if removable:
@@ -1790,7 +1789,7 @@
name, content_id = get_content_name_id(c_xml)
current['name'] = name
current['id'] = content_id
- current['xml'] = c_xml.cloneNode(True)
+ current['xml'] = c_xml#.cloneNode(True)
data = [current]
for a_xml in a_xmls:
@@ -1800,7 +1799,7 @@
name, content_id = get_content_name_id(a_xml)
available['name'] = name
available['id'] = content_id
- available['xml'] = a_xml.cloneNode(True)
+ available['xml'] = a_xml#.cloneNode(True)
data.append(available)
--- conga/luci/site/luci/Extensions/Variable.py 2007/05/30 22:06:24 1.4.8.4
+++ conga/luci/site/luci/Extensions/Variable.py 2007/06/01 23:18:16 1.4.8.5
@@ -57,12 +57,12 @@
value = []
for kid in node.childNodes:
if kid.nodeType == xml.dom.Node.ELEMENT_NODE:
- value.append(kid.cloneNode(True))
+ value.append(kid)#.cloneNode(True))
return VariableList(attrs_dir['name'], value, mods, VARIABLE_TYPE_LIST_XML)
elif attrs_dir['type'] == VARIABLE_TYPE_XML:
for kid in node.childNodes:
if kid.nodeType == xml.dom.Node.ELEMENT_NODE:
- value = kid.cloneNode(True)
+ value = kid#.cloneNode(True)
break
elif attrs_dir['type'] == VARIABLE_TYPE_INT:
value = int(attrs_dir['value'])
@@ -163,7 +163,7 @@
else:
raise Exception, "lists not implemented"
l = self.__value
- for i in range(len(l)):
+ for i in xrange(len(l)):
x = l[i]
e2 = doc.createElement(VARIABLE_TYPE_LISTENTRY)
e2.setAttribute('type', str(self.__get_type(x)))
@@ -237,7 +237,6 @@
class VariableList(Variable):
def __init__(self, name, value, mods, list_type):
- Variable.__init__(name, value, mods=mods)
if list_type != VARIABLE_TYPE_LIST_STR and list_type != VARIABLE_TYPE_LIST_XML:
raise Exception, 'invalid list type'
#if ! self.__is_list(value):
@@ -272,7 +271,7 @@
l = self.get_value()
for x in l:
if self.type() == VARIABLE_TYPE_LIST_XML:
- elem.appendChild(x.cloneNode(True))
+ elem.appendChild(x)#.cloneNode(True))
else:
e2 = doc.createElement(VARIABLE_TYPE_LISTENTRY)
e2.setAttribute('value', str(x))
--- conga/luci/site/luci/Extensions/conga_constants.py 2007/05/30 05:54:02 1.39.2.5
+++ conga/luci/site/luci/Extensions/conga_constants.py 2007/06/01 23:18:16 1.39.2.6
@@ -145,5 +145,5 @@
# Debugging parameters. Set LUCI_DEBUG_MODE to True and LUCI_DEBUG_VERBOSITY
# to >= 2 to get full debugging output in syslog (LOG_DAEMON/LOG_DEBUG).
-LUCI_DEBUG_MODE = True
-LUCI_DEBUG_VERBOSITY = 2
+LUCI_DEBUG_MODE = False
+LUCI_DEBUG_VERBOSITY = 0
--- conga/luci/site/luci/Extensions/ricci_communicator.py 2007/05/18 05:23:55 1.25.2.5
+++ conga/luci/site/luci/Extensions/ricci_communicator.py 2007/06/01 23:18:16 1.25.2.6
@@ -203,7 +203,7 @@
async_str = 'false'
ricci.setAttribute("async", async_str)
doc.appendChild(ricci)
- ricci.appendChild(batch_xml.cloneNode(True))
+ ricci.appendChild(batch_xml)#.cloneNode(True))
# send request
try:
@@ -235,7 +235,7 @@
for node in doc.firstChild.childNodes:
if node.nodeType == xml.dom.Node.ELEMENT_NODE:
if node.nodeName == 'batch':
- batch_node = node.cloneNode(True)
+ batch_node = node#.cloneNode(True)
if batch_node is None:
if LUCI_DEBUG_MODE is True:
luci_log.debug_verbose('RC:PB4: batch node missing <batch/>')
@@ -301,7 +301,7 @@
for node in doc.firstChild.childNodes:
if node.nodeType == xml.dom.Node.ELEMENT_NODE:
if node.nodeName == 'batch':
- batch_node = node.cloneNode(True)
+ batch_node = node#.cloneNode(True)
if batch_node is None:
raise RicciError, 'Missing <batch/> in ricci\'s response from host %s' % self.__hostname
return batch_node
--- conga/luci/site/luci/Extensions/ricci_defines.py 2007/05/15 21:42:21 1.1.8.2
+++ conga/luci/site/luci/Extensions/ricci_defines.py 2007/06/01 23:18:16 1.1.8.3
@@ -29,12 +29,12 @@
VARIABLE_TYPE_FLOAT = 'float'
-BD_TYPE = 'block_device'
-BD_HD_TYPE = 'hard_drive'
-BD_LV_TYPE = 'logical_volume'
-BD_PARTITION_TYPE = 'partition'
+BD_TYPE = 'block_device'
+BD_HD_TYPE = 'hard_drive'
+BD_LV_TYPE = 'logical_volume'
+BD_PARTITION_TYPE = 'partition'
-BD_TEMPLATE = 'block_device_template'
+BD_TEMPLATE = 'block_device_template'
MAPPER_TYPE = 'mapper'
More information about the Cluster-devel
mailing list