Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
ab89f093
Commit
ab89f093
authored
Nov 15, 2023
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: instance must be invalidated before unallocating it
parent
c620f77b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToUnallocatePartition.py
...slapos_cloud/SoftwareInstance_tryToUnallocatePartition.py
+4
-1
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
...eItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
+23
-0
No files found.
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToUnallocatePartition.py
View file @
ab89f093
instance
=
context
instance
=
context
if
instance
.
getSlapState
()
!=
'destroy_requested'
:
if
instance
.
getSlapState
()
!=
'destroy_requested'
:
return
return
if
instance
.
getValidationState
()
!=
'invalidated'
:
# Node must confirm the destruction before unallocation
return
partition
=
instance
.
getAggregateValue
(
portal_type
=
"Compute Partition"
)
partition
=
instance
.
getAggregateValue
(
portal_type
=
"Compute Partition"
)
portal
=
instance
.
getPortalObject
()
portal
=
instance
.
getPortalObject
()
...
@@ -13,7 +16,7 @@ if partition is not None:
...
@@ -13,7 +16,7 @@ if partition is not None:
instance
.
unallocatePartition
()
instance
.
unallocatePartition
()
instance_sql_list
=
portal
.
portal_catalog
(
instance_sql_list
=
portal
.
portal_catalog
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
],
portal_type
=
[
"Software Instance"
,
"Slave Instance"
],
default_aggregate
_uid
=
partition
.
getUid
(),
aggregate_
_uid
=
partition
.
getUid
(),
)
)
count
=
len
(
instance_sql_list
)
count
=
len
(
instance_sql_list
)
if
count
==
0
:
if
count
==
0
:
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
View file @
ab89f093
...
@@ -228,6 +228,8 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
...
@@ -228,6 +228,8 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
partition
.
markBusy
()
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
'destroy_requested'
)
'destroy_requested'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
'invalidated'
)
self
.
tic
()
self
.
tic
()
software_instance
.
SoftwareInstance_tryToUnallocatePartition
()
software_instance
.
SoftwareInstance_tryToUnallocatePartition
()
...
@@ -243,6 +245,8 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
...
@@ -243,6 +245,8 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
partition
.
markBusy
()
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
'destroy_requested'
)
'destroy_requested'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
'invalidated'
)
self
.
tic
()
self
.
tic
()
software_instance
.
SoftwareInstance_tryToUnallocatePartition
()
software_instance
.
SoftwareInstance_tryToUnallocatePartition
()
...
@@ -258,6 +262,8 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
...
@@ -258,6 +262,8 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
partition
.
markBusy
()
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
'destroy_requested'
)
'destroy_requested'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
'invalidated'
)
self
.
tic
()
self
.
tic
()
partition
.
activate
(
tag
=
"allocate_%s"
%
partition
.
getRelativeUrl
()
\
partition
.
activate
(
tag
=
"allocate_%s"
%
partition
.
getRelativeUrl
()
\
...
@@ -289,6 +295,8 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
...
@@ -289,6 +295,8 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
'busy'
)
'busy'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
'destroy_requested'
)
'destroy_requested'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
'invalidated'
)
self
.
tic
()
self
.
tic
()
software_instance
.
SoftwareInstance_tryToUnallocatePartition
()
software_instance
.
SoftwareInstance_tryToUnallocatePartition
()
...
@@ -317,6 +325,21 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
...
@@ -317,6 +325,21 @@ 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_notInvalidated
(
self
):
instance_tree
=
self
.
addInstanceTree
()
software_instance
=
instance_tree
.
getSuccessorValue
()
_
,
partition
=
self
.
addComputeNodeAndPartition
(
project
=
instance_tree
.
getFollowUpValue
())
software_instance
.
setAggregateValue
(
partition
)
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
software_instance
,
'destroy_requested'
)
self
.
tic
()
software_instance
.
SoftwareInstance_tryToUnallocatePartition
()
self
.
assertEqual
(
partition
.
getRelativeUrl
(),
software_instance
.
getAggregate
())
self
.
assertEqual
(
'busy'
,
partition
.
getSlapState
())
class
TestSlapOSGarbageCollectDestroyedRootTreeAlarm
(
SlapOSTestCaseMixin
):
class
TestSlapOSGarbageCollectDestroyedRootTreeAlarm
(
SlapOSTestCaseMixin
):
#################################################################
#################################################################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment