Commit fba76904 authored by Romain Courteaud's avatar Romain Courteaud

slapos_*: rename Compute to Compute Node

libslap must continue to use the same class names for compatibility.

Changes are made to keep the migration as simple as possible:
  * do not change the catalog table/column names
  * do not change the local_role's names and the related categories
  * keep Computer Consumption portal type
  * keep portal_id's group name
  * keep SLA compatibility
  * keep SlapTool compatibility

SlapTool: restore compatibility with Hosting Subscription method
parent ebdff0cc
...@@ -36,12 +36,12 @@ def ComputerConsumptionTioXMLFile_parseXml(self, REQUEST=None): ...@@ -36,12 +36,12 @@ def ComputerConsumptionTioXMLFile_parseXml(self, REQUEST=None):
raise Unauthorized raise Unauthorized
xml = self.getData("") xml = self.getData("")
computer_consumption_model = \ compute_node_consumption_model = \
pkg_resources.resource_string( pkg_resources.resource_string(
'slapos.slap', 'doc/computer_consumption.xsd') 'slapos.slap', 'doc/computer_consumption.xsd')
# Validate against the xsd # Validate against the xsd
xsd_model = StringIO.StringIO(computer_consumption_model) xsd_model = StringIO.StringIO(compute_node_consumption_model)
xmlschema_doc = etree.parse(xsd_model) xmlschema_doc = etree.parse(xsd_model)
xmlschema = etree.XMLSchema(xmlschema_doc) xmlschema = etree.XMLSchema(xmlschema_doc)
......
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
<key> <string>aggregated_portal_type</string> </key> <key> <string>aggregated_portal_type</string> </key>
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Compute Partition</string>
<string>Slave Instance</string> <string>Slave Instance</string>
<string>Software Instance</string> <string>Software Instance</string>
</tuple> </tuple>
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<key> <string>aggregated_portal_type</string> </key> <key> <string>aggregated_portal_type</string> </key>
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Compute Partition</string>
<string>Instance Tree</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<key> <string>required_aggregated_portal_type</string> </key> <key> <string>required_aggregated_portal_type</string> </key>
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Compute Partition</string>
<string>Instance Tree</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<key> <string>aggregated_portal_type</string> </key> <key> <string>aggregated_portal_type</string> </key>
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Compute Partition</string>
<string>Slave Instance</string> <string>Slave Instance</string>
<string>Software Instance</string> <string>Software Instance</string>
</tuple> </tuple>
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<key> <string>aggregated_portal_type</string> </key> <key> <string>aggregated_portal_type</string> </key>
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Compute Partition</string>
<string>Instance Tree</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<key> <string>required_aggregated_portal_type</string> </key> <key> <string>required_aggregated_portal_type</string> </key>
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Compute Partition</string>
<string>Instance Tree</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<key> <string>aggregated_portal_type</string> </key> <key> <string>aggregated_portal_type</string> </key>
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Compute Partition</string>
<string>Instance Tree</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<key> <string>required_aggregated_portal_type</string> </key> <key> <string>required_aggregated_portal_type</string> </key>
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Compute Partition</string>
<string>Instance Tree</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
......
...@@ -31,7 +31,7 @@ select_kw.update( ...@@ -31,7 +31,7 @@ select_kw.update(
select_dict=select_dict, select_dict=select_dict,
left_join_list=select_dict.keys(), left_join_list=select_dict.keys(),
resource__uid=aggregateable_service_uid_list, resource__uid=aggregateable_service_uid_list,
default_aggregate_portal_type=ComplexQuery(NegatedQuery(Query(default_aggregate_portal_type='Computer')), default_aggregate_portal_type=ComplexQuery(NegatedQuery(Query(default_aggregate_portal_type='Compute Node')),
Query(default_aggregate_portal_type=None),logical_operator="OR"), Query(default_aggregate_portal_type=None),logical_operator="OR"),
grouping_reference=None, grouping_reference=None,
sort_on=(('modification_date', 'ASC'),) # the highest chance to find movement which can be delivered sort_on=(('modification_date', 'ASC'),) # the highest chance to find movement which can be delivered
......
portal = context.getPortalObject() portal = context.getPortalObject()
if context.getPortalType() == "Computer": if context.getPortalType() == "Compute Node":
# Get the Latest Sale Packing List # Get the Latest Sale Packing List
sale_packing_list_line = portal.portal_catalog.getResultValue( sale_packing_list_line = portal.portal_catalog.getResultValue(
...@@ -17,4 +17,4 @@ if context.getPortalType() == "Computer": ...@@ -17,4 +17,4 @@ if context.getPortalType() == "Computer":
return sale_packing_list.Base_redirect('Base_viewListMode?proxy_form_id=SalePackingList_view&proxy_field_id=listbox') return sale_packing_list.Base_redirect('Base_viewListMode?proxy_form_id=SalePackingList_view&proxy_field_id=listbox')
# Redirect to web site to hide the indexation process # Redirect to web site to hide the indexation process
context.Base_redirect('view', keep_items={'portal_status_message':context.Base_translateString('No Consumption Report for this computer.')}) context.Base_redirect('view', keep_items={'portal_status_message':context.Base_translateString('No Consumption Report for this compute_node.')})
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Computer_getLatestCPUPercentLoad</string> </value> <value> <string>ComputeNode_getLatestCPUPercentLoad</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -8,7 +8,7 @@ model_id = context.getWattConsumptionModel("no_model") ...@@ -8,7 +8,7 @@ model_id = context.getWattConsumptionModel("no_model")
# Introduce your Consumption Model here # Introduce your Consumption Model here
###### ######
def consumption_model_shuttle_ds61_i7(load): def consumption_model_shuttle_ds61_i7(load):
""" Expected consumed watts for the computer load """ Expected consumed watts for the compute_node load
""" """
if load <= 25: if load <= 25:
return 21.5 + 1.06*load return 21.5 + 1.06*load
...@@ -16,7 +16,7 @@ def consumption_model_shuttle_ds61_i7(load): ...@@ -16,7 +16,7 @@ def consumption_model_shuttle_ds61_i7(load):
return 48 + 0.29*load return 48 + 0.29*load
def consumption_model_shuttle_nuc_i7(load): def consumption_model_shuttle_nuc_i7(load):
""" Expected consumed watts for the computer load """ Expected consumed watts for the compute_node load
""" """
if load <= 25: if load <= 25:
return 8.5 + 0.46*load return 8.5 + 0.46*load
...@@ -24,7 +24,7 @@ def consumption_model_shuttle_nuc_i7(load): ...@@ -24,7 +24,7 @@ def consumption_model_shuttle_nuc_i7(load):
return 20 + 0.08*load return 20 + 0.08*load
def consumption_model_rikomagic_mk802iv(load): def consumption_model_rikomagic_mk802iv(load):
""" Expected consumed watts for the computer load """ Expected consumed watts for the compute_node load
""" """
if load <= 25: if load <= 25:
return 2.2 + 0.04*load return 2.2 + 0.04*load
...@@ -40,7 +40,7 @@ model_map = { ...@@ -40,7 +40,7 @@ model_map = {
"intel_nuc_i7": consumption_model_shuttle_nuc_i7 "intel_nuc_i7": consumption_model_shuttle_nuc_i7
} }
if cpu_load_percentage is None: if cpu_load_percentage is None:
cpu_load_percentage = context.Computer_getLatestCPUPercentLoad() cpu_load_percentage = context.ComputeNode_getLatestCPUPercentLoad()
cpu_load_percentage += partition_increment cpu_load_percentage += partition_increment
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Computer_getWattConsumption</string> </value> <value> <string>ComputeNode_getWattConsumption</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Project_getComputerReferenceList</string> </value> <value> <string>ComputeNode_getZeroEmissionRatio</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -3,22 +3,22 @@ if REQUEST is not None: ...@@ -3,22 +3,22 @@ if REQUEST is not None:
raise Unauthorized raise Unauthorized
portal = context.getPortalObject() portal = context.getPortalObject()
computer = context compute_node = context
reference = "TIOCONS-%s-%s" % (computer.getReference(), source_reference) reference = "TIOCONS-%s-%s" % (compute_node.getReference(), source_reference)
version = "%s" % context.getPortalObject().portal_ids.generateNewId( version = "%s" % context.getPortalObject().portal_ids.generateNewId(
id_group=('slap_tioxml_consumption_reference', reference), default=1) id_group=('slap_tioxml_consumption_reference', reference), default=1)
document = portal.consumption_document_module.newContent( document = portal.consumption_document_module.newContent(
portal_type="Computer Consumption TioXML File", portal_type="Computer Consumption TioXML File",
source_reference=source_reference, source_reference=source_reference,
title="%s consumption (%s)" % (computer.getReference(), source_reference), title="%s consumption (%s)" % (compute_node.getReference(), source_reference),
reference=reference, reference=reference,
version=version, version=version,
data=consumption_xml, data=consumption_xml,
classification="personal", classification="personal",
publication_section="other", publication_section="other",
contributor_value=computer, contributor_value=compute_node,
) )
document.submit() document.submit()
return document.getRelativeUrl() return document.getRelativeUrl()
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Computer_reportComputerConsumption</string> </value> <value> <string>ComputeNode_reportComputeNodeConsumption</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -19,33 +19,33 @@ if tioxml_dict is None: ...@@ -19,33 +19,33 @@ if tioxml_dict is None:
document.reject(comment="Not usable TioXML data") document.reject(comment="Not usable TioXML data")
else: else:
computer = context.getContributorValue(portal_type="Computer") compute_node = context.getContributorValue(portal_type="Compute Node")
computer_project_document = computer.Item_getCurrentProjectValue() compute_node_project_document = compute_node.Item_getCurrentProjectValue()
delivery_title = tioxml_dict['title'] delivery_title = tioxml_dict['title']
computer_project = None compute_node_project = None
if computer_project_document is not None: if compute_node_project_document is not None:
computer_project = computer_project_document.getRelativeUrl() compute_node_project = compute_node_project_document.getRelativeUrl()
movement_list = [] movement_list = []
for movement in tioxml_dict["movement"]: for movement in tioxml_dict["movement"]:
reference = movement['reference'] reference = movement['reference']
# It had been reported for the computer itself so it is pure # It had been reported for the compute_node itself so it is pure
# informative. # informative.
if computer.getReference() == reference: if compute_node.getReference() == reference:
aggregate_value_list = [computer] aggregate_value_list = [compute_node]
person = computer.getSourceAdministrationValue(portal_type="Person") person = compute_node.getSourceAdministrationValue(portal_type="Person")
project = computer_project project = compute_node_project
else: else:
project = None # For now, else we should calculate this too. project = None # For now, else we should calculate this too.
if reference.startswith("slapuser"): if reference.startswith("slapuser"):
reference = reference.replace("slapuser", "slappart") reference = reference.replace("slapuser", "slappart")
# Find the partition / software instance / user # Find the partition / software instance / user
partition = portal.portal_catalog.getResultValue( partition = portal.portal_catalog.getResultValue(
parent_uid=computer.getUid(), parent_uid=compute_node.getUid(),
reference=reference, reference=reference,
portal_type="Computer Partition", portal_type="Compute Partition",
validation_state="validated") validation_state="validated")
if partition.getSlapState() != 'busy': if partition.getSlapState() != 'busy':
...@@ -85,7 +85,7 @@ else: ...@@ -85,7 +85,7 @@ else:
) )
# Time to create the PL # Time to create the PL
person = computer.getSourceAdministrationValue(portal_type="Person") person = compute_node.getSourceAdministrationValue(portal_type="Person")
delivery_template = portal.restrictedTraverse( delivery_template = portal.restrictedTraverse(
portal.portal_preferences.getPreferredInstanceDeliveryTemplate()) portal.portal_preferences.getPreferredInstanceDeliveryTemplate())
delivery = delivery_template.Base_createCloneDocument(batch_mode=1) delivery = delivery_template.Base_createCloneDocument(batch_mode=1)
......
...@@ -41,7 +41,7 @@ elif context.getPortalType() == 'Person': ...@@ -41,7 +41,7 @@ elif context.getPortalType() == 'Person':
else: else:
return [] return []
elif context.getPortalType() in ['Software Instance', 'Instance Tree', elif context.getPortalType() in ['Software Instance', 'Instance Tree',
'Computer']: 'Compute Node']:
query_kw['aggregate_uid'] = context.getUid() query_kw['aggregate_uid'] = context.getUid()
else: else:
return [] return []
...@@ -69,17 +69,17 @@ def setDetailLine(packing_list_line): ...@@ -69,17 +69,17 @@ def setDetailLine(packing_list_line):
portal_type='Instance Tree') portal_type='Instance Tree')
software_instance = packing_list_line.getAggregateValue( software_instance = packing_list_line.getAggregateValue(
portal_type='Software Instance') portal_type='Software Instance')
computer_partition = packing_list_line.getAggregateValue( compute_partition = packing_list_line.getAggregateValue(
portal_type='Computer Partition') portal_type='Compute Partition')
if software_instance is None: if software_instance is None:
# In case we found SPL line not aggregated to instance and hosting # In case we found SPL line not aggregated to instance and hosting
return return
instance_tree_reference = hosting_s.getReference() instance_tree_reference = hosting_s.getReference()
instance_reference = software_instance.getReference() instance_reference = software_instance.getReference()
computer_title = "" compute_node_title = ""
if computer_partition is not None: if compute_partition is not None:
computer = computer_partition.getParent() compute_node = compute_partition.getParent()
computer_title = computer.getTitle() if computer.getCpuCore() is None else '%s (%s CPU Cores)' % (computer.getTitle(), computer.getCpuCore()) compute_node_title = compute_node.getTitle() if compute_node.getCpuCore() is None else '%s (%s CPU Cores)' % (compute_node.getTitle(), compute_node.getCpuCore())
#default_line = {'date': {'hosting_ref': ['hs_title', {'instance_ref': ['inst_title', ['res1', 'res2', 'resN'] ] } ] } } #default_line = {'date': {'hosting_ref': ['hs_title', {'instance_ref': ['inst_title', ['res1', 'res2', 'resN'] ] } ] } }
if not start_date in consumption_dict: if not start_date in consumption_dict:
# Add new date line # Add new date line
...@@ -89,7 +89,7 @@ def setDetailLine(packing_list_line): ...@@ -89,7 +89,7 @@ def setDetailLine(packing_list_line):
[software_instance.getTitle(), [software_instance.getTitle(),
[0.0, 0.0, 0.0], [0.0, 0.0, 0.0],
software_instance.getRelativeUrl(), software_instance.getRelativeUrl(),
computer_title compute_node_title
] ]
}, },
hosting_s.getRelativeUrl() hosting_s.getRelativeUrl()
...@@ -102,7 +102,7 @@ def setDetailLine(packing_list_line): ...@@ -102,7 +102,7 @@ def setDetailLine(packing_list_line):
[software_instance.getTitle(), [software_instance.getTitle(),
[0.0, 0.0, 0.0], [0.0, 0.0, 0.0],
software_instance.getRelativeUrl(), software_instance.getRelativeUrl(),
computer_title compute_node_title
] ]
}, },
hosting_s.getRelativeUrl() hosting_s.getRelativeUrl()
...@@ -111,7 +111,7 @@ def setDetailLine(packing_list_line): ...@@ -111,7 +111,7 @@ def setDetailLine(packing_list_line):
if not instance_reference in consumption_dict[start_date][instance_tree_reference][1]: if not instance_reference in consumption_dict[start_date][instance_tree_reference][1]:
consumption_dict[start_date][instance_tree_reference][1][instance_reference] = [ consumption_dict[start_date][instance_tree_reference][1][instance_reference] = [
software_instance.getTitle(), [0.0, 0.0, 0.0], software_instance.getRelativeUrl(), software_instance.getTitle(), [0.0, 0.0, 0.0], software_instance.getRelativeUrl(),
computer_title compute_node_title
] ]
if packing_list_line.getResourceUid() == cpu_resource_uid: if packing_list_line.getResourceUid() == cpu_resource_uid:
quantity = round(float(packing_list_line.getQuantity()), 3) quantity = round(float(packing_list_line.getQuantity()), 3)
...@@ -134,7 +134,7 @@ for date in sorted(consumption_dict, reverse=True): ...@@ -134,7 +134,7 @@ for date in sorted(consumption_dict, reverse=True):
for hosting_key in sorted(consumption_dict[date]): for hosting_key in sorted(consumption_dict[date]):
instance_tree_title, instance_dict, hs_url = consumption_dict[date][hosting_key] instance_tree_title, instance_dict, hs_url = consumption_dict[date][hosting_key]
for instance_value_list in instance_dict.values(): for instance_value_list in instance_dict.values():
instance_title, values, instance_url, computer_title = instance_value_list instance_title, values, instance_url, compute_node_title = instance_value_list
line = newTempBase(portal, instance_url, uid="%s_%s" % (context.getUid(), i)) line = newTempBase(portal, instance_url, uid="%s_%s" % (context.getUid(), i))
line.edit( line.edit(
title=instance_tree_title, title=instance_tree_title,
...@@ -143,7 +143,7 @@ for date in sorted(consumption_dict, reverse=True): ...@@ -143,7 +143,7 @@ for date in sorted(consumption_dict, reverse=True):
cpu_load=values[0], cpu_load=values[0],
memory_used=values[1], memory_used=values[1],
disk_used=values[2], disk_used=values[2],
computer_title=computer_title, compute_node_title=compute_node_title,
hosting_url=hs_url, hosting_url=hs_url,
instance_url=instance_url instance_url=instance_url
) )
......
...@@ -408,8 +408,8 @@ ...@@ -408,8 +408,8 @@
<string>Software Instance</string> <string>Software Instance</string>
</tuple> </tuple>
<tuple> <tuple>
<string>computer_title</string> <string>compute_node_title</string>
<string>Computer</string> <string>Compute Node</string>
</tuple> </tuple>
<tuple> <tuple>
<string>start_date</string> <string>start_date</string>
......
...@@ -408,8 +408,8 @@ ...@@ -408,8 +408,8 @@
<string>Software Instance</string> <string>Software Instance</string>
</tuple> </tuple>
<tuple> <tuple>
<string>computer_title</string> <string>compute_node_title</string>
<string>Computer</string> <string>Compute Node</string>
</tuple> </tuple>
<tuple> <tuple>
<string>start_date</string> <string>start_date</string>
......
...@@ -2,10 +2,10 @@ from zExceptions import Unauthorized ...@@ -2,10 +2,10 @@ from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized raise Unauthorized
computer_partition_list = context.getAggregateValueList(portal_type="Computer Partition") compute_partition_list = context.getAggregateValueList(portal_type="Compute Partition")
current_watt = context.SoftwareRelease_getDeltaCO2List( current_watt = context.SoftwareRelease_getDeltaCO2List(
computer_partition_list, context.SoftwareInstance_getAverageCPULoad() compute_partition_list, context.SoftwareInstance_getAverageCPULoad()
) )
return current_watt.keys()[0] return current_watt.keys()[0]
...@@ -2,14 +2,14 @@ from zExceptions import Unauthorized ...@@ -2,14 +2,14 @@ from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized raise Unauthorized
computer_partition_list = context.getAggregateValueList(portal_type="Computer Partition") compute_partition_list = context.getAggregateValueList(portal_type="Compute Partition")
future_watt = "Not Applicable" future_watt = "Not Applicable"
master_node = context.SoftwareInstance_getResilientMasterNode() master_node = context.SoftwareInstance_getResilientMasterNode()
if master_node is not None: if master_node is not None:
future_watt = context.SoftwareRelease_getDeltaCO2List( future_watt = context.SoftwareRelease_getDeltaCO2List(
computer_partition_list, master_node.SoftwareInstance_getAverageCPULoad() compute_partition_list, master_node.SoftwareInstance_getAverageCPULoad()
) )
future_watt = future_watt.keys()[0] future_watt = future_watt.keys()[0]
......
computer_partition_list = context.getAggregateValueList(portal_type="Computer Partition") compute_partition_list = context.getAggregateValueList(portal_type="Compute Partition")
master_node = context.SoftwareInstance_getResilientMasterNode() master_node = context.SoftwareInstance_getResilientMasterNode()
current_watt = context.SoftwareRelease_getDeltaCO2List( current_watt = context.SoftwareRelease_getDeltaCO2List(
computer_partition_list, context.SoftwareInstance_getAverageCPULoad() compute_partition_list, context.SoftwareInstance_getAverageCPULoad()
) )
current_watt = current_watt.keys() current_watt = current_watt.keys()
master_node = context.SoftwareInstance_getResilientMasterNode() master_node = context.SoftwareInstance_getResilientMasterNode()
if master_node is not None: if master_node is not None:
future_watt = context.SoftwareRelease_getDeltaCO2List( future_watt = context.SoftwareRelease_getDeltaCO2List(
computer_partition_list, master_node.SoftwareInstance_getAverageCPULoad() compute_partition_list, master_node.SoftwareInstance_getAverageCPULoad()
) )
future_watt = future_watt.keys()[0] future_watt = future_watt.keys()[0]
......
...@@ -9,22 +9,22 @@ else: ...@@ -9,22 +9,22 @@ else:
partition_delta_co2_dict = {} partition_delta_co2_dict = {}
for computer_partition in computer_partition_list: for compute_partition in compute_partition_list:
computer = computer_partition.getParentValue() compute_node = compute_partition.getParentValue()
computer_zero_emission_ratio = computer.Computer_getZeroEmissionRatio() compute_node_zero_emission_ratio = compute_node.ComputeNode_getZeroEmissionRatio()
computer_cpu_load_percentage = computer.Computer_getLatestCPUPercentLoad() compute_node_cpu_load_percentage = compute_node.ComputeNode_getLatestCPUPercentLoad()
computer_watt = computer.Computer_getWattConsumption(computer_cpu_load_percentage) compute_node_watt = compute_node.ComputeNode_getWattConsumption(compute_node_cpu_load_percentage)
partition_watt = computer.Computer_getWattConsumption( partition_watt = compute_node.ComputeNode_getWattConsumption(
computer_cpu_load_percentage + partition_average_cpu_load) compute_node_cpu_load_percentage + partition_average_cpu_load)
delta_watt = (partition_watt-computer_watt) delta_watt = (partition_watt-compute_node_watt)
delta_co2 = delta_watt - delta_watt*(computer_zero_emission_ratio/100) delta_co2 = delta_watt - delta_watt*(compute_node_zero_emission_ratio/100)
if delta_co2 in partition_delta_co2_dict: if delta_co2 in partition_delta_co2_dict:
partition_delta_co2_dict[delta_co2].append(computer_partition) partition_delta_co2_dict[delta_co2].append(compute_partition)
else: else:
partition_delta_co2_dict[delta_co2] = [computer_partition] partition_delta_co2_dict[delta_co2] = [compute_partition]
return partition_delta_co2_dict return partition_delta_co2_dict
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>computer_partition_list, simulated_cpu_load=None</string> </value> <value> <string>compute_partition_list, simulated_cpu_load=None</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -406,8 +406,8 @@ ...@@ -406,8 +406,8 @@
<string>Software Instance</string> <string>Software Instance</string>
</tuple> </tuple>
<tuple> <tuple>
<string>computer_title</string> <string>compute_node_title</string>
<string>Computer</string> <string>Compute Node</string>
</tuple> </tuple>
<tuple> <tuple>
<string>start_date</string> <string>start_date</string>
......
...@@ -57,7 +57,7 @@ class TestSlapOSRequestValidationPayment(SlapOSTestCaseMixin): ...@@ -57,7 +57,7 @@ class TestSlapOSRequestValidationPayment(SlapOSTestCaseMixin):
preference = self.portal.portal_preferences.getActiveSystemPreference() preference = self.portal.portal_preferences.getActiveSystemPreference()
preference.setPreferredCloudContractEnabled(True) preference.setPreferredCloudContractEnabled(True)
self.tic() self.tic()
self._makeComputer() self._makeComputeNode()
self.software_instance.setAggregate(self.partition.getRelativeUrl()) self.software_instance.setAggregate(self.partition.getRelativeUrl())
self.tic() self.tic()
...@@ -73,7 +73,7 @@ class TestSlapOSRequestValidationPayment(SlapOSTestCaseMixin): ...@@ -73,7 +73,7 @@ class TestSlapOSRequestValidationPayment(SlapOSTestCaseMixin):
preference = self.portal.portal_preferences.getActiveSystemPreference() preference = self.portal.portal_preferences.getActiveSystemPreference()
preference.setPreferredCloudContractEnabled(True) preference.setPreferredCloudContractEnabled(True)
self.tic() self.tic()
self._makeComputer() self._makeComputeNode()
self.software_instance.setAggregate(self.partition.getRelativeUrl()) self.software_instance.setAggregate(self.partition.getRelativeUrl())
self.tic() self.tic()
......
...@@ -3,7 +3,7 @@ Cloud Contract Module | view ...@@ -3,7 +3,7 @@ Cloud Contract Module | view
Cloud Contract | view Cloud Contract | view
Computer Consumption TioXML File | download Computer Consumption TioXML File | download
Computer Consumption TioXML File | view Computer Consumption TioXML File | view
Computer | jump_to_consumption_report_view Compute Node | jump_to_consumption_report_view
Consumption Document Module | view Consumption Document Module | view
Instance Tree | jump_to_related_open_order_line Instance Tree | jump_to_related_open_order_line
Instance Tree | periodicity Instance Tree | periodicity
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Allocation of services is closed due to scheduled maintenance of the computer</string> </value> <value> <string>Allocation of services is closed due to scheduled maintenance of the compute_node</string> </value>
</item> </item>
<item> <item>
<key> <string>effective_date</string> </key> <key> <string>effective_date</string> </key>
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Allocation of services is closed because computer didn\'t communicate with master for too long</string> </value> <value> <string>Allocation of services is closed because compute_node didn\'t communicate with master for too long</string> </value>
</item> </item>
<item> <item>
<key> <string>effective_date</string> </key> <key> <string>effective_date</string> </key>
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Allocation of services is closed due to future termination of the computer</string> </value> <value> <string>Allocation of services is closed due to future termination of the compute_node</string> </value>
</item> </item>
<item> <item>
<key> <string>effective_date</string> </key> <key> <string>effective_date</string> </key>
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Allocate services for the owner of the friends of the computer</string> </value> <value> <string>Allocate services for the owner of the friends of the compute_node</string> </value>
</item> </item>
<item> <item>
<key> <string>effective_date</string> </key> <key> <string>effective_date</string> </key>
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Allocate services for the owner of the computer</string> </value> <value> <string>Allocate services for the owner of the compute_node</string> </value>
</item> </item>
<item> <item>
<key> <string>effective_date</string> </key> <key> <string>effective_date</string> </key>
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>used with getTotalPrice to computer the total of certain prices in an invoice</string> </value> <value> <string>used with getTotalPrice to compute_node the total of certain prices in an invoice</string> </value>
</item> </item>
<item> <item>
<key> <string>effective_date</string> </key> <key> <string>effective_date</string> </key>
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Computer is overloaded</string> </value> <value> <string>Compute Node is overloaded</string> </value>
</item> </item>
<item> <item>
<key> <string>effective_date</string> </key> <key> <string>effective_date</string> </key>
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Computer is OK</string> </value> <value> <string>Compute Node is OK</string> </value>
</item> </item>
<item> <item>
<key> <string>effective_date</string> </key> <key> <string>effective_date</string> </key>
......
...@@ -107,11 +107,11 @@ ...@@ -107,11 +107,11 @@
</item> </item>
<item> <item>
<key> <string>short_title</string> </key> <key> <string>short_title</string> </key>
<value> <string>Computer Maintenance</string> </value> <value> <string>Compute Node Maintenance</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computer Installation and Maintenance</string> </value> <value> <string>Compute Node Installation and Maintenance</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computer Maintenance Agent</string> </value> <value> <string>Compute Node Maintenance Agent</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computer Maintenance Manager</string> </value> <value> <string>Compute Node Maintenance Manager</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>A division in charge of providing location for hosting SlapOS computers</string> </value> <value> <string>A division in charge of providing location for hosting SlapOS compute_nodes</string> </value>
</item> </item>
<item> <item>
<key> <string>effective_date</string> </key> <key> <string>effective_date</string> </key>
......
...@@ -87,11 +87,11 @@ ...@@ -87,11 +87,11 @@
</item> </item>
<item> <item>
<key> <string>short_title</string> </key> <key> <string>short_title</string> </key>
<value> <string>Computer</string> </value> <value> <string>Compute Node</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computer Hardware</string> </value> <value> <string>Compute Node Hardware</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computer Hosting Contract</string> </value> <value> <string>Compute Node Hosting Contract</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computer</string> </value> <value> <string>Compute Node</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>computer_usage</string> </value> <value> <string>compute_node_usage</string> </value>
</item> </item>
<item> <item>
<key> <string>permissions</string> </key> <key> <string>permissions</string> </key>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computer Usage</string> </value> <value> <string>Compute Node Usage</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/Computer_viewCurrentUsageReport</string> </value> <value> <string>string:${object_url}/ComputeNode_viewCurrentUsageReport</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/Computer_viewCapacity</string> </value> <value> <string>string:${object_url}/ComputeNode_viewCapacity</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>view_computer_list</string> </value> <value> <string>view_compute_node_list</string> </value>
</item> </item>
<item> <item>
<key> <string>permissions</string> </key> <key> <string>permissions</string> </key>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computers</string> </value> <value> <string>Compute Nodes</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/ComputerNetwork_viewComputerList</string> </value> <value> <string>string:${object_url}/ComputerNetwork_viewComputeNodeList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>jump_to_computer_partition</string> </value> <value> <string>jump_to_compute_partition</string> </value>
</item> </item>
<item> <item>
<key> <string>permissions</string> </key> <key> <string>permissions</string> </key>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computer Partition</string> </value> <value> <string>Compute Partition</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:${object_url}/Base_jumpToRelatedObject?base_category=aggregate&portal_type:list=Computer+Partition string:${object_url}/Base_jumpToRelatedObject?base_category=aggregate&portal_type:list=Compute+Partition
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>usable_computer</string> </value> <value> <string>usable_compute_node</string> </value>
</item> </item>
<item> <item>
<key> <string>permissions</string> </key> <key> <string>permissions</string> </key>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Usable Computer</string> </value> <value> <string>Usable Compute Node</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/SoftwareRelease_viewUsableComputerListReport</string> </value> <value> <string>string:${object_url}/SoftwareRelease_viewUsableComputeNodeListReport</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</item> </item>
<item> <item>
<key> <string>acquisition_portal_type</string> </key> <key> <string>acquisition_portal_type</string> </key>
<value> <string>python: [\'Career\', \'Organisation\', \'Person\', \'Computer\']</string> </value> <value> <string>python: [\'Career\', \'Organisation\', \'Person\', \'Compute Node\']</string> </value>
</item> </item>
<item> <item>
<key> <string>acquisition_sync_value</string> </key> <key> <string>acquisition_sync_value</string> </key>
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</item> </item>
<item> <item>
<key> <string>acquisition_portal_type</string> </key> <key> <string>acquisition_portal_type</string> </key>
<value> <string>python: [\'Address\', \'Organisation\', \'Person\', \'Computer\']</string> </value> <value> <string>python: [\'Address\', \'Organisation\', \'Person\', \'Compute Node\']</string> </value>
</item> </item>
<item> <item>
<key> <string>acquisition_sync_value</string> </key> <key> <string>acquisition_sync_value</string> </key>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>acquisition_portal_type</string> </key> <key> <string>acquisition_portal_type</string> </key>
<value> <string>python: [\'Career\', \'Computer\']</string> </value> <value> <string>python: [\'Career\', \'Compute Node\']</string> </value>
</item> </item>
<item> <item>
<key> <string>acquisition_sync_value</string> </key> <key> <string>acquisition_sync_value</string> </key>
......
...@@ -31,28 +31,28 @@ from AccessControl.SecurityManagement import getSecurityManager, \ ...@@ -31,28 +31,28 @@ from AccessControl.SecurityManagement import getSecurityManager, \
from AccessControl import Unauthorized from AccessControl import Unauthorized
from DateTime import DateTime from DateTime import DateTime
def getComputerSecurityCategory(self, base_category_list, user_name, def getComputeNodeSecurityCategory(self, base_category_list, user_name,
ob, portal_type): ob, portal_type):
""" """
This script returns a list of dictionaries which represent This script returns a list of dictionaries which represent
the security groups which a computer is member of. the security groups which a compute_node is member of.
""" """
category_list = [] category_list = []
computer_list = self.portal_catalog.unrestrictedSearchResults( compute_node_list = self.portal_catalog.unrestrictedSearchResults(
portal_type='Computer', portal_type='Compute Node',
user_id=user_name, user_id=user_name,
validation_state="validated", validation_state="validated",
limit=2, limit=2,
) )
if len(computer_list) == 1: if len(compute_node_list) == 1:
for base_category in base_category_list: for base_category in base_category_list:
if base_category == "role": if base_category == "role":
category_list.append( category_list.append(
{base_category: ['role/computer']}) {base_category: ['role/computer']})
elif len(computer_list) > 1: elif len(compute_node_list) > 1:
raise ConsistencyError("Error: There is more than one Computer " \ raise ConsistencyError("Error: There is more than one Compute Node " \
"with reference '%s'" % user_name) "with reference '%s'" % user_name)
return category_list return category_list
...@@ -103,7 +103,7 @@ def restrictMethodAsShadowUser(self, shadow_document=None, callable_object=None, ...@@ -103,7 +103,7 @@ def restrictMethodAsShadowUser(self, shadow_document=None, callable_object=None,
raise TypeError('shadow_document and callable_object cannot be None') raise TypeError('shadow_document and callable_object cannot be None')
relative_url = shadow_document.getRelativeUrl() relative_url = shadow_document.getRelativeUrl()
if shadow_document.getPortalType() not in ('Person', 'Software Instance', if shadow_document.getPortalType() not in ('Person', 'Software Instance',
'Computer'): 'Compute Node'):
raise Unauthorized("%s portal type %r is not supported" % (relative_url, raise Unauthorized("%s portal type %r is not supported" % (relative_url,
shadow_document.getPortalType())) shadow_document.getPortalType()))
else: else:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Computer" module="erp5.portal_type"/> <global name="Compute Node" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -62,11 +62,11 @@ ...@@ -62,11 +62,11 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>template_computer</string> </value> <value> <string>template_compute_node</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Computer</string> </value> <value> <string>Compute Node</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>active_sense_method_id</string> </key> <key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_searchComputerPartitionAndMarkFree</string> </value> <value> <string>Alarm_searchComputePartitionAndMarkFree</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Automatically find computer partitions which can be marked as free</string> </value> <value> <string>Automatically find compute partitions which can be marked as free</string> </value>
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>slapos_free_computer_partition</string> </value> <value> <string>slapos_free_compute_partition</string> </value>
</item> </item>
<item> <item>
<key> <string>periodicity_hour</string> </key> <key> <string>periodicity_hour</string> </key>
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Mark computer partition as free</string> </value> <value> <string>Mark compute partition as free</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>active_sense_method_id</string> </key> <key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_managePublicComputerCapacityScope</string> </value> <value> <string>Alarm_managePublicComputeNodeCapacityScope</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>slapos_update_computer_capacity_scope</string> </value> <value> <string>slapos_update_compute_node_capacity_scope</string> </value>
</item> </item>
<item> <item>
<key> <string>periodicity_day_frequency</string> </key> <key> <string>periodicity_day_frequency</string> </key>
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Desactivate Dead Computer</string> </value> <value> <string>Desactivate Dead Compute Node</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>computer</string> </value> <value> <string>compute_node</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computer</string> </value> <value> <string>Compute Node</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<allowed_content_type_list> <allowed_content_type_list>
<portal_type id="Computer"> <portal_type id="Compute Node">
<item>Certificate Login</item> <item>Certificate Login</item>
<item>ERP5 Login</item> <item>ERP5 Login</item>
</portal_type> </portal_type>
......
<base_category_list> <base_category_list>
<portal_type id="Computer"> <portal_type id="Compute Node">
<item>destination_section</item> <item>destination_section</item>
<item>source_administration</item> <item>source_administration</item>
</portal_type> </portal_type>
......
...@@ -5,19 +5,19 @@ ...@@ -5,19 +5,19 @@
<portal_type id="Assignment"> <portal_type id="Assignment">
<item>SlaposAssignmentConstraint</item> <item>SlaposAssignmentConstraint</item>
</portal_type> </portal_type>
<portal_type id="Computer"> <portal_type id="Compute Node">
<item>ComputerSlapOSMetadata</item> <item>ComputeNodeSlapOSMetadata</item>
<item>ERP5User</item> <item>ERP5User</item>
<item>SlaposCapacity</item> <item>SlaposCapacity</item>
<item>SlaposComputerConstraint</item> <item>SlaposComputeNodeConstraint</item>
<item>Url</item> <item>Url</item>
</portal_type> </portal_type>
<portal_type id="Computer Model"> <portal_type id="Computer Model">
<item>SlaposCapacity</item> <item>SlaposCapacity</item>
</portal_type> </portal_type>
<portal_type id="Computer Partition"> <portal_type id="Compute Partition">
<item>ComputerPartition</item> <item>ComputePartition</item>
<item>SlaposComputerPartitionConstraint</item> <item>SlaposComputePartitionConstraint</item>
</portal_type> </portal_type>
<portal_type id="Email"> <portal_type id="Email">
<item>SlaposEmailConstraint</item> <item>SlaposEmailConstraint</item>
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
\n \n
ERP5 folders are implemented as CMFBTreeFolder objects\n ERP5 folders are implemented as CMFBTreeFolder objects\n
and can store up to a million documents on a standard\n and can store up to a million documents on a standard\n
computer.\n compute_node.\n
ERP5 folders will eventually use in the near future the\n ERP5 folders will eventually use in the near future the\n
AdaptableStorage implementation in order to reach performances\n AdaptableStorage implementation in order to reach performances\n
of 10 or 100 millions of documents in a single folder.\n of 10 or 100 millions of documents in a single folder.\n
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
\n \n
ERP5 folders are implemented as CMFBTreeFolder objects\n ERP5 folders are implemented as CMFBTreeFolder objects\n
and can store up to a million documents on a standard\n and can store up to a million documents on a standard\n
computer.\n compute_node.\n
ERP5 folders will eventually use in the near future the\n ERP5 folders will eventually use in the near future the\n
AdaptableStorage implementation in order to reach performances\n AdaptableStorage implementation in order to reach performances\n
of 10 or 100 millions of documents in a single folder.\n of 10 or 100 millions of documents in a single folder.\n
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
\n \n
ERP5 folders are implemented as CMFBTreeFolder objects\n ERP5 folders are implemented as CMFBTreeFolder objects\n
and can store up to a million documents on a standard\n and can store up to a million documents on a standard\n
computer.\n compute_node.\n
ERP5 folders will eventually use in the near future the\n ERP5 folders will eventually use in the near future the\n
AdaptableStorage implementation in order to reach performances\n AdaptableStorage implementation in order to reach performances\n
of 10 or 100 millions of documents in a single folder.\n of 10 or 100 millions of documents in a single folder.\n
......
<workflow_chain> <workflow_chain>
<chain> <chain>
<type>Computer</type> <type>Compute Node</type>
<workflow>computer_slap_interface_workflow, slapos_cloud_interaction_workflow</workflow> <workflow>compute_node_slap_interface_workflow, slapos_cloud_interaction_workflow</workflow>
</chain> </chain>
<chain> <chain>
<type>Computer Partition</type> <type>Compute Partition</type>
<workflow>computer_partition_slap_interface_workflow</workflow> <workflow>compute_partition_slap_interface_workflow</workflow>
</chain> </chain>
<chain> <chain>
<type>Hosting Subscription</type> <type>Hosting Subscription</type>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ComputerSlapOSMetadata</string> </value> <value> <string>ComputeNodeSlapOSMetadata</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ComputerPartition</string> </value> <value> <string>ComputePartition</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
</item> </item>
<item> <item>
<key> <string>acquisition_portal_type</string> </key> <key> <string>acquisition_portal_type</string> </key>
<value> <string>python: (\'Computer Partition\',)</string> </value> <value> <string>python: (\'Compute Partition\',)</string> </value>
</item> </item>
<item> <item>
<key> <string>acquisition_sync_value</string> </key> <key> <string>acquisition_sync_value</string> </key>
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>The unique identity of the computer in computer network.</string> </value> <value> <string>The unique identity of the compute_node in compute_node network.</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SlaposComputerConstraint</string> </value> <value> <string>SlaposComputeNodeConstraint</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SlaposComputerPartitionConstraint</string> </value> <value> <string>SlaposComputePartitionConstraint</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Computer Partition which is busy, shall have one aggregate related instance.</string> </value> <value> <string>Compute Partition which is busy, shall have one aggregate related instance.</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Computer Partition which is not busy, shall have none aggregate related instance.</string> </value> <value> <string>Compute Partition which is not busy, shall have none aggregate related instance.</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -7,10 +7,10 @@ category_uid_list = [ i.getUid() for i in category_list if i is not None] ...@@ -7,10 +7,10 @@ category_uid_list = [ i.getUid() for i in category_list if i is not None]
if category_uid_list: if category_uid_list:
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
portal_type='Computer', portal_type='Compute Node',
default_allocation_scope_uid=category_uid_list, default_allocation_scope_uid=category_uid_list,
validation_state="validated", validation_state="validated",
method_id='Computer_checkAndUpdateCapacityScope', method_id='ComputeNode_checkAndUpdateCapacityScope',
activate_kw={'tag': tag} activate_kw={'tag': tag}
) )
context.activate(after_tag=tag).getId() context.activate(after_tag=tag).getId()
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Alarm_computerCheckUpgradeSoftwareRelease</string> </value> <value> <string>Alarm_managePublicComputeNodeCapacityScope</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Alarm_managePublicComputerCapacityScope</string> </value> <value> <string>Alarm_searchComputePartitionAndMarkFree</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
compute_node = context.REQUEST.get('here')
software_release = context
return compute_node.ComputeNode_getSoftwareReleaseState(software_release.getUid())
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Base_getSoftwareReleaseStateOnComputer</string> </value> <value> <string>Base_getSoftwareReleaseStateOnComputeNode</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
computer = context.REQUEST.get('here')
software_release = context
return computer.Computer_getSoftwareReleaseState(software_release.getUid())
current = context.REQUEST.get('here') current = context.REQUEST.get('here')
if current.getPortalType() == 'Software Release': if current.getPortalType() == 'Software Release':
software_release = current software_release = current
computer = context compute_node = context
else: else:
computer = current compute_node = current
software_release = context software_release = context
return computer.Computer_getSoftwareReleaseUsage(software_release.getUrlString()) return compute_node.ComputeNode_getSoftwareReleaseUsage(software_release.getUrlString())
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Base_getSoftwareReleaseUsageOnComputer</string> </value> <value> <string>Base_getSoftwareReleaseUsageOnComputeNode</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ComputerModule_viewComputerList</string> </value> <value> <string>ComputeNodeModule_viewComputeNodeList</string> </value>
</item> </item>
<item> <item>
<key> <string>method</string> </key> <key> <string>method</string> </key>
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
</item> </item>
<item> <item>
<key> <string>name</string> </key> <key> <string>name</string> </key>
<value> <string>ComputerModule_viewComputerList</string> </value> <value> <string>ComputeNodeModule_viewComputeNodeList</string> </value>
</item> </item>
<item> <item>
<key> <string>pt</string> </key> <key> <string>pt</string> </key>
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computers</string> </value> <value> <string>Compute Nodes</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode_mode</string> </key> <key> <string>unicode_mode</string> </key>
......
...@@ -115,8 +115,8 @@ ...@@ -115,8 +115,8 @@
<string>Capacity Quantity</string> <string>Capacity Quantity</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Computer_getFreeComputerPartitionCount</string> <string>ComputeNode_getFreeComputePartitionCount</string>
<string>Free Computer Partition</string> <string>Free Compute Partition</string>
</tuple> </tuple>
<tuple> <tuple>
<string>subordination_title</string> <string>subordination_title</string>
...@@ -204,8 +204,8 @@ ...@@ -204,8 +204,8 @@
<value> <value>
<list> <list>
<tuple> <tuple>
<string>Computer</string> <string>Compute Node</string>
<string>Computer</string> <string>Compute Node</string>
</tuple> </tuple>
</list> </list>
</value> </value>
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>selection_name</string> </key> <key> <string>selection_name</string> </key>
<value> <string>computer_list_selection</string> </value> <value> <string>compute_node_list_selection</string> </value>
</item> </item>
<item> <item>
<key> <string>sort_columns</string> </key> <key> <string>sort_columns</string> </key>
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Computers</string> </value> <value> <string>Compute Nodes</string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
......
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: cell.Computer_getRemainingQuantity()</string> </value> <value> <string>python: cell.ComputeNode_getRemainingQuantity()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
"""Hook called when a computer object is closed. """Hook called when a compute_node object is closed.
We want to reset reference, which is the user login in ERP5Security. We want to reset reference, which is the user login in ERP5Security.
One exception is when a person object is installed from business template. One exception is when a person object is installed from business template.
""" """
if context.getPortalType() != "Computer": if context.getPortalType() != "Compute Node":
return return
context.setUserId(None) context.setUserId(None)
context.Computer_initUserId() context.ComputeNode_initUserId()
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Computer_afterClone</string> </value> <value> <string>ComputeNode_afterClone</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
computer = context compute_node = context
Base_translateString = context.Base_translateString Base_translateString = context.Base_translateString
computer_model_portal_type = 'Computer Model' computer_model_portal_type = 'Computer Model'
computer_model = computer.getSpecialiseValue( computer_model = compute_node.getSpecialiseValue(
portal_type=computer_model_portal_type) portal_type=computer_model_portal_type)
if computer_model is None: if computer_model is None:
...@@ -32,19 +32,19 @@ else : ...@@ -32,19 +32,19 @@ else :
new_category_dict = {} new_category_dict = {}
for category in category_list: for category in category_list:
if force or not computer.getPropertyList(category): if force or not compute_node.getPropertyList(category):
v = computer_model.getPropertyList(category) v = computer_model.getPropertyList(category)
if v: if v:
new_category_dict[category] = v new_category_dict[category] = v
for _property in property_list: for _property in property_list:
if force or not computer.getProperty(_property): if force or not compute_node.getProperty(_property):
v = computer_model.getProperty(_property) v = computer_model.getProperty(_property)
if v: if v:
new_category_dict[_property] = v new_category_dict[_property] = v
if new_category_dict: if new_category_dict:
computer.edit(**new_category_dict) compute_node.edit(**new_category_dict)
message = Base_translateString('Computer Model applied.') message = Base_translateString('Computer Model applied.')
result = True result = True
else: else:
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Computer_applyComputerModel</string> </value> <value> <string>ComputeNode_applyComputerModel</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
import json import json
computer = context compute_node = context
portal = context.getPortalObject() portal = context.getPortalObject()
from zExceptions import Unauthorized from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized raise Unauthorized
if computer.getAllocationScope() not in ['open/public', 'open/subscription']: if compute_node.getAllocationScope() not in ['open/public', 'open/subscription']:
# Don't update non public computer # Don't update non public compute_node
return return
can_allocate = True can_allocate = True
comment = '' comment = ''
# First and simple way to see if computer is dead # First and simple way to see if compute_node is dead
# modification_date = portal.portal_workflow.getInfoFor(computer, 'time', wf_id='edit_workflow') # modification_date = portal.portal_workflow.getInfoFor(compute_node, 'time', wf_id='edit_workflow')
# if (DateTime() - modification_date) > 1: # if (DateTime() - modification_date) > 1:
# # Computer didn't talk to vifib for 1 days, do not consider it as a trustable public server for now # # Compute Node didn't talk to vifib for 1 days, do not consider it as a trustable public server for now
# # slapformat is supposed to run at least once per day # # slapformat is supposed to run at least once per day
# can_allocate = False # can_allocate = False
# comment = "Computer didn't contact the server for more than one day" # comment = "Compute Node didn't contact the server for more than one day"
if can_allocate: if can_allocate:
# Check if computer has error reported # Check if compute_node has error reported
memcached_dict = context.Base_getSlapToolMemcachedDict() memcached_dict = context.Base_getSlapToolMemcachedDict()
try: try:
d = memcached_dict[computer.getReference()] d = memcached_dict[compute_node.getReference()]
except KeyError: except KeyError:
can_allocate = False can_allocate = False
comment = "Computer didn't contact the server" comment = "Compute Node didn't contact the server"
else: else:
log_dict = json.loads(d) log_dict = json.loads(d)
if '#error' in log_dict.get('text', '#error'): if '#error' in log_dict.get('text', '#error'):
can_allocate = False can_allocate = False
comment = 'Computer reported an error' comment = 'Compute Node reported an error'
# XXX TODO: compare creation date of #ok message # XXX TODO: compare creation date of #ok message
elif int(DateTime()) - int(DateTime(log_dict.get('created_at'))) > 600: elif int(DateTime()) - int(DateTime(log_dict.get('created_at'))) > 600:
can_allocate = False can_allocate = False
comment = "Computer didn't contact for more than 10 minutes" comment = "Compute Node didn't contact for more than 10 minutes"
if can_allocate: if can_allocate:
# Check the computer capacity. # Check the compute_node capacity.
# there is a arbitrary hardcoded default value: not more than 1000000 (!) instances on # there is a arbitrary hardcoded default value: not more than 1000000 (!) instances on
# a computer. # a compute_node.
default_maximum_value = 1000000 default_maximum_value = 1000000
computer_capacity_quantity = computer.getCapacityQuantity(default_maximum_value) compute_node_capacity_quantity = compute_node.getCapacityQuantity(default_maximum_value)
if computer_capacity_quantity == default_maximum_value: if compute_node_capacity_quantity == default_maximum_value:
# Verify if Computer Model defines it: # Verify if Computer Model defines it:
computer_model = computer.getSpecialiseValue(portal_type='Computer Model') computer_model = compute_node.getSpecialiseValue(portal_type='Computer Model')
if computer_model is not None: if computer_model is not None:
computer_capacity_quantity = computer_model.getCapacityQuantity(default_maximum_value) compute_node_capacity_quantity = computer_model.getCapacityQuantity(default_maximum_value)
# The update the computer with the initial value. # The update the compute_node with the initial value.
if computer_capacity_quantity != default_maximum_value: if compute_node_capacity_quantity != default_maximum_value:
computer.edit(capacity_quantity=computer_capacity_quantity) compute_node.edit(capacity_quantity=compute_node_capacity_quantity)
software_release_capacity_dict = {} software_release_capacity_dict = {}
consumed_capacity = 0 consumed_capacity = 0
...@@ -94,27 +94,27 @@ if can_allocate: ...@@ -94,27 +94,27 @@ if can_allocate:
if allocated_instance is not None: if allocated_instance is not None:
software_release_capacity = getSoftwareReleaseCapacity(allocated_instance) software_release_capacity = getSoftwareReleaseCapacity(allocated_instance)
consumed_capacity += software_release_capacity consumed_capacity += software_release_capacity
if consumed_capacity >= computer_capacity_quantity: if consumed_capacity >= compute_node_capacity_quantity:
can_allocate = False can_allocate = False
comment = 'Computer capacity limit exceeded (%s >= %s)' % (consumed_capacity, computer_capacity_quantity) comment = 'Compute Node capacity limit exceeded (%s >= %s)' % (consumed_capacity, compute_node_capacity_quantity)
if can_allocate: if can_allocate:
for instance in portal.portal_catalog.portal_catalog( for instance in portal.portal_catalog.portal_catalog(
default_aggregate_relative_url='%s/%%' % computer.getRelativeUrl(), default_aggregate_relative_url='%s/%%' % compute_node.getRelativeUrl(),
portal_type=['Software Instance', 'Slave Instance'], portal_type=['Software Instance', 'Slave Instance'],
validation_state='validated'): validation_state='validated'):
software_release_capacity = getSoftwareReleaseCapacity(instance.getObject()) software_release_capacity = getSoftwareReleaseCapacity(instance.getObject())
consumed_capacity += software_release_capacity consumed_capacity += software_release_capacity
if consumed_capacity >= computer_capacity_quantity: if consumed_capacity >= compute_node_capacity_quantity:
can_allocate = False can_allocate = False
comment = 'Computer capacity limit exceeded' comment = 'Compute Node capacity limit exceeded'
break break
# if can_allocate: # if can_allocate:
# result_list = portal.portal_catalog.portal_catalog( # result_list = portal.portal_catalog.portal_catalog(
# parent_uid=computer.getUid(), # parent_uid=compute_node.getUid(),
# portal_type='Computer Partition', # portal_type='Compute Partition',
# free_for_request=1, # free_for_request=1,
# limit=1) # limit=1)
# if len(result_list) == 0: # if len(result_list) == 0:
...@@ -123,13 +123,13 @@ if can_allocate: ...@@ -123,13 +123,13 @@ if can_allocate:
new_value = None new_value = None
if can_allocate: if can_allocate:
if computer.getCapacityScope() == 'close': if compute_node.getCapacityScope() == 'close':
new_value = 'open' new_value = 'open'
else: else:
if computer.getCapacityScope() == 'open': if compute_node.getCapacityScope() == 'open':
new_value = 'close' new_value = 'close'
if new_value is not None: if new_value is not None:
computer.edit(capacity_scope=new_value) compute_node.edit(capacity_scope=new_value)
if comment: if comment:
portal.portal_workflow.doActionFor(computer, 'edit_action', comment=comment) portal.portal_workflow.doActionFor(compute_node, 'edit_action', comment=comment)
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Computer_checkAndUpdateCapacityScope</string> </value> <value> <string>ComputeNode_checkAndUpdateCapacityScope</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment