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
a918262b
Commit
a918262b
authored
Jan 20, 2023
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: update not allocated in there is instance node supply
parent
c78fce70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
5 deletions
+37
-5
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
...al_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
+6
-3
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
...ents/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
+31
-2
No files found.
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
View file @
a918262b
...
@@ -66,9 +66,12 @@ allocation_cell_list = software_product.getFollowUpValue().Project_getSoftwarePr
...
@@ -66,9 +66,12 @@ allocation_cell_list = software_product.getFollowUpValue().Project_getSoftwarePr
predicate_portal_type
=
'Allocation Supply Cell'
predicate_portal_type
=
'Allocation Supply Cell'
)
)
if
(
root_instance
.
getPortalType
()
==
'Slave Instance'
)
and
\
if
compute_node
is
None
:
(
compute_node
is
None
):
allocation_cell_node_list
=
[(
x
,
[
y
.
getPortalType
()
for
y
in
x
.
getParentValue
().
getParentValue
().
getAggregateValueList
()])
for
x
in
allocation_cell_list
]
allocation_cell_list
=
[
x
for
x
in
allocation_cell_list
if
(
"Remote Node"
in
[
y
.
getPortalType
()
for
y
in
x
.
getParentValue
().
getParentValue
().
getAggregateValueList
()])]
if
(
root_instance
.
getPortalType
()
==
'Slave Instance'
):
allocation_cell_list
=
[
x
for
x
,
y
in
allocation_cell_node_list
if
(
"Remote Node"
in
y
)
or
(
"Instance Node"
in
y
)]
elif
(
root_instance
.
getPortalType
()
==
'Software Instance'
):
allocation_cell_list
=
[
x
for
x
,
y
in
allocation_cell_node_list
if
(
"Remote Node"
in
y
)
or
(
"Compute Node"
in
y
)]
# Only upgrade if there is no doubt (ie, only 1 url is allowed)
# Only upgrade if there is no doubt (ie, only 1 url is allowed)
if
len
(
allocation_cell_list
)
==
1
:
if
len
(
allocation_cell_list
)
==
1
:
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
View file @
a918262b
...
@@ -59,6 +59,11 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
...
@@ -59,6 +59,11 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
portal_type
=
"Remote Node"
,
portal_type
=
"Remote Node"
,
follow_up_value
=
project
follow_up_value
=
project
)
)
elif
node
==
"instance"
:
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
"Instance Node"
,
follow_up_value
=
project
)
else
:
else
:
raise
ValueError
(
"Unsupported node value: %s"
%
node
)
raise
ValueError
(
"Unsupported node value: %s"
%
node
)
...
@@ -76,6 +81,8 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
...
@@ -76,6 +81,8 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
instance_tree
=
self
.
portal
.
REQUEST
.
get
(
'request_instance_tree'
)
instance_tree
=
self
.
portal
.
REQUEST
.
get
(
'request_instance_tree'
)
if
is_allocated
:
if
is_allocated
:
if
node
==
"instance"
:
raise
NotImplementedError
(
'can not allocate on instance node'
)
partition
=
compute_node
.
newContent
(
portal_type
=
'Compute Partition'
)
partition
=
compute_node
.
newContent
(
portal_type
=
'Compute Partition'
)
instance
=
instance_tree
.
getSuccessorValue
()
instance
=
instance_tree
.
getSuccessorValue
()
instance
.
edit
(
aggregate_value
=
partition
)
instance
.
edit
(
aggregate_value
=
partition
)
...
@@ -90,7 +97,7 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
...
@@ -90,7 +97,7 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
software_product
,
_
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
()
software_product
,
_
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
()
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for compute node
2
"
,
compute_node
,
software_product
,
self
.
addAllocationSupply
(
"for compute node"
,
compute_node
,
software_product
,
new_release_variation
,
type_variation
)
new_release_variation
,
type_variation
)
self
.
tic
()
self
.
tic
()
...
@@ -101,13 +108,23 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
...
@@ -101,13 +108,23 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
software_product
,
_
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
node
=
"remote"
)
software_product
,
_
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
node
=
"remote"
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for remote node
2
"
,
compute_node
,
software_product
,
self
.
addAllocationSupply
(
"for remote node"
,
compute_node
,
software_product
,
new_release_variation
,
type_variation
)
new_release_variation
,
type_variation
)
self
.
tic
()
self
.
tic
()
upgrade_decision
=
instance_tree
.
InstanceTree_createUpgradeDecision
()
upgrade_decision
=
instance_tree
.
InstanceTree_createUpgradeDecision
()
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
def
test_createUpgradeDecision_notAllocated_newReleaseOnInstanceNode
(
self
):
software_product
,
_
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
node
=
"instance"
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for instance node"
,
compute_node
,
software_product
,
new_release_variation
,
type_variation
)
self
.
tic
()
self
.
assertEqual
(
None
,
instance_tree
.
InstanceTree_createUpgradeDecision
())
def
test_createUpgradeDecision_notAllocated_sameRelease
(
self
):
def
test_createUpgradeDecision_notAllocated_sameRelease
(
self
):
software_product
,
release_variation
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
()
software_product
,
release_variation
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
()
...
@@ -198,6 +215,17 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
...
@@ -198,6 +215,17 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
upgrade_decision
=
instance_tree
.
InstanceTree_createUpgradeDecision
()
upgrade_decision
=
instance_tree
.
InstanceTree_createUpgradeDecision
()
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
def
test_createUpgradeDecision_sharedNotAllocated_newReleaseOnInstanceNode
(
self
):
software_product
,
_
,
type_variation
,
compute_node
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
shared
=
True
,
node
=
"instance"
)
new_release_variation
=
self
.
_makeSoftwareRelease
(
software_product
)
self
.
addAllocationSupply
(
"for instance node"
,
compute_node
,
software_product
,
new_release_variation
,
type_variation
)
self
.
tic
()
upgrade_decision
=
instance_tree
.
InstanceTree_createUpgradeDecision
()
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
##########################################################################
##########################################################################
# Allocated on Compute Node
# Allocated on Compute Node
##########################################################################
##########################################################################
...
@@ -358,3 +386,4 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
...
@@ -358,3 +386,4 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
None
,
instance_tree
.
InstanceTree_createUpgradeDecision
())
self
.
assertEqual
(
None
,
instance_tree
.
InstanceTree_createUpgradeDecision
())
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