Commit d18fabbe authored by Romain Courteaud's avatar Romain Courteaud

slapos_pdm: drop InstanceTree_isUpgradePossible

No way to know which software release url on instance will request.
parent 69e24f5d
portal = context.getPortalObject()
# This won't work well on clusters deployed on multiple compute_nodes.
root_instance = context.getSuccessorValue(
portal_type=["Software Instance", "Slave Instance"])
if root_instance is not None and root_instance.getPortalType() == 'Slave Instance':
return True
# Get Compute Node List
instance_list = context.getSpecialiseRelatedValueList(
portal_type="Software Instance")
compute_node_list = []
for instance in instance_list:
if instance.getSlapState() == "destroy_requested":
continue
partition = instance.getAggregateValue(portal_type="Compute Partition")
if partition is None:
continue
compute_node_list.append(partition.getParentValue().getUid())
if not compute_node_list:
return True
full_software_installation_list = [si for si in
portal.portal_catalog(
portal_type='Software Installation',
url_string=software_release_url,
default_aggregate_uid=compute_node_list,
validation_state='validated'
) if si.getSlapState() == 'start_requested']
if len(full_software_installation_list) > 0 and \
len(full_software_installation_list) == len(set(compute_node_list)):
# Software is available for the root instance
software_installation = full_software_installation_list[0]
message = software_installation.getTextAccessStatus()
if message.startswith("#access"):
return True
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>software_release_url</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>InstanceTree_isUpgradePossible</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -28,11 +28,6 @@ if compute_node is not None:
upgrade_decision.stop(comment="Upgrade Processed for the Compute Node!")
return
# Test if the Software is available at the ComputeNode.
if not instance_tree.InstanceTree_isUpgradePossible(
software_release_url=software_release_url):
return
status = instance_tree.getSlapState()
if status == "start_requested":
state = "started"
......
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