Commit d545253d authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Check if Slaved instance is left over

   If a software instance with 1 or more slave instances allocated on it is destroyed the instances aren't reallocated, so let's create a ticket to high light the problem.
parent 652532ee
Pipeline #38151 running with stage
in 0 seconds
...@@ -38,6 +38,16 @@ if compute_node.getPortalType() == "Compute Node" and \ ...@@ -38,6 +38,16 @@ if compute_node.getPortalType() == "Compute Node" and \
error_dict['ticket_description'] = error_dict['message'] error_dict['ticket_description'] = error_dict['message']
return error_dict return error_dict
if context.getPortalType() == 'Slave Instance' and compute_node.getPortalType() == "Compute Node":
software_instance = compute_partition.getAggregateRelatedValue(portal_type='Software Instance')
if software_instance is None:
# Slave instance is allocated but the software instance was already destroyed
error_dict['notification_message_reference'] = 'slapos-crm-instance-tree-slave-on-destroyed-instance.notification'
error_dict = updateErrorDictWithError(error_dict)
error_dict['message'] = "%s is allocated on a destroyed software instance (already removed)." % context.getTitle()
error_dict['ticket_description'] = error_dict['message']
return error_dict
# Skip to check if monitor disabled on the compute node. # Skip to check if monitor disabled on the compute node.
# Remote node has no state. # Remote node has no state.
if (compute_node.getPortalType() == "Compute Node") and (compute_node.getMonitorScope() != "enabled"): if (compute_node.getPortalType() == "Compute Node") and (compute_node.getMonitorScope() != "enabled"):
......
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