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
903099c9
Commit
903099c9
authored
May 31, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: stop using shadow to allocate instance
Use project only
parent
398ed4d0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.py
...ateItem/portal_skins/slapos_cloud/Person_findPartition.py
+4
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.xml
...teItem/portal_skins/slapos_cloud/Person_findPartition.xml
+1
-1
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToAllocatePartition.py
...s/slapos_cloud/SoftwareInstance_tryToAllocatePartition.py
+13
-1
No files found.
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.py
View file @
903099c9
...
...
@@ -2,10 +2,12 @@ import random
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
person
=
context
assert
project_uid
compute_partition
=
None
filter_kw_copy
=
filter_kw
.
copy
()
query_kw
=
{
'follow_up__uid'
:
project_uid
,
'software_release_url'
:
software_release_url
,
'portal_type'
:
'Compute Partition'
,
}
...
...
@@ -30,6 +32,7 @@ if 'network_guid' in filter_kw:
network_guid
=
filter_kw
.
pop
(
'network_guid'
)
query_kw
[
"default_subordination_reference"
]
=
SimpleQuery
(
default_subordination_reference
=
network_guid
)
"""
if 'project_guid' in filter_kw:
# This implementation isn't optimal, as we would prefere place a direct query rather them make an
# direct query.
...
...
@@ -42,6 +45,7 @@ if 'project_guid' in filter_kw:
if project is not None:
query_kw["parent_reference"] = SimpleQuery(parent_reference=project.Project_getComputeNodeReferenceList())
"""
if
computer_network_query
:
if
query_kw
.
get
(
"default_subordination_reference"
):
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.xml
View file @
903099c9
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
software_release_url, software_type, software_instance_portal_type, filter_kw, computer_network_query=None, subscription_reference=None, is_root_slave=False, test_mode=False
</string>
</value>
<value>
<string>
project_uid,
software_release_url, software_type, software_instance_portal_type, filter_kw, computer_network_query=None, subscription_reference=None, is_root_slave=False, test_mode=False
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToAllocatePartition.py
View file @
903099c9
...
...
@@ -17,7 +17,8 @@ def assignComputePartition(software_instance, instance_tree):
portal_type
=
"Compute Partition"
)
if
compute_partition
is
None
:
instance_tree
=
software_instance
.
getSpecialiseValue
(
portal_type
=
'Instance Tree'
)
portal_type
=
'Instance Tree'
)
if
instance_tree
is
None
:
raise
ValueError
(
'%s does not have related instance tree'
%
software_instance
.
getRelativeUrl
())
...
...
@@ -109,12 +110,23 @@ def assignComputePartition(software_instance, instance_tree):
elif
sla_dict
.
get
(
'mode'
):
computer_network_query
=
'-1'
"""
compute_partition_relative_url = person.Person_restrictMethodAsShadowUser(
shadow_document=person,
callable_object=person.Person_findPartition,
argument_list=[software_instance.getUrlString(), software_instance.getSourceReference(),
software_instance.getPortalType(), sla_dict, computer_network_query,
subscription_reference, instance_tree.isRootSlave()])
"""
compute_partition_relative_url
=
person
.
Person_findPartition
(
software_instance
.
getFollowUpUid
(
portal_type
=
'Project'
),
software_instance
.
getUrlString
(),
software_instance
.
getSourceReference
(),
software_instance
.
getPortalType
(),
sla_dict
,
computer_network_query
,
subscription_reference
,
instance_tree
.
isRootSlave
()
)
return
compute_partition_relative_url
,
tag
software_instance
=
context
...
...
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