Commit 1809c9d1 authored by Rafael Monnerat's avatar Rafael Monnerat

Migrate Computer to Compute Node

See merge request nexedi/slapos.core!328
parents 8fd14906 690080dc
......@@ -36,12 +36,12 @@ def ComputerConsumptionTioXMLFile_parseXml(self, REQUEST=None):
raise Unauthorized
xml = self.getData("")
computer_consumption_model = \
compute_node_consumption_model = \
pkg_resources.resource_string(
'slapos.slap', 'doc/computer_consumption.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 = etree.XMLSchema(xmlschema_doc)
......
......@@ -101,7 +101,7 @@
<key> <string>aggregated_portal_type</string> </key>
<value>
<tuple>
<string>Computer Partition</string>
<string>Compute Partition</string>
<string>Slave Instance</string>
<string>Software Instance</string>
</tuple>
......
......@@ -74,7 +74,7 @@
<key> <string>aggregated_portal_type</string> </key>
<value>
<tuple>
<string>Computer Partition</string>
<string>Compute Partition</string>
<string>Instance Tree</string>
<string>Software Instance</string>
<string>Software Release</string>
......@@ -121,7 +121,7 @@
<key> <string>required_aggregated_portal_type</string> </key>
<value>
<tuple>
<string>Computer Partition</string>
<string>Compute Partition</string>
<string>Instance Tree</string>
<string>Software Instance</string>
<string>Software Release</string>
......
......@@ -74,7 +74,7 @@
<key> <string>aggregated_portal_type</string> </key>
<value>
<tuple>
<string>Computer Partition</string>
<string>Compute Partition</string>
<string>Slave Instance</string>
<string>Software Instance</string>
</tuple>
......
......@@ -74,7 +74,7 @@
<key> <string>aggregated_portal_type</string> </key>
<value>
<tuple>
<string>Computer Partition</string>
<string>Compute Partition</string>
<string>Instance Tree</string>
<string>Software Instance</string>
<string>Software Release</string>
......@@ -121,7 +121,7 @@
<key> <string>required_aggregated_portal_type</string> </key>
<value>
<tuple>
<string>Computer Partition</string>
<string>Compute Partition</string>
<string>Instance Tree</string>
<string>Software Instance</string>
<string>Software Release</string>
......
......@@ -74,7 +74,7 @@
<key> <string>aggregated_portal_type</string> </key>
<value>
<tuple>
<string>Computer Partition</string>
<string>Compute Partition</string>
<string>Instance Tree</string>
<string>Software Instance</string>
<string>Software Release</string>
......@@ -121,7 +121,7 @@
<key> <string>required_aggregated_portal_type</string> </key>
<value>
<tuple>
<string>Computer Partition</string>
<string>Compute Partition</string>
<string>Instance Tree</string>
<string>Software Instance</string>
<string>Software Release</string>
......
......@@ -31,7 +31,7 @@ select_kw.update(
select_dict=select_dict,
left_join_list=select_dict.keys(),
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"),
grouping_reference=None,
sort_on=(('modification_date', 'ASC'),) # the highest chance to find movement which can be delivered
......
portal = context.getPortalObject()
if context.getPortalType() == "Computer":
if context.getPortalType() == "Compute Node":
# Get the Latest Sale Packing List
sale_packing_list_line = portal.portal_catalog.getResultValue(
......@@ -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')
# 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 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Computer_getLatestCPUPercentLoad</string> </value>
<value> <string>ComputeNode_getLatestCPUPercentLoad</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -8,7 +8,7 @@ model_id = context.getWattConsumptionModel("no_model")
# Introduce your Consumption Model here
######
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:
return 21.5 + 1.06*load
......@@ -16,7 +16,7 @@ def consumption_model_shuttle_ds61_i7(load):
return 48 + 0.29*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:
return 8.5 + 0.46*load
......@@ -24,7 +24,7 @@ def consumption_model_shuttle_nuc_i7(load):
return 20 + 0.08*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:
return 2.2 + 0.04*load
......@@ -40,7 +40,7 @@ model_map = {
"intel_nuc_i7": consumption_model_shuttle_nuc_i7
}
if cpu_load_percentage is None:
cpu_load_percentage = context.Computer_getLatestCPUPercentLoad()
cpu_load_percentage = context.ComputeNode_getLatestCPUPercentLoad()
cpu_load_percentage += partition_increment
......
......@@ -62,7 +62,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Computer_getWattConsumption</string> </value>
<value> <string>ComputeNode_getWattConsumption</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -62,7 +62,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Project_getComputerReferenceList</string> </value>
<value> <string>ComputeNode_getZeroEmissionRatio</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -3,22 +3,22 @@ if REQUEST is not None:
raise Unauthorized
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(
id_group=('slap_tioxml_consumption_reference', reference), default=1)
document = portal.consumption_document_module.newContent(
portal_type="Computer Consumption TioXML File",
source_reference=source_reference,
title="%s consumption (%s)" % (computer.getReference(), source_reference),
title="%s consumption (%s)" % (compute_node.getReference(), source_reference),
reference=reference,
version=version,
data=consumption_xml,
classification="personal",
publication_section="other",
contributor_value=computer,
contributor_value=compute_node,
)
document.submit()
return document.getRelativeUrl()
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Computer_reportComputerConsumption</string> </value>
<value> <string>ComputeNode_reportComputeNodeConsumption</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -19,33 +19,33 @@ if tioxml_dict is None:
document.reject(comment="Not usable TioXML data")
else:
computer = context.getContributorValue(portal_type="Computer")
computer_project_document = computer.Item_getCurrentProjectValue()
compute_node = context.getContributorValue(portal_type="Compute Node")
compute_node_project_document = compute_node.Item_getCurrentProjectValue()
delivery_title = tioxml_dict['title']
computer_project = None
if computer_project_document is not None:
computer_project = computer_project_document.getRelativeUrl()
compute_node_project = None
if compute_node_project_document is not None:
compute_node_project = compute_node_project_document.getRelativeUrl()
movement_list = []
for movement in tioxml_dict["movement"]:
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.
if computer.getReference() == reference:
aggregate_value_list = [computer]
person = computer.getSourceAdministrationValue(portal_type="Person")
project = computer_project
if compute_node.getReference() == reference:
aggregate_value_list = [compute_node]
person = compute_node.getSourceAdministrationValue(portal_type="Person")
project = compute_node_project
else:
project = None # For now, else we should calculate this too.
if reference.startswith("slapuser"):
reference = reference.replace("slapuser", "slappart")
# Find the partition / software instance / user
partition = portal.portal_catalog.getResultValue(
parent_uid=computer.getUid(),
parent_uid=compute_node.getUid(),
reference=reference,
portal_type="Computer Partition",
portal_type="Compute Partition",
validation_state="validated")
if partition.getSlapState() != 'busy':
......@@ -85,7 +85,7 @@ else:
)
# Time to create the PL
person = computer.getSourceAdministrationValue(portal_type="Person")
person = compute_node.getSourceAdministrationValue(portal_type="Person")
delivery_template = portal.restrictedTraverse(
portal.portal_preferences.getPreferredInstanceDeliveryTemplate())
delivery = delivery_template.Base_createCloneDocument(batch_mode=1)
......
......@@ -41,7 +41,7 @@ elif context.getPortalType() == 'Person':
else:
return []
elif context.getPortalType() in ['Software Instance', 'Instance Tree',
'Computer']:
'Compute Node']:
query_kw['aggregate_uid'] = context.getUid()
else:
return []
......@@ -69,17 +69,17 @@ def setDetailLine(packing_list_line):
portal_type='Instance Tree')
software_instance = packing_list_line.getAggregateValue(
portal_type='Software Instance')
computer_partition = packing_list_line.getAggregateValue(
portal_type='Computer Partition')
compute_partition = packing_list_line.getAggregateValue(
portal_type='Compute Partition')
if software_instance is None:
# In case we found SPL line not aggregated to instance and hosting
return
instance_tree_reference = hosting_s.getReference()
instance_reference = software_instance.getReference()
computer_title = ""
if computer_partition is not None:
computer = computer_partition.getParent()
computer_title = computer.getTitle() if computer.getCpuCore() is None else '%s (%s CPU Cores)' % (computer.getTitle(), computer.getCpuCore())
compute_node_title = ""
if compute_partition is not None:
compute_node = compute_partition.getParent()
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'] ] } ] } }
if not start_date in consumption_dict:
# Add new date line
......@@ -89,7 +89,7 @@ def setDetailLine(packing_list_line):
[software_instance.getTitle(),
[0.0, 0.0, 0.0],
software_instance.getRelativeUrl(),
computer_title
compute_node_title
]
},
hosting_s.getRelativeUrl()
......@@ -102,7 +102,7 @@ def setDetailLine(packing_list_line):
[software_instance.getTitle(),
[0.0, 0.0, 0.0],
software_instance.getRelativeUrl(),
computer_title
compute_node_title
]
},
hosting_s.getRelativeUrl()
......@@ -111,7 +111,7 @@ def setDetailLine(packing_list_line):
if not instance_reference in consumption_dict[start_date][instance_tree_reference][1]:
consumption_dict[start_date][instance_tree_reference][1][instance_reference] = [
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:
quantity = round(float(packing_list_line.getQuantity()), 3)
......@@ -134,7 +134,7 @@ for date in sorted(consumption_dict, reverse=True):
for hosting_key in sorted(consumption_dict[date]):
instance_tree_title, instance_dict, hs_url = consumption_dict[date][hosting_key]
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.edit(
title=instance_tree_title,
......@@ -143,7 +143,7 @@ for date in sorted(consumption_dict, reverse=True):
cpu_load=values[0],
memory_used=values[1],
disk_used=values[2],
computer_title=computer_title,
compute_node_title=compute_node_title,
hosting_url=hs_url,
instance_url=instance_url
)
......
......@@ -408,8 +408,8 @@
<string>Software Instance</string>
</tuple>
<tuple>
<string>computer_title</string>
<string>Computer</string>
<string>compute_node_title</string>
<string>Compute Node</string>
</tuple>
<tuple>
<string>start_date</string>
......
......@@ -408,8 +408,8 @@
<string>Software Instance</string>
</tuple>
<tuple>
<string>computer_title</string>
<string>Computer</string>
<string>compute_node_title</string>
<string>Compute Node</string>
</tuple>
<tuple>
<string>start_date</string>
......
......@@ -2,10 +2,10 @@ from zExceptions import Unauthorized
if REQUEST is not None:
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(
computer_partition_list, context.SoftwareInstance_getAverageCPULoad()
compute_partition_list, context.SoftwareInstance_getAverageCPULoad()
)
return current_watt.keys()[0]
......@@ -2,14 +2,14 @@ from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
computer_partition_list = context.getAggregateValueList(portal_type="Computer Partition")
compute_partition_list = context.getAggregateValueList(portal_type="Compute Partition")
future_watt = "Not Applicable"
master_node = context.SoftwareInstance_getResilientMasterNode()
if master_node is not None:
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]
......
computer_partition_list = context.getAggregateValueList(portal_type="Computer Partition")
compute_partition_list = context.getAggregateValueList(portal_type="Compute Partition")
master_node = context.SoftwareInstance_getResilientMasterNode()
current_watt = context.SoftwareRelease_getDeltaCO2List(
computer_partition_list, context.SoftwareInstance_getAverageCPULoad()
compute_partition_list, context.SoftwareInstance_getAverageCPULoad()
)
current_watt = current_watt.keys()
master_node = context.SoftwareInstance_getResilientMasterNode()
if master_node is not None:
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]
......
......@@ -9,22 +9,22 @@ else:
partition_delta_co2_dict = {}
for computer_partition in computer_partition_list:
computer = computer_partition.getParentValue()
computer_zero_emission_ratio = computer.Computer_getZeroEmissionRatio()
computer_cpu_load_percentage = computer.Computer_getLatestCPUPercentLoad()
computer_watt = computer.Computer_getWattConsumption(computer_cpu_load_percentage)
for compute_partition in compute_partition_list:
compute_node = compute_partition.getParentValue()
compute_node_zero_emission_ratio = compute_node.ComputeNode_getZeroEmissionRatio()
compute_node_cpu_load_percentage = compute_node.ComputeNode_getLatestCPUPercentLoad()
compute_node_watt = compute_node.ComputeNode_getWattConsumption(compute_node_cpu_load_percentage)
partition_watt = computer.Computer_getWattConsumption(
computer_cpu_load_percentage + partition_average_cpu_load)
partition_watt = compute_node.ComputeNode_getWattConsumption(
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:
partition_delta_co2_dict[delta_co2].append(computer_partition)
partition_delta_co2_dict[delta_co2].append(compute_partition)
else:
partition_delta_co2_dict[delta_co2] = [computer_partition]
partition_delta_co2_dict[delta_co2] = [compute_partition]
return partition_delta_co2_dict
......@@ -50,7 +50,7 @@
</item>
<item>
<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>
<key> <string>id</string> </key>
......
......@@ -406,8 +406,8 @@
<string>Software Instance</string>
</tuple>
<tuple>
<string>computer_title</string>
<string>Computer</string>
<string>compute_node_title</string>
<string>Compute Node</string>
</tuple>
<tuple>
<string>start_date</string>
......
......@@ -57,7 +57,7 @@ class TestSlapOSRequestValidationPayment(SlapOSTestCaseMixin):
preference = self.portal.portal_preferences.getActiveSystemPreference()
preference.setPreferredCloudContractEnabled(True)
self.tic()
self._makeComputer()
self._makeComputeNode()
self.software_instance.setAggregate(self.partition.getRelativeUrl())
self.tic()
......@@ -73,7 +73,7 @@ class TestSlapOSRequestValidationPayment(SlapOSTestCaseMixin):
preference = self.portal.portal_preferences.getActiveSystemPreference()
preference.setPreferredCloudContractEnabled(True)
self.tic()
self._makeComputer()
self._makeComputeNode()
self.software_instance.setAggregate(self.partition.getRelativeUrl())
self.tic()
......
......@@ -3,7 +3,7 @@ Cloud Contract Module | view
Cloud Contract | view
Computer Consumption TioXML File | download
Computer Consumption TioXML File | view
Computer | jump_to_consumption_report_view
Compute Node | jump_to_consumption_report_view
Consumption Document Module | view
Instance Tree | jump_to_related_open_order_line
Instance Tree | periodicity
......
......@@ -55,7 +55,7 @@
</item>
<item>
<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>
<key> <string>effective_date</string> </key>
......
......@@ -63,7 +63,7 @@
</item>
<item>
<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>
<key> <string>effective_date</string> </key>
......
......@@ -55,7 +55,7 @@
</item>
<item>
<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>
<key> <string>effective_date</string> </key>
......
......@@ -55,7 +55,7 @@
</item>
<item>
<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>
<key> <string>effective_date</string> </key>
......
......@@ -55,7 +55,7 @@
</item>
<item>
<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>
<key> <string>effective_date</string> </key>
......
......@@ -89,7 +89,7 @@
</item>
<item>
<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>
<key> <string>effective_date</string> </key>
......
......@@ -55,7 +55,7 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Computer is overloaded</string> </value>
<value> <string>Compute Node is overloaded</string> </value>
</item>
<item>
<key> <string>effective_date</string> </key>
......
......@@ -55,7 +55,7 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Computer is OK</string> </value>
<value> <string>Compute Node is OK</string> </value>
</item>
<item>
<key> <string>effective_date</string> </key>
......
......@@ -107,11 +107,11 @@
</item>
<item>
<key> <string>short_title</string> </key>
<value> <string>Computer Maintenance</string> </value>
<value> <string>Compute Node Maintenance</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Computer Installation and Maintenance</string> </value>
<value> <string>Compute Node Installation and Maintenance</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -89,7 +89,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Computer Maintenance Agent</string> </value>
<value> <string>Compute Node Maintenance Agent</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -89,7 +89,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Computer Maintenance Manager</string> </value>
<value> <string>Compute Node Maintenance Manager</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -83,7 +83,7 @@
</item>
<item>
<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>
<key> <string>effective_date</string> </key>
......
......@@ -87,11 +87,11 @@
</item>
<item>
<key> <string>short_title</string> </key>
<value> <string>Computer</string> </value>
<value> <string>Compute Node</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Computer Hardware</string> </value>
<value> <string>Compute Node Hardware</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -73,7 +73,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Computer Hosting Contract</string> </value>
<value> <string>Compute Node Hosting Contract</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -73,7 +73,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Computer</string> </value>
<value> <string>Compute Node</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -40,7 +40,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>computer_usage</string> </value>
<value> <string>compute_node_usage</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
......@@ -60,7 +60,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Computer Usage</string> </value>
<value> <string>Compute Node Usage</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......@@ -77,7 +77,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Computer_viewCurrentUsageReport</string> </value>
<value> <string>string:${object_url}/ComputeNode_viewCurrentUsageReport</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -73,7 +73,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Computer_viewCapacity</string> </value>
<value> <string>string:${object_url}/ComputeNode_viewCapacity</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -40,7 +40,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view_computer_list</string> </value>
<value> <string>view_compute_node_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
......@@ -60,7 +60,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Computers</string> </value>
<value> <string>Compute Nodes</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......@@ -77,7 +77,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/ComputerNetwork_viewComputerList</string> </value>
<value> <string>string:${object_url}/ComputerNetwork_viewComputeNodeList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -40,7 +40,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jump_to_computer_partition</string> </value>
<value> <string>jump_to_compute_partition</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
......@@ -60,7 +60,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Computer Partition</string> </value>
<value> <string>Compute Partition</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......@@ -79,7 +79,7 @@
<key> <string>text</string> </key>
<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>
</item>
......
......@@ -40,7 +40,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>usable_computer</string> </value>
<value> <string>usable_compute_node</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
......@@ -60,7 +60,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Usable Computer</string> </value>
<value> <string>Usable Compute Node</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......@@ -77,7 +77,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SoftwareRelease_viewUsableComputerListReport</string> </value>
<value> <string>string:${object_url}/SoftwareRelease_viewUsableComputeNodeListReport</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -53,7 +53,7 @@
</item>
<item>
<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>
<key> <string>acquisition_sync_value</string> </key>
......
......@@ -55,7 +55,7 @@
</item>
<item>
<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>
<key> <string>acquisition_sync_value</string> </key>
......
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>acquisition_portal_type</string> </key>
<value> <string>python: [\'Career\', \'Computer\']</string> </value>
<value> <string>python: [\'Career\', \'Compute Node\']</string> </value>
</item>
<item>
<key> <string>acquisition_sync_value</string> </key>
......
......@@ -32,10 +32,25 @@ from Products.ERP5Security import SUPER_USER
from zExceptions import Unauthorized
from DateTime import DateTime
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Acquisition import aq_base
# from erp5.portal_type import InstanceTree
from Acquisition import aq_base, aq_inner
def cloneDocumentWithANewPortalType(obj, portal_type):
import erp5.portal_type
klass = getattr(erp5.portal_type, portal_type)
obj = aq_base(obj)
new_obj = klass(obj.id)
# raise NotImplementedError(str(obj.__dict__.keys()))
for key in obj.__dict__.keys():
if key not in ('meta_type', 'portal_type', '__class__'):
setattr(new_obj, key, obj.__dict__[key])
new_obj.portal_type = portal_type
return new_obj
def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
comment=None):
......@@ -121,27 +136,103 @@ def HostingSubscription_checkInstanceTreeMigrationConsistency(self, fixit=False)
hosting_subscription_id = self.getId()
hosting_subscription_relative_url = self.getRelativeUrl()
self.getParentValue()._delObject(hosting_subscription_id)
container = aq_inner(self.getParentValue())
self = cloneDocumentWithANewPortalType(self, 'Instance Tree')
container._delObject(hosting_subscription_id)
portal.instance_tree_module._setOb(hosting_subscription_id, self)
instance_tree = portal.instance_tree_module.restrictedTraverse(hosting_subscription_id)
self.__class__ = klass
# self.upgradeObjectClass(returnTrue, 'erp5.portal_type.Hosting Subscription', 'erp5.portal_type.Instance Tree', returnTrue)
self.portal_type = 'Instance Tree'
assert self.getPortalType() == 'Instance Tree'
assert instance_tree.getPortalType() == 'Instance Tree'
if (getattr(self, 'workflow_history', None) is not None) and \
('hosting_subscription_workflow' in self.workflow_history):
self.workflow_history['instance_tree_workflow'] = self.workflow_history.pop('hosting_subscription_workflow')
if (getattr(instance_tree, 'workflow_history', None) is not None) and \
('hosting_subscription_workflow' in instance_tree.workflow_history):
instance_tree.workflow_history['instance_tree_workflow'] = instance_tree.workflow_history.pop('hosting_subscription_workflow')
portal.instance_tree_module._setOb(hosting_subscription_id, aq_base(self))
instance_tree = portal.instance_tree_module._getOb(hosting_subscription_id)
instance_tree.reindexObject()
instance_tree.activate(after_method_id="unindexObject").reindexObject()
# Migrate Predecessor/Successor if the instance wasn't migrated before.
instance_tree.SoftwareInstance_checkPredecessorToSuccessorMigrationConsistency(fixit=True)
UnrestrictedMethod(instance_tree.Base_updateRelatedContentWithoutReindextion)(hosting_subscription_relative_url, instance_tree.getRelativeUrl())
return error_list
def ComputerPartition_checkComputePartitionMigrationConsistency(self, fixit=False):
error_list = []
import erp5.portal_type
klass = getattr(erp5.portal_type, 'Compute Partition')
if ((getattr(self, 'workflow_history', None) is not None) and
('computer_partition_slap_interface_workflow' in self.workflow_history)) or \
((self.__class__ == klass) and (self.getPortalType() == 'Computer Partition')) or \
((self.getParentValue().getPortalType() == 'Compute Node') and (self.getPortalType() == 'Computer Partition')):
if fixit:
assert self.getPortalType() == 'Computer Partition'
container = aq_inner(self.getParentValue())
partition_id = self.getId()
self = cloneDocumentWithANewPortalType(self, 'Compute Partition')
container._delObject(partition_id)
container._setOb(partition_id, self)
compute_partition = container.restrictedTraverse(partition_id)
assert compute_partition.getPortalType() == 'Compute Partition'
if (getattr(compute_partition, 'workflow_history', None) is not None) and \
('computer_partition_slap_interface_workflow' in compute_partition.workflow_history):
compute_partition.workflow_history['compute_partition_slap_interface_workflow'] = compute_partition.workflow_history.pop('computer_partition_slap_interface_workflow')
compute_partition.activate(after_method_id="unindexObject").reindexObject()
else:
error_list.append('Computer Partition must be migrated to a Compute Partition')
return error_list
def Computer_checkComputeNodeMigrationConsistency(self, fixit=False):
error_list = []
portal = self.getPortalObject()
if self.getParentValue().getId() != "computer_module":
# Skip if the document isn't on the computer_module
return error_list
import erp5.portal_type
klass = getattr(erp5.portal_type, 'Compute Node')
if ((getattr(self, 'workflow_history', None) is not None) and
('computer_slap_interface_workflow' in self.workflow_history)) or \
(self.__class__ == klass):
if fixit:
assert self.getPortalType() == 'Computer'
computer_id = self.getId()
computer_relative_url = self.getRelativeUrl()
container = aq_inner(self.getParentValue())
self = cloneDocumentWithANewPortalType(self, 'Compute Node')
container._delObject(computer_id)
assert self.getPortalType() == 'Compute Node'
if (getattr(self, 'workflow_history', None) is not None) and \
('computer_slap_interface_workflow' in self.workflow_history):
self.workflow_history['compute_node_slap_interface_workflow'] = self.workflow_history.pop('computer_slap_interface_workflow')
portal.compute_node_module._setOb(computer_id, self)
compute_node = portal.compute_node_module.restrictedTraverse(computer_id)
for sub_obj in compute_node.contentValues():
sub_obj.activate().fixConsistency()
compute_node.activate(after_method_id="unindexObject").recursiveReindexObject()
UnrestrictedMethod(compute_node.Base_updateRelatedContentWithoutReindextion)(computer_relative_url, compute_node.getRelativeUrl())
else:
error_list.append('Computer must be migrated to a Compute Node')
return error_list
def Base_updateRelatedContentWithoutReindextion(self, previous_category_url, new_category_url, REQUEST=None):
""" This method indeed reimplements the updateRelatedContent but it uses
......
......@@ -31,28 +31,28 @@ from AccessControl.SecurityManagement import getSecurityManager, \
from AccessControl import Unauthorized
from DateTime import DateTime
def getComputerSecurityCategory(self, base_category_list, user_name,
def getComputeNodeSecurityCategory(self, base_category_list, user_name,
ob, portal_type):
"""
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 = []
computer_list = self.portal_catalog.unrestrictedSearchResults(
portal_type='Computer',
compute_node_list = self.portal_catalog.unrestrictedSearchResults(
portal_type='Compute Node',
user_id=user_name,
validation_state="validated",
limit=2,
)
if len(computer_list) == 1:
if len(compute_node_list) == 1:
for base_category in base_category_list:
if base_category == "role":
category_list.append(
{base_category: ['role/computer']})
elif len(computer_list) > 1:
raise ConsistencyError("Error: There is more than one Computer " \
elif len(compute_node_list) > 1:
raise ConsistencyError("Error: There is more than one Compute Node " \
"with reference '%s'" % user_name)
return category_list
......@@ -103,7 +103,7 @@ def restrictMethodAsShadowUser(self, shadow_document=None, callable_object=None,
raise TypeError('shadow_document and callable_object cannot be None')
relative_url = shadow_document.getRelativeUrl()
if shadow_document.getPortalType() not in ('Person', 'Software Instance',
'Computer'):
'Compute Node'):
raise Unauthorized("%s portal type %r is not supported" % (relative_url,
shadow_document.getPortalType()))
else:
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Computer" module="erp5.portal_type"/>
<global name="Compute Node" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -62,11 +62,11 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>template_computer</string> </value>
<value> <string>template_compute_node</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Computer</string> </value>
<value> <string>Compute Node</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -8,11 +8,11 @@
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_searchComputerPartitionAndMarkFree</string> </value>
<value> <string>Alarm_searchComputePartitionAndMarkFree</string> </value>
</item>
<item>
<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>
<key> <string>enabled</string> </key>
......@@ -20,7 +20,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_free_computer_partition</string> </value>
<value> <string>slapos_free_compute_partition</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
......@@ -87,7 +87,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Mark computer partition as free</string> </value>
<value> <string>Mark compute partition as free</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -8,7 +8,7 @@
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_managePublicComputerCapacityScope</string> </value>
<value> <string>Alarm_managePublicComputeNodeCapacityScope</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -22,7 +22,7 @@
</item>
<item>
<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>
<key> <string>periodicity_day_frequency</string> </key>
......@@ -95,7 +95,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Desactivate Dead Computer</string> </value>
<value> <string>Desactivate Dead Compute Node</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -62,7 +62,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>computer</string> </value>
<value> <string>compute_node</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -70,7 +70,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Computer</string> </value>
<value> <string>Compute Node</string> </value>
</item>
</dictionary>
</pickle>
......
<allowed_content_type_list>
<portal_type id="Computer">
<portal_type id="Compute Node">
<item>Certificate Login</item>
<item>ERP5 Login</item>
</portal_type>
......
<base_category_list>
<portal_type id="Computer">
<portal_type id="Compute Node">
<item>destination_section</item>
<item>source_administration</item>
</portal_type>
......
......@@ -5,19 +5,27 @@
<portal_type id="Assignment">
<item>SlaposAssignmentConstraint</item>
</portal_type>
<portal_type id="Computer">
<item>ComputerSlapOSMetadata</item>
<portal_type id="Compute Node">
<item>ComputeNodeSlapOSMetadata</item>
<item>ComputerUpgradeConstraint</item>
<item>ERP5User</item>
<item>SlaposCapacity</item>
<item>SlaposComputerConstraint</item>
<item>SlaposComputeNodeConstraint</item>
<item>Url</item>
</portal_type>
<portal_type id="Compute Partition">
<item>ComputePartition</item>
<item>ComputerPartitionUpgradeConstraint</item>
<item>SlaposComputePartitionConstraint</item>
</portal_type>
<portal_type id="Computer">
<item>ComputerUpgradeConstraint</item>
</portal_type>
<portal_type id="Computer Model">
<item>SlaposCapacity</item>
</portal_type>
<portal_type id="Computer Partition">
<item>ComputerPartition</item>
<item>SlaposComputerPartitionConstraint</item>
<item>ComputerPartitionUpgradeConstraint</item>
</portal_type>
<portal_type id="Email">
<item>SlaposEmailConstraint</item>
......
......@@ -38,7 +38,7 @@
\n
ERP5 folders are implemented as CMFBTreeFolder objects\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
AdaptableStorage implementation in order to reach performances\n
of 10 or 100 millions of documents in a single folder.\n
......
......@@ -38,7 +38,7 @@
\n
ERP5 folders are implemented as CMFBTreeFolder objects\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
AdaptableStorage implementation in order to reach performances\n
of 10 or 100 millions of documents in a single folder.\n
......
......@@ -37,7 +37,7 @@
\n
ERP5 folders are implemented as CMFBTreeFolder objects\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
AdaptableStorage implementation in order to reach performances\n
of 10 or 100 millions of documents in a single folder.\n
......
<workflow_chain>
<chain>
<type>Computer</type>
<workflow>computer_slap_interface_workflow, slapos_cloud_interaction_workflow</workflow>
<type>Compute Node</type>
<workflow>compute_node_slap_interface_workflow, slapos_cloud_interaction_workflow</workflow>
</chain>
<chain>
<type>Computer Partition</type>
<workflow>computer_partition_slap_interface_workflow</workflow>
<type>Compute Partition</type>
<workflow>compute_partition_slap_interface_workflow</workflow>
</chain>
<chain>
<type>Hosting Subscription</type>
......
......@@ -32,7 +32,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputerSlapOSMetadata</string> </value>
<value> <string>ComputeNodeSlapOSMetadata</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
......@@ -26,7 +26,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputerPartition</string> </value>
<value> <string>ComputePartition</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
......@@ -71,7 +71,7 @@
</item>
<item>
<key> <string>acquisition_portal_type</string> </key>
<value> <string>python: (\'Computer Partition\',)</string> </value>
<value> <string>python: (\'Compute Partition\',)</string> </value>
</item>
<item>
<key> <string>acquisition_sync_value</string> </key>
......@@ -109,7 +109,7 @@
</item>
<item>
<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>
<key> <string>id</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Sheet" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputerPartitionUpgradeConstraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Script Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>constraint_type/default</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>computer_partition_migration_constraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Script Constraint</string> </value>
</item>
<item>
<key> <string>script_id</string> </key>
<value> <string>ComputerPartition_checkComputePartitionMigrationConsistency</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -32,7 +32,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SlaposComputerConstraint</string> </value>
<value> <string>ComputerUpgradeConstraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Script Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>constraint_type/default</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>computer_migration_constraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Script Constraint</string> </value>
</item>
<item>
<key> <string>script_id</string> </key>
<value> <string>Computer_checkComputeNodeMigrationConsistency</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Script Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>constraint_type/post_upgrade</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>compute_node_migration_constraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Script Constraint</string> </value>
</item>
<item>
<key> <string>script_id</string> </key>
<value> <string>AlarmTool_checkComputeNodeMigrationConsistency</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -32,7 +32,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SlaposComputerPartitionConstraint</string> </value>
<value> <string>SlaposComputeNodeConstraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Sheet" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SlaposComputePartitionConstraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
......@@ -32,7 +32,7 @@
</item>
<item>
<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>
<key> <string>id</string> </key>
......
......@@ -32,7 +32,7 @@
</item>
<item>
<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>
<key> <string>id</string> </key>
......
portal = context.getPortalObject()
result_list = []
migration_kw = {
'portal_type': 'Computer',
'slap_state': '%'
}
non_migrated_instance = portal.portal_catalog(limit=1, **migration_kw)
if len(non_migrated_instance) == 1:
if fixit:
portal.portal_catalog.searchAndActivate(
activate_kw=dict(priority=5,
tag=script.getId(),
after_method_id=('immediateReindexObject',
'recursiveImmediateReindexObject')),
method_id='fixConsistency',
**migration_kw)
else:
result_list.append("all X needs updates %s" % non_migrated_instance[0].getRelativeUrl())
return result_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>fixit=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AlarmTool_checkComputeNodeMigrationConsistency</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -7,10 +7,10 @@ category_uid_list = [ i.getUid() for i in category_list if i is not None]
if category_uid_list:
portal.portal_catalog.searchAndActivate(
portal_type='Computer',
portal_type='Compute Node',
default_allocation_scope_uid=category_uid_list,
validation_state="validated",
method_id='Computer_checkAndUpdateCapacityScope',
method_id='ComputeNode_checkAndUpdateCapacityScope',
activate_kw={'tag': tag}
)
context.activate(after_tag=tag).getId()
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_computerCheckUpgradeSoftwareRelease</string> </value>
<value> <string>Alarm_managePublicComputeNodeCapacityScope</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_managePublicComputerCapacityScope</string> </value>
<value> <string>Alarm_searchComputePartitionAndMarkFree</string> </value>
</item>
</dictionary>
</pickle>
......
compute_node = context.REQUEST.get('here')
software_release = context
return compute_node.ComputeNode_getSoftwareReleaseState(software_release.getUid())
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getSoftwareReleaseStateOnComputer</string> </value>
<value> <string>Base_getSoftwareReleaseStateOnComputeNode</string> </value>
</item>
</dictionary>
</pickle>
......
computer = context.REQUEST.get('here')
software_release = context
return computer.Computer_getSoftwareReleaseState(software_release.getUid())
current = context.REQUEST.get('here')
if current.getPortalType() == 'Software Release':
software_release = current
computer = context
compute_node = context
else:
computer = current
compute_node = current
software_release = context
return computer.Computer_getSoftwareReleaseUsage(software_release.getUrlString())
return compute_node.ComputeNode_getSoftwareReleaseUsage(software_release.getUrlString())
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getSoftwareReleaseUsageOnComputer</string> </value>
<value> <string>Base_getSoftwareReleaseUsageOnComputeNode</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -110,7 +110,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputerModule_viewComputerList</string> </value>
<value> <string>ComputeNodeModule_viewComputeNodeList</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -118,7 +118,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>ComputerModule_viewComputerList</string> </value>
<value> <string>ComputeNodeModule_viewComputeNodeList</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......@@ -134,7 +134,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Computers</string> </value>
<value> <string>Compute Nodes</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
......
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