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
ab54c13a
Commit
ab54c13a
authored
Nov 14, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: allow to force upgrade to a specific release
parent
fc74fe8b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
3 deletions
+84
-3
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
...al_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
+9
-2
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.xml
...l_skins/slapos_pdm/InstanceTree_createUpgradeDecision.xml
+1
-1
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
...ents/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
+74
-0
No files found.
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
View file @
ab54c13a
...
...
@@ -6,6 +6,13 @@ instance_tree = context
if
instance_tree
.
getSlapState
()
==
"destroy_requested"
:
return
if
(
target_software_release
is
not
None
)
or
(
target_software_type
is
not
None
):
# Those parameters will be use to force an upgrade decision
# to a specific release / type
# used by Remote Node for example
assert
target_software_release
is
not
None
assert
target_software_type
is
not
None
if
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Upgrade Decision'
,
aggregate__uid
=
instance_tree
.
getUid
(),
...
...
@@ -59,8 +66,8 @@ if person is None:
# XXX search only for the main node
allocation_cell_list
=
software_product
.
getFollowUpValue
().
Project_getSoftwareProductPredicateList
(
software_product
=
software_product
,
software_product_type
=
software_type
,
#software_product_release=
software_release,
software_product_type
=
target_software_type
or
software_type
,
software_product_release
=
target_
software_release
,
destination_value
=
person
,
node_value
=
compute_node
,
predicate_portal_type
=
'Allocation Supply Cell'
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.xml
View file @
ab54c13a
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
target_software_release=None, target_software_type=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
View file @
ab54c13a
...
...
@@ -311,6 +311,39 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(SlapOSTestCaseMixin):
instance_tree
,
software_product
,
new_release_variation
,
type_variation
)
def
test_createUpgradeDecision_allocatedOnComputeNode_newReleaseOnComputeNodeAndCorrectTarget
(
self
):
software_product
,
_
,
type_variation
,
compute_node
,
_
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
allocation_state
=
'allocated'
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for compute node"
,
compute_node
,
software_product
,
new_release_variation
,
type_variation
,
disable_alarm
=
True
)
self
.
tic
()
self
.
checkCreatedUpgradeDecision
(
instance_tree
.
InstanceTree_createUpgradeDecision
(
target_software_release
=
new_release_variation
,
target_software_type
=
type_variation
),
instance_tree
,
software_product
,
new_release_variation
,
type_variation
)
def
test_createUpgradeDecision_allocatedOnComputeNode_newReleaseOnComputeNodeAndIncorrectTarget
(
self
):
software_product
,
_
,
type_variation
,
compute_node
,
_
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
allocation_state
=
'allocated'
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
incorrect_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for compute node"
,
compute_node
,
software_product
,
new_release_variation
,
type_variation
,
disable_alarm
=
True
)
self
.
tic
()
self
.
assertEqual
(
None
,
instance_tree
.
InstanceTree_createUpgradeDecision
(
target_software_release
=
incorrect_release_variation
,
target_software_type
=
type_variation
)
)
def
test_createUpgradeDecision_allocatedOnComputeNode_twoRelease
(
self
):
software_product
,
release_variation
,
type_variation
,
compute_node
,
_
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
allocation_state
=
'allocated'
)
self
.
tic
()
...
...
@@ -325,6 +358,47 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(SlapOSTestCaseMixin):
self
.
assertEqual
(
None
,
instance_tree
.
InstanceTree_createUpgradeDecision
())
def
test_createUpgradeDecision_allocatedOnComputeNode_twoReleaseAndCorrectTarget
(
self
):
software_product
,
release_variation
,
type_variation
,
compute_node
,
_
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
allocation_state
=
'allocated'
)
self
.
tic
()
self
.
addAllocationSupply
(
"for compute node"
,
compute_node
,
software_product
,
release_variation
,
type_variation
,
disable_alarm
=
True
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for compute node 2"
,
compute_node
,
software_product
,
new_release_variation
,
type_variation
,
disable_alarm
=
True
)
self
.
tic
()
self
.
checkCreatedUpgradeDecision
(
instance_tree
.
InstanceTree_createUpgradeDecision
(
target_software_release
=
new_release_variation
,
target_software_type
=
type_variation
),
instance_tree
,
software_product
,
new_release_variation
,
type_variation
)
def
test_createUpgradeDecision_allocatedOnComputeNode_twoReleaseAndIncorrectTarget
(
self
):
software_product
,
release_variation
,
type_variation
,
compute_node
,
_
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
allocation_state
=
'allocated'
)
self
.
tic
()
self
.
addAllocationSupply
(
"for compute node"
,
compute_node
,
software_product
,
release_variation
,
type_variation
,
disable_alarm
=
True
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
incorrect_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for compute node 2"
,
compute_node
,
software_product
,
new_release_variation
,
type_variation
,
disable_alarm
=
True
)
self
.
tic
()
self
.
assertEqual
(
instance_tree
.
InstanceTree_createUpgradeDecision
(
target_software_release
=
incorrect_release_variation
,
target_software_type
=
type_variation
),
None
)
##########################################################################
# Shared allocated on Compute Node
##########################################################################
...
...
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