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
74a6cab5
Commit
74a6cab5
authored
Nov 29, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: allocate slave on instance from the same instance tree
parent
667d62fe
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
231 additions
and
11 deletions
+231
-11
master/bt5/slapos_cloud/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
...rtalTypePropertySheetTemplateItem/property_sheet_list.xml
+1
-0
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/AllocationSupply.xml
...tTemplateItem/portal_property_sheets/AllocationSupply.xml
+66
-0
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/AllocationSupply/slave_on_same_instance_tree_allocable_property.xml
...Supply/slave_on_same_instance_tree_allocable_property.xml
+55
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/AllocationSupply_view.xml
...eItem/portal_skins/slapos_cloud/AllocationSupply_view.xml
+4
-2
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/AllocationSupply_view/my_slave_on_same_instance_tree_allocable.xml
...nSupply_view/my_slave_on_same_instance_tree_allocable.xml
+84
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.py
...ateItem/portal_skins/slapos_cloud/Person_findPartition.py
+15
-5
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
+2
-2
master/bt5/slapos_cloud/bt/template_portal_type_property_sheet_list
.../slapos_cloud/bt/template_portal_type_property_sheet_list
+1
-0
master/bt5/slapos_cloud/bt/template_property_sheet_id_list
master/bt5/slapos_cloud/bt/template_property_sheet_id_list
+2
-1
No files found.
master/bt5/slapos_cloud/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
View file @
74a6cab5
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
<item>
SlapOSMasterUpgradeConstraint
</item>
<item>
SlapOSMasterUpgradeConstraint
</item>
</portal_type>
</portal_type>
<portal_type
id=
"Allocation Supply"
>
<portal_type
id=
"Allocation Supply"
>
<item>
AllocationSupply
</item>
<item>
SlapOSVirtualMasterSourceProjectConstraint
</item>
<item>
SlapOSVirtualMasterSourceProjectConstraint
</item>
</portal_type>
</portal_type>
<portal_type
id=
"Allocation Supply Cell"
>
<portal_type
id=
"Allocation Supply Cell"
>
...
...
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/AllocationSupply.xml
0 → 100644
View file @
74a6cab5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Property Sheet"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_count
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_mt_index
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_tree
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
AllocationSupply
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Property Sheet
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Length"
module=
"BTrees.Length"
/>
</pickle>
<pickle>
<int>
0
</int>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/AllocationSupply/slave_on_same_instance_tree_allocable_property.xml
0 → 100644
View file @
74a6cab5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_local_properties
</string>
</key>
<value>
<tuple>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
mode
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
string
</string>
</value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/boolean
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slave_on_same_instance_tree_allocable_property
</string>
</value>
</item>
<item>
<key>
<string>
mode
</string>
</key>
<value>
<string>
w
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/AllocationSupply_view.xml
View file @
74a6cab5
...
@@ -65,7 +65,10 @@
...
@@ -65,7 +65,10 @@
<item>
<item>
<key>
<string>
center
</string>
</key>
<key>
<string>
center
</string>
</key>
<value>
<value>
<list/>
<list>
<string>
my_aggregate_title_list
</string>
<string>
my_slave_on_same_instance_tree_allocable
</string>
</list>
</value>
</value>
</item>
</item>
<item>
<item>
...
@@ -88,7 +91,6 @@
...
@@ -88,7 +91,6 @@
<key>
<string>
right
</string>
</key>
<key>
<string>
right
</string>
</key>
<value>
<value>
<list>
<list>
<string>
my_aggregate_title_list
</string>
<string>
my_destination_project_title
</string>
<string>
my_destination_project_title
</string>
<string>
my_destination_title
</string>
<string>
my_destination_title
</string>
<string>
my_translated_validation_state_title
</string>
<string>
my_translated_validation_state_title
</string>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/AllocationSupply_view/my_slave_on_same_instance_tree_allocable.xml
0 → 100644
View file @
74a6cab5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_slave_on_same_instance_tree_allocable
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_checkbox
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Allocate Slave On Same Instance Tree
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.py
View file @
74a6cab5
...
@@ -13,11 +13,9 @@ query_kw = {
...
@@ -13,11 +13,9 @@ query_kw = {
}
}
if
software_instance_portal_type
==
"Slave Instance"
:
if
software_instance_portal_type
==
"Slave Instance"
:
query_kw
[
'free_for_request'
]
=
0
query_kw
[
'free_for_request'
]
=
0
compute_node_portal_type
=
'Instance Node'
elif
software_instance_portal_type
==
"Software Instance"
:
elif
software_instance_portal_type
==
"Software Instance"
:
query_kw
[
'free_for_request'
]
=
1
query_kw
[
'free_for_request'
]
=
1
query_kw
[
'software_release_url'
]
=
software_release_url
query_kw
[
'software_release_url'
]
=
software_release_url
compute_node_portal_type
=
'Compute Node'
else
:
else
:
raise
NotImplementedError
(
"Unknown portal type %s"
%
raise
NotImplementedError
(
"Unknown portal type %s"
%
software_instance_portal_type
)
software_instance_portal_type
)
...
@@ -50,17 +48,28 @@ allocation_cell_list = software_product.getFollowUpValue().Project_getSoftwarePr
...
@@ -50,17 +48,28 @@ allocation_cell_list = software_product.getFollowUpValue().Project_getSoftwarePr
if
not
allocation_cell_list
:
if
not
allocation_cell_list
:
raise
ValueError
(
'No Allocation Supply allowing this operation'
)
raise
ValueError
(
'No Allocation Supply allowing this operation'
)
# Only partition with Instances from the same Instance Tree
instance_tree_partition_value_list
=
[
sql_obj
.
getAggregateValue
()
\
for
sql_obj
in
context
.
getPortalObject
().
portal_catalog
(
portal_type
=
[
'Software Instance'
],
specialise__uid
=
instance_tree
.
getUid
(),
)
if
((
sql_obj
.
getAggregateValue
()
is
not
None
)
and
(
sql_obj
.
getUrlString
()
==
software_release_url
)
and
(
sql_obj
.
getSourceReference
()
==
software_type
))
]
# Get the list of allowed Compute Node, Instance Node
# Get the list of allowed Compute Node, Instance Node
compute_node_list_list
=
[
x
.
getParentValue
().
getParentValue
().
getAggregateValueList
(
portal_type
=
compute_node_portal_type
)
for
x
in
allocation_cell_list
]
compute_node_list_list
=
[
(
x
.
getParentValue
().
getParentValue
().
getAggregateValueList
(),
x
.
getParentValue
().
getParentValue
().
isSlaveOnSameInstanceTreeAllocable
()
)
for
x
in
allocation_cell_list
]
parent_uid_list
=
[]
parent_uid_list
=
[]
partition_uid_list
=
[]
partition_uid_list
=
[]
for
compute_node_list
in
compute_node_list_list
:
for
compute_node_list
,
is_slave_on_same_instance_tree_allocable
in
compute_node_list_list
:
for
compute_node
in
compute_node_list
:
for
compute_node
in
compute_node_list
:
if
compute_node
.
getPortalType
()
==
'Compute Node'
:
if
compute_node
.
getPortalType
()
==
'Compute Node'
:
parent_uid_list
.
append
(
compute_node
.
getUid
())
parent_uid_list
.
append
(
compute_node
.
getUid
())
if
is_slave_on_same_instance_tree_allocable
:
partition_uid_list
.
extend
([
x
.
getUid
()
for
x
in
instance_tree_partition_value_list
if
(
x
.
getParentValue
().
getUid
()
==
compute_node
.
getUid
())])
elif
compute_node
.
getPortalType
()
==
'Instance Node'
:
elif
compute_node
.
getPortalType
()
==
'Instance Node'
:
shared_instance
=
compute_node
.
getSpecialiseValue
(
portal_type
=
'Software Instance'
)
shared_instance
=
compute_node
.
getSpecialiseValue
(
portal_type
=
'Software Instance'
)
if
shared_instance
is
not
None
:
if
(
shared_instance
is
not
None
)
:
# No need to search for original software type/url
# No need to search for original software type/url
#query_kw['software_release_url'] = software_release_url
#query_kw['software_release_url'] = software_release_url
#query_kw['software_type'] = software_type
#query_kw['software_type'] = software_type
...
@@ -69,6 +78,7 @@ for compute_node_list in compute_node_list_list:
...
@@ -69,6 +78,7 @@ for compute_node_list in compute_node_list_list:
partition_uid_list
.
append
(
shared_partition
.
getUid
())
partition_uid_list
.
append
(
shared_partition
.
getUid
())
else
:
else
:
raise
NotImplementedError
(
'Unsupported Node type: %s'
%
compute_node
.
getPortalType
())
raise
NotImplementedError
(
'Unsupported Node type: %s'
%
compute_node
.
getPortalType
())
if
len
(
parent_uid_list
)
==
0
:
if
len
(
parent_uid_list
)
==
0
:
# Ensure nothing will be found
# Ensure nothing will be found
parent_uid_list
.
append
(
-
1
)
parent_uid_list
.
append
(
-
1
)
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.xml
View file @
74a6cab5
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<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=Fals
e, test_mode=False
</string>
</value>
<value>
<string>
instance_tree, project_uid, software_release_url, software_type, software_instance_portal_type, filter_kw, computer_network_query=None, subscription_reference=Non
e, test_mode=False
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToAllocatePartition.py
View file @
74a6cab5
...
@@ -120,13 +120,13 @@ def assignComputePartition(software_instance, instance_tree):
...
@@ -120,13 +120,13 @@ def assignComputePartition(software_instance, instance_tree):
subscription_reference, instance_tree.isRootSlave()])
subscription_reference, instance_tree.isRootSlave()])
"""
"""
compute_partition_relative_url
=
person
.
Person_findPartition
(
compute_partition_relative_url
=
person
.
Person_findPartition
(
instance_tree
,
software_instance
.
getFollowUpUid
(
portal_type
=
'Project'
),
software_instance
.
getFollowUpUid
(
portal_type
=
'Project'
),
software_instance
.
getUrlString
(),
software_instance
.
getUrlString
(),
software_instance
.
getSourceReference
(),
software_instance
.
getSourceReference
(),
software_instance
.
getPortalType
(),
software_instance
.
getPortalType
(),
sla_dict
,
computer_network_query
,
sla_dict
,
computer_network_query
,
subscription_reference
,
subscription_reference
instance_tree
.
isRootSlave
()
)
)
return
compute_partition_relative_url
,
tag
return
compute_partition_relative_url
,
tag
...
...
master/bt5/slapos_cloud/bt/template_portal_type_property_sheet_list
View file @
74a6cab5
Alarm Tool | SlapOSMasterUpgradeConstraint
Alarm Tool | SlapOSMasterUpgradeConstraint
Allocation Supply Cell | AllocationSupplyPath
Allocation Supply Cell | AllocationSupplyPath
Allocation Supply Line | AllocationSupplyPath
Allocation Supply Line | AllocationSupplyPath
Allocation Supply | AllocationSupply
Allocation Supply | SlapOSVirtualMasterSourceProjectConstraint
Allocation Supply | SlapOSVirtualMasterSourceProjectConstraint
Assignment | SlaposAssignmentConstraint
Assignment | SlaposAssignmentConstraint
Compute Node | ComputeNodeSlapOSMetadata
Compute Node | ComputeNodeSlapOSMetadata
...
...
master/bt5/slapos_cloud/bt/template_property_sheet_id_list
View file @
74a6cab5
...
@@ -22,3 +22,4 @@ SlapOSReferenceConstraint
...
@@ -22,3 +22,4 @@ SlapOSReferenceConstraint
SlapOSVirtualMasterConstraint
SlapOSVirtualMasterConstraint
SlapOSVirtualMasterSourceProjectConstraint
SlapOSVirtualMasterSourceProjectConstraint
AllocationSupplyPath
AllocationSupplyPath
AllocationSupply
\ No newline at end of file
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