Commit 996d8a38 authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: do NOT markFree the SHARED_REMOTE partition

parent 5cf38068
Pipeline #37063 failed with stage
in 0 seconds
...@@ -14,6 +14,13 @@ if partition is not None: ...@@ -14,6 +14,13 @@ if partition is not None:
if (portal.portal_activities.countMessageWithTag(tag) == 0): if (portal.portal_activities.countMessageWithTag(tag) == 0):
# No concurrency issue # No concurrency issue
instance.unallocatePartition() instance.unallocatePartition()
if (partition.getId() == 'SHARED_REMOTE') and (partition.getParentValue().getPortalType() == 'Remote Node'):
# Do not free the SHARED_REMOTE partition on Remote Node
# used to allocate Slave Instance
# This partition is always busy, as no Software Instance is allocated on it
return
instance_sql_list = portal.portal_catalog( instance_sql_list = portal.portal_catalog(
portal_type=["Software Instance", "Slave Instance"], portal_type=["Software Instance", "Slave Instance"],
aggregate__uid=partition.getUid(), aggregate__uid=partition.getUid(),
......
...@@ -333,6 +333,24 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin): ...@@ -333,6 +333,24 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
self.assertEqual(partition.getRelativeUrl(), software_instance.getAggregate()) self.assertEqual(partition.getRelativeUrl(), software_instance.getAggregate())
self.assertEqual('busy', partition.getSlapState()) self.assertEqual('busy', partition.getSlapState())
def test_SoftwareInstance_tryToUnallocatePartition_script_sharedAndAllocatedOnRemoteNode(self):
instance_tree = self.addInstanceTree(shared=True)
software_instance = instance_tree.getSuccessorValue()
remote_node, _ = self.addComputeNodeAndPartition(portal_type='Remote Node',
project=instance_tree.getFollowUpValue())
partition = remote_node.restrictedTraverse('SHARED_REMOTE')
software_instance.setAggregateValue(partition)
self.portal.portal_workflow._jumpToStateFor(software_instance,
'destroy_requested')
self.portal.portal_workflow._jumpToStateFor(software_instance,
'invalidated')
self.tic()
software_instance.SoftwareInstance_tryToUnallocatePartition()
self.assertEqual(None, software_instance.getAggregate())
self.assertEqual('busy', partition.getSlapState())
class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin): class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
################################################################# #################################################################
......
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